Blame 0011-virtio-scsi-switch-exit-callback-to-VirtioDeviceClas.patch

45bdef
From 78ad270fe43666fb11ba1352f591a7f217dd87b7 Mon Sep 17 00:00:00 2001
298366
From: Paolo Bonzini <pbonzini@redhat.com>
298366
Date: Fri, 20 Sep 2013 16:57:57 +0200
298366
Subject: [PATCH] virtio-scsi: switch exit callback to VirtioDeviceClass
298366
298366
This ensures hot-unplug is handled properly by the proxy.
298366
298366
Cc: qemu-stable@nongnu.org
298366
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
298366
---
298366
 hw/scsi/vhost-scsi.c            | 11 +++++------
298366
 hw/scsi/virtio-scsi.c           | 15 +++++++--------
298366
 include/hw/virtio/virtio-scsi.h |  2 +-
298366
 3 files changed, 13 insertions(+), 15 deletions(-)
298366
298366
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
298366
index 9e770fb..5e3cc61 100644
298366
--- a/hw/scsi/vhost-scsi.c
298366
+++ b/hw/scsi/vhost-scsi.c
298366
@@ -240,11 +240,10 @@ static int vhost_scsi_init(VirtIODevice *vdev)
298366
     return 0;
298366
 }
298366
 
298366
-static int vhost_scsi_exit(DeviceState *qdev)
298366
+static void vhost_scsi_exit(VirtIODevice *vdev)
298366
 {
298366
-    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
298366
-    VHostSCSI *s = VHOST_SCSI(qdev);
298366
-    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev);
298366
+    VHostSCSI *s = VHOST_SCSI(vdev);
298366
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
298366
 
298366
     migrate_del_blocker(s->migration_blocker);
298366
     error_free(s->migration_blocker);
298366
@@ -253,7 +252,7 @@ static int vhost_scsi_exit(DeviceState *qdev)
298366
     vhost_scsi_set_status(vdev, 0);
298366
 
298366
     g_free(s->dev.vqs);
298366
-    return virtio_scsi_common_exit(vs);
298366
+    virtio_scsi_common_exit(vs);
298366
 }
298366
 
298366
 static Property vhost_scsi_properties[] = {
298366
@@ -265,10 +264,10 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
298366
 {
298366
     DeviceClass *dc = DEVICE_CLASS(klass);
298366
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
298366
-    dc->exit = vhost_scsi_exit;
298366
     dc->props = vhost_scsi_properties;
298366
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
298366
     vdc->init = vhost_scsi_init;
298366
+    vdc->exit = vhost_scsi_exit;
298366
     vdc->get_features = vhost_scsi_get_features;
298366
     vdc->set_config = vhost_scsi_set_config;
298366
     vdc->set_status = vhost_scsi_set_status;
298366
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
45bdef
index 26d95a1..83344ea 100644
298366
--- a/hw/scsi/virtio-scsi.c
298366
+++ b/hw/scsi/virtio-scsi.c
45bdef
@@ -644,22 +644,21 @@ static int virtio_scsi_device_init(VirtIODevice *vdev)
298366
     return 0;
298366
 }
298366
 
298366
-int virtio_scsi_common_exit(VirtIOSCSICommon *vs)
298366
+void virtio_scsi_common_exit(VirtIOSCSICommon *vs)
298366
 {
298366
     VirtIODevice *vdev = VIRTIO_DEVICE(vs);
298366
 
298366
     g_free(vs->cmd_vqs);
298366
     virtio_cleanup(vdev);
298366
-    return 0;
298366
 }
298366
 
298366
-static int virtio_scsi_device_exit(DeviceState *qdev)
298366
+static void virtio_scsi_device_exit(VirtIODevice *vdev)
298366
 {
298366
-    VirtIOSCSI *s = VIRTIO_SCSI(qdev);
298366
-    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev);
298366
+    VirtIOSCSI *s = VIRTIO_SCSI(vdev);
298366
+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
298366
 
298366
-    unregister_savevm(qdev, "virtio-scsi", s);
298366
-    return virtio_scsi_common_exit(vs);
298366
+    unregister_savevm(DEVICE(vdev), "virtio-scsi", s);
298366
+    virtio_scsi_common_exit(vs);
298366
 }
298366
 
298366
 static Property virtio_scsi_properties[] = {
45bdef
@@ -680,10 +679,10 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
298366
 {
298366
     DeviceClass *dc = DEVICE_CLASS(klass);
298366
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
298366
-    dc->exit = virtio_scsi_device_exit;
298366
     dc->props = virtio_scsi_properties;
298366
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
298366
     vdc->init = virtio_scsi_device_init;
298366
+    vdc->exit = virtio_scsi_device_exit;
298366
     vdc->set_config = virtio_scsi_set_config;
298366
     vdc->get_features = virtio_scsi_get_features;
298366
     vdc->reset = virtio_scsi_reset;
298366
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
298366
index 9a98540..206c61d 100644
298366
--- a/include/hw/virtio/virtio-scsi.h
298366
+++ b/include/hw/virtio/virtio-scsi.h
298366
@@ -187,6 +187,6 @@ typedef struct {
298366
                                             VIRTIO_SCSI_F_CHANGE, true)
298366
 
298366
 int virtio_scsi_common_init(VirtIOSCSICommon *vs);
298366
-int virtio_scsi_common_exit(VirtIOSCSICommon *vs);
298366
+void virtio_scsi_common_exit(VirtIOSCSICommon *vs);
298366
 
298366
 #endif /* _QEMU_VIRTIO_SCSI_H */