From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qce33-0007qn-1k for qemu-devel@nongnu.org; Fri, 01 Jul 2011 09:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qce31-0003YV-9k for qemu-devel@nongnu.org; Fri, 01 Jul 2011 09:46:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qce30-0003YN-Nb for qemu-devel@nongnu.org; Fri, 01 Jul 2011 09:46:19 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p61DkHHJ024087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 1 Jul 2011 09:46:17 -0400 From: Luiz Capitulino Date: Fri, 1 Jul 2011 10:46:12 -0300 Message-Id: <1309527973-11127-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1309527973-11127-1-git-send-email-lcapitulino@redhat.com> References: <1309527973-11127-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] block: drive_init(): Simplify interface type setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com Signed-off-by: Luiz Capitulino --- blockdev.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/blockdev.c b/blockdev.c index 7d579d6..470be71 100644 --- a/blockdev.c +++ b/blockdev.c @@ -240,14 +240,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) int ret; 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 +265,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) { -- 1.7.6.49.g033c2