From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbtFs-0002gK-Jv for qemu-devel@nongnu.org; Tue, 05 Jun 2012 08:53:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbtFn-0000KC-SL for qemu-devel@nongnu.org; Tue, 05 Jun 2012 08:53:00 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:53674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbtFn-0000K1-MG for qemu-devel@nongnu.org; Tue, 05 Jun 2012 08:52:55 -0400 Received: from blackfin.pond.sub.org (p5B32BDEA.dip.t-dialin.net [91.50.189.234]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 54D91A5A47 for ; Tue, 5 Jun 2012 14:52:54 +0200 (CEST) From: Markus Armbruster Date: Tue, 5 Jun 2012 14:52:53 +0200 Message-Id: <1338900773-6209-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH] block: Simplify how drive_init() computes default ID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com Signed-off-by: Markus Armbruster --- blockdev.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/blockdev.c b/blockdev.c index 67895b2..1cafd70 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; -- 1.7.6.5