diff options
author | Markus Armbruster <armbru@redhat.com> | 2012-07-11 15:08:37 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-07-17 16:48:32 +0200 |
commit | 911525dba9ecc21f97b05c0f09bf9319a9de3a7d (patch) | |
tree | 5d82736bd710e29d590d841bd2636d4247085eff /hw/usb/dev-storage.c | |
parent | 31e404f4ffb6adadea0b35de08e0a6b640e81a02 (diff) |
hw/block-common: Factor out fall back to legacy -drive serial=...
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/usb/dev-storage.c')
-rw-r--r-- | hw/usb/dev-storage.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 251e7de1cd..7fa8b83d2e 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -532,13 +532,14 @@ static int usb_msd_initfn(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); BlockDriverState *bs = s->conf.bs; - DriveInfo *dinfo; if (!bs) { error_report("drive property not set"); return -1; } + blkconf_serial(&s->conf, &s->serial); + /* * Hack alert: this pretends to be a block device, but it's really * a SCSI bus that can serve only a single device, which it @@ -551,13 +552,6 @@ static int usb_msd_initfn(USBDevice *dev) bdrv_detach_dev(bs, &s->dev.qdev); s->conf.bs = NULL; - if (!s->serial) { - /* try to fall back to value set with legacy -drive serial=... */ - dinfo = drive_get_by_blockdev(bs); - if (*dinfo->serial) { - s->serial = strdup(dinfo->serial); - } - } if (s->serial) { usb_desc_set_string(dev, STR_SERIALNUMBER, s->serial); } else { |