|
|
0a122b |
From 79d38d6ea2208ef31fe39eb7d5993e5eefd36eee Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
0a122b |
Date: Thu, 23 Jan 2014 14:03:37 +0100
|
|
|
0a122b |
Subject: [PATCH 10/14] virtio-scsi: switch exit callback to VirtioDeviceClass
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
0a122b |
Message-id: <1390485820-7585-8-git-send-email-armbru@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56931
|
|
|
0a122b |
O-Subject: [PATCH 7.0 qemu-kvm 07/10] virtio-scsi: switch exit callback to VirtioDeviceClass
|
|
|
0a122b |
Bugzilla: 983344
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
This ensures hot-unplug is handled properly by the proxy, and avoids
|
|
|
0a122b |
leaking bus_name which is freed by virtio_device_exit.
|
|
|
0a122b |
|
|
|
0a122b |
Cc: qemu-stable@nongnu.org
|
|
|
0a122b |
Acked-by: Andreas Faerber <afaerber@suse.de>
|
|
|
0a122b |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
(cherry picked from commit e3c9d76acc984218264bbc6435b0c09f959ed9b8)
|
|
|
0a122b |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/scsi/vhost-scsi.c | 11 +++++------
|
|
|
0a122b |
hw/scsi/virtio-scsi.c | 15 +++++++--------
|
|
|
0a122b |
include/hw/virtio/virtio-scsi.h | 2 +-
|
|
|
0a122b |
3 files changed, 13 insertions(+), 15 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/scsi/vhost-scsi.c | 11 +++++------
|
|
|
0a122b |
hw/scsi/virtio-scsi.c | 15 +++++++--------
|
|
|
0a122b |
include/hw/virtio/virtio-scsi.h | 2 +-
|
|
|
0a122b |
3 files changed, 13 insertions(+), 15 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
|
|
|
0a122b |
index 9e770fb..5e3cc61 100644
|
|
|
0a122b |
--- a/hw/scsi/vhost-scsi.c
|
|
|
0a122b |
+++ b/hw/scsi/vhost-scsi.c
|
|
|
0a122b |
@@ -240,11 +240,10 @@ static int vhost_scsi_init(VirtIODevice *vdev)
|
|
|
0a122b |
return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static int vhost_scsi_exit(DeviceState *qdev)
|
|
|
0a122b |
+static void vhost_scsi_exit(VirtIODevice *vdev)
|
|
|
0a122b |
{
|
|
|
0a122b |
- VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
|
|
|
0a122b |
- VHostSCSI *s = VHOST_SCSI(qdev);
|
|
|
0a122b |
- VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev);
|
|
|
0a122b |
+ VHostSCSI *s = VHOST_SCSI(vdev);
|
|
|
0a122b |
+ VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
|
|
|
0a122b |
|
|
|
0a122b |
migrate_del_blocker(s->migration_blocker);
|
|
|
0a122b |
error_free(s->migration_blocker);
|
|
|
0a122b |
@@ -253,7 +252,7 @@ static int vhost_scsi_exit(DeviceState *qdev)
|
|
|
0a122b |
vhost_scsi_set_status(vdev, 0);
|
|
|
0a122b |
|
|
|
0a122b |
g_free(s->dev.vqs);
|
|
|
0a122b |
- return virtio_scsi_common_exit(vs);
|
|
|
0a122b |
+ virtio_scsi_common_exit(vs);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static Property vhost_scsi_properties[] = {
|
|
|
0a122b |
@@ -265,10 +264,10 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
|
|
|
0a122b |
{
|
|
|
0a122b |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
0a122b |
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
|
|
0a122b |
- dc->exit = vhost_scsi_exit;
|
|
|
0a122b |
dc->props = vhost_scsi_properties;
|
|
|
0a122b |
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
|
|
0a122b |
vdc->init = vhost_scsi_init;
|
|
|
0a122b |
+ vdc->exit = vhost_scsi_exit;
|
|
|
0a122b |
vdc->get_features = vhost_scsi_get_features;
|
|
|
0a122b |
vdc->set_config = vhost_scsi_set_config;
|
|
|
0a122b |
vdc->set_status = vhost_scsi_set_status;
|
|
|
0a122b |
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
|
|
|
0a122b |
index 038cd83..57541b4 100644
|
|
|
0a122b |
--- a/hw/scsi/virtio-scsi.c
|
|
|
0a122b |
+++ b/hw/scsi/virtio-scsi.c
|
|
|
0a122b |
@@ -636,22 +636,21 @@ static int virtio_scsi_device_init(VirtIODevice *vdev)
|
|
|
0a122b |
return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-int virtio_scsi_common_exit(VirtIOSCSICommon *vs)
|
|
|
0a122b |
+void virtio_scsi_common_exit(VirtIOSCSICommon *vs)
|
|
|
0a122b |
{
|
|
|
0a122b |
VirtIODevice *vdev = VIRTIO_DEVICE(vs);
|
|
|
0a122b |
|
|
|
0a122b |
g_free(vs->cmd_vqs);
|
|
|
0a122b |
virtio_cleanup(vdev);
|
|
|
0a122b |
- return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static int virtio_scsi_device_exit(DeviceState *qdev)
|
|
|
0a122b |
+static void virtio_scsi_device_exit(VirtIODevice *vdev)
|
|
|
0a122b |
{
|
|
|
0a122b |
- VirtIOSCSI *s = VIRTIO_SCSI(qdev);
|
|
|
0a122b |
- VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev);
|
|
|
0a122b |
+ VirtIOSCSI *s = VIRTIO_SCSI(vdev);
|
|
|
0a122b |
+ VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
|
|
|
0a122b |
|
|
|
0a122b |
- unregister_savevm(qdev, "virtio-scsi", s);
|
|
|
0a122b |
- return virtio_scsi_common_exit(vs);
|
|
|
0a122b |
+ unregister_savevm(DEVICE(vdev), "virtio-scsi", s);
|
|
|
0a122b |
+ virtio_scsi_common_exit(vs);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static Property virtio_scsi_properties[] = {
|
|
|
0a122b |
@@ -672,10 +671,10 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
|
|
|
0a122b |
{
|
|
|
0a122b |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
0a122b |
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
|
|
0a122b |
- dc->exit = virtio_scsi_device_exit;
|
|
|
0a122b |
dc->props = virtio_scsi_properties;
|
|
|
0a122b |
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
|
|
0a122b |
vdc->init = virtio_scsi_device_init;
|
|
|
0a122b |
+ vdc->exit = virtio_scsi_device_exit;
|
|
|
0a122b |
vdc->set_config = virtio_scsi_set_config;
|
|
|
0a122b |
vdc->get_features = virtio_scsi_get_features;
|
|
|
0a122b |
vdc->reset = virtio_scsi_reset;
|
|
|
0a122b |
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
|
|
|
0a122b |
index 9a98540..206c61d 100644
|
|
|
0a122b |
--- a/include/hw/virtio/virtio-scsi.h
|
|
|
0a122b |
+++ b/include/hw/virtio/virtio-scsi.h
|
|
|
0a122b |
@@ -187,6 +187,6 @@ typedef struct {
|
|
|
0a122b |
VIRTIO_SCSI_F_CHANGE, true)
|
|
|
0a122b |
|
|
|
0a122b |
int virtio_scsi_common_init(VirtIOSCSICommon *vs);
|
|
|
0a122b |
-int virtio_scsi_common_exit(VirtIOSCSICommon *vs);
|
|
|
0a122b |
+void virtio_scsi_common_exit(VirtIOSCSICommon *vs);
|
|
|
0a122b |
|
|
|
0a122b |
#endif /* _QEMU_VIRTIO_SCSI_H */
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|