ia64/xen-unstable

changeset 17883:52592af0204a

ioemu: Fix usbdevice parameter to encode vbd type.

usbdevice = "disk:<filename>"
expect a raw device (as this probably is the most usual case) and
usbdevice = "disk-qcow:<filename>"
expect a COW image (autodetected, probably qcow2).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 18 11:55:34 2008 +0100 (2008-06-18)
parents 666f5196f0fc
children b55f6d42668d
files tools/ioemu/hw/usb-msd.c tools/ioemu/hw/usb.h tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/hw/usb-msd.c	Wed Jun 18 09:46:36 2008 +0100
     1.2 +++ b/tools/ioemu/hw/usb-msd.c	Wed Jun 18 11:55:34 2008 +0100
     1.3 @@ -510,7 +510,7 @@ static void usb_msd_handle_destroy(USBDe
     1.4      qemu_free(s);
     1.5  }
     1.6  
     1.7 -USBDevice *usb_msd_init(const char *filename)
     1.8 +USBDevice *usb_msd_init(const char *filename, BlockDriver *drv)
     1.9  {
    1.10      MSDState *s;
    1.11      BlockDriverState *bdrv;
    1.12 @@ -520,7 +520,7 @@ USBDevice *usb_msd_init(const char *file
    1.13          return NULL;
    1.14  
    1.15      bdrv = bdrv_new("usb");
    1.16 -    if (bdrv_open(bdrv, filename, 0) < 0)
    1.17 +    if (bdrv_open2(bdrv, filename, 0, drv) < 0)
    1.18          goto fail;
    1.19      s->bs = bdrv;
    1.20  
     2.1 --- a/tools/ioemu/hw/usb.h	Wed Jun 18 09:46:36 2008 +0100
     2.2 +++ b/tools/ioemu/hw/usb.h	Wed Jun 18 11:55:34 2008 +0100
     2.3 @@ -217,7 +217,7 @@ USBDevice *usb_mouse_init(void);
     2.4  USBDevice *usb_tablet_init(void);
     2.5  
     2.6  /* usb-msd.c */
     2.7 -USBDevice *usb_msd_init(const char *filename);
     2.8 +USBDevice *usb_msd_init(const char *filename, BlockDriver *drv);
     2.9  
    2.10  /* usb.c */
    2.11  void generic_usb_save(QEMUFile* f, void *opaque);
     3.1 --- a/tools/ioemu/vl.c	Wed Jun 18 09:46:36 2008 +0100
     3.2 +++ b/tools/ioemu/vl.c	Wed Jun 18 11:55:34 2008 +0100
     3.3 @@ -4265,7 +4265,9 @@ static int usb_device_add(const char *de
     3.4      } else if (!strcmp(devname, "tablet")) {
     3.5  	dev = usb_tablet_init();
     3.6      } else if (strstart(devname, "disk:", &p)) {
     3.7 -        dev = usb_msd_init(p);
     3.8 +        dev = usb_msd_init(p, &bdrv_raw);
     3.9 +    } else if (strstart(devname, "disk-qcow:", &p)) {
    3.10 +        dev = usb_msd_init(p, 0);
    3.11      } else {
    3.12          return -1;
    3.13      }