From 059809e45160fda714edf645902db95e262886e9 Mon Sep 17 00:00:00 2001 From: bellard Date: Wed, 19 Jul 2006 18:06:15 +0000 Subject: usb destroy API change (Lonnie Mendez) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2066 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/usb-msd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'hw/usb-msd.c') 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; } -- cgit v1.2.3