From patchwork Fri Jun 15 13:33:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 165161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5FA25B7092 for ; Sat, 16 Jun 2012 01:42:44 +1000 (EST) Received: from localhost ([::1]:37986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfWgD-0002e4-0O for incoming@patchwork.ozlabs.org; Fri, 15 Jun 2012 09:35:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfWfB-000133-Nv for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfWf5-0004is-FV for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfWf5-0004ia-7N for qemu-devel@nongnu.org; Fri, 15 Jun 2012 09:34:03 -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 q5FDY1tL006928 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Jun 2012 09:34:01 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-6-30.ams2.redhat.com [10.36.6.30]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5FDXep8016743; Fri, 15 Jun 2012 09:34:00 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 15 Jun 2012 15:33:14 +0200 Message-Id: <1339767219-24297-15-git-send-email-kwolf@redhat.com> In-Reply-To: <1339767219-24297-1-git-send-email-kwolf@redhat.com> References: <1339767219-24297-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 14/39] block: Simplify how drive_init() computes default ID 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 From: Markus Armbruster Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/blockdev.c b/blockdev.c index 622ecba..9e0a72a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -278,7 +278,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) { const char *buf; const char *file = NULL; - char devname[128]; const char *serial; const char *mediastr = ""; BlockInterfaceType type; @@ -318,7 +317,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) serial = qemu_opt_get(opts, "serial"); if ((buf = qemu_opt_get(opts, "if")) != NULL) { - pstrcpy(devname, sizeof(devname), buf); for (type = 0; type < IF_COUNT && strcmp(buf, if_name[type]); type++) ; if (type == IF_COUNT) { @@ -327,7 +325,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) } } else { type = default_to_scsi ? IF_SCSI : IF_IDE; - pstrcpy(devname, sizeof(devname), if_name[type]); } max_devs = if_max_devs[type]; @@ -523,10 +520,10 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd"; if (max_devs) snprintf(dinfo->id, 32, "%s%i%s%i", - devname, bus_id, mediastr, unit_id); + if_name[type], bus_id, mediastr, unit_id); else snprintf(dinfo->id, 32, "%s%s%i", - devname, mediastr, unit_id); + if_name[type], mediastr, unit_id); } dinfo->bdrv = bdrv_new(dinfo->id); dinfo->devaddr = devaddr;