From patchwork Thu Jun 30 18:33:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 102808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4CAA6B6F18 for ; Fri, 1 Jul 2011 05:19:00 +1000 (EST) Received: from localhost ([::1]:57158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcMlM-0004xa-RD for incoming@patchwork.ozlabs.org; Thu, 30 Jun 2011 15:18:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcM3A-0001pN-BM for qemu-devel@nongnu.org; Thu, 30 Jun 2011 14:33:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcM36-0007zB-OG for qemu-devel@nongnu.org; Thu, 30 Jun 2011 14:33:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcM35-0007yW-91 for qemu-devel@nongnu.org; Thu, 30 Jun 2011 14:33:11 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5UIXACV020787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 30 Jun 2011 14:33:10 -0400 Received: from localhost (ovpn-113-92.phx2.redhat.com [10.3.113.92]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5UIX9dV010933; Thu, 30 Jun 2011 14:33:09 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 30 Jun 2011 15:33:02 -0300 Message-Id: <1309458783-12661-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1309458783-12661-1-git-send-email-lcapitulino@redhat.com> References: <1309458783-12661-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 2/3] block: drive_init(): Simplify interface type setting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Luiz Capitulino Reviewed-by: Markus Armbruster --- blockdev.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/blockdev.c b/blockdev.c index 27bf68a..0a90ae8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -241,13 +241,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) translation = BIOS_ATA_TRANSLATION_AUTO; - if (default_to_scsi) { - type = IF_SCSI; - pstrcpy(devname, sizeof(devname), "scsi"); - } else { - type = IF_IDE; - pstrcpy(devname, sizeof(devname), "ide"); - } media = MEDIA_DISK; /* extract parameters */ @@ -273,7 +266,11 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) error_report("unsupported bus type '%s'", buf); return NULL; } + } else { + type = default_to_scsi ? IF_SCSI : IF_IDE; + pstrcpy(devname, sizeof(devname), if_name[type]); } + max_devs = if_max_devs[type]; if (cyls || heads || secs) {