aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-disk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:46 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:49 -0500
commit56a14938809331372b6cdb2afcb14d9818de4cbf (patch)
tree256e324375f698356af28158f601b2301a673ba5 /hw/scsi-disk.c
parent3f84865ade594a2ec1ef613ab5fd11949f3d49de (diff)
drive cleanup fixes.
Changes: * drive_uninit() wants a DriveInfo now. * drive_uninit() also calls bdrv_delete(), so callers don't need to do that. * drive_uninit() calls are moved over to the ->exit() callbacks, destroy_bdrvs() is zapped. * setting bdrv->private is not needed any more as the only user (destroy_bdrvs) is gone. * usb-storage needs no drive_uninit, scsi-disk will handle that. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r--hw/scsi-disk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 0f029f897d..3940726f2b 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -936,6 +936,13 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
}
}
+static void scsi_destroy(SCSIDevice *dev)
+{
+ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
+
+ drive_uninit(s->dinfo);
+}
+
static int scsi_disk_initfn(SCSIDevice *dev)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
@@ -969,6 +976,7 @@ static SCSIDeviceInfo scsi_disk_info = {
.qdev.desc = "virtual scsi disk or cdrom",
.qdev.size = sizeof(SCSIDiskState),
.init = scsi_disk_initfn,
+ .destroy = scsi_destroy,
.send_command = scsi_send_command,
.read_data = scsi_read_data,
.write_data = scsi_write_data,