* [Qemu-devel] [PATCH] block: Simplify how drive_init() computes default ID
@ 2012-06-05 12:52 Markus Armbruster
2012-06-05 13:04 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Markus Armbruster @ 2012-06-05 12:52 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-05 13:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-05 12:52 [Qemu-devel] [PATCH] block: Simplify how drive_init() computes default ID Markus Armbruster
2012-06-05 13:04 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).