aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-msd.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-19 18:06:15 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-19 18:06:15 +0000
commit059809e45160fda714edf645902db95e262886e9 (patch)
tree06c7c0c578bbbf43e8c8d843c61a63dec484dd4e /hw/usb-msd.c
parent3b2ccc57c74a3a7405dabd36f7abacd3eff46b46 (diff)
usb destroy API change (Lonnie Mendez)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2066 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r--hw/usb-msd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 3dccfb9555..ff2047d4b2 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -112,16 +112,12 @@ static void usb_msd_command_complete(void *opaque, uint32_t tag, int fail)
s->mode = USB_MSDM_CSW;
}
-static void usb_msd_handle_reset(USBDevice *dev, int destroy)
+static void usb_msd_handle_reset(USBDevice *dev)
{
MSDState *s = (MSDState *)dev;
DPRINTF("Reset\n");
s->mode = USB_MSDM_CBW;
- if (destroy) {
- scsi_disk_destroy(s->scsi_dev);
- qemu_free(s);
- }
}
static int usb_msd_handle_control(USBDevice *dev, int request, int value,
@@ -369,6 +365,13 @@ static int usb_msd_handle_data(USBDevice *dev, int pid, uint8_t devep,
return ret;
}
+static void usb_msd_handle_destroy(USBDevice *dev)
+{
+ MSDState *s = (MSDState *)dev;
+
+ scsi_disk_destroy(s->scsi_dev);
+ qemu_free(s);
+}
USBDevice *usb_msd_init(const char *filename)
{
@@ -388,11 +391,12 @@ USBDevice *usb_msd_init(const char *filename)
s->dev.handle_reset = usb_msd_handle_reset;
s->dev.handle_control = usb_msd_handle_control;
s->dev.handle_data = usb_msd_handle_data;
+ s->dev.handle_destroy = usb_msd_handle_destroy;
snprintf(s->dev.devname, sizeof(s->dev.devname), "QEMU USB MSD(%.16s)",
filename);
s->scsi_dev = scsi_disk_init(bdrv, usb_msd_command_complete, s);
- usb_msd_handle_reset((USBDevice *)s, 0);
+ usb_msd_handle_reset((USBDevice *)s);
return (USBDevice *)s;
}