Blame SOURCES/kvm-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch

0a122b
From f9630bb1a1267c9d3f8b2d3e70bfa9a05bd0cf07 Mon Sep 17 00:00:00 2001
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Thu, 23 Jan 2014 14:03:34 +0100
0a122b
Subject: [PATCH 07/14] virtio-blk: switch exit callback to VirtioDeviceClass
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1390485820-7585-5-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56922
0a122b
O-Subject: [PATCH 7.0 qemu-kvm 04/10] virtio-blk: 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 40dfc16f5fe0afb66f9436718781264dfadb6c61)
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
---
0a122b
 hw/block/virtio-blk.c | 10 ++++------
0a122b
 1 file changed, 4 insertions(+), 6 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/block/virtio-blk.c |   10 ++++------
0a122b
 1 files changed, 4 insertions(+), 6 deletions(-)
0a122b
0a122b
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
0a122b
index 49a23c3..aa37cc9 100644
0a122b
--- a/hw/block/virtio-blk.c
0a122b
+++ b/hw/block/virtio-blk.c
0a122b
@@ -729,20 +729,18 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
-static int virtio_blk_device_exit(DeviceState *dev)
0a122b
+static void virtio_blk_device_exit(VirtIODevice *vdev)
0a122b
 {
0a122b
-    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
0a122b
-    VirtIOBlock *s = VIRTIO_BLK(dev);
0a122b
+    VirtIOBlock *s = VIRTIO_BLK(vdev);
0a122b
 #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
0a122b
     remove_migration_state_change_notifier(&s->migration_state_notifier);
0a122b
     virtio_blk_data_plane_destroy(s->dataplane);
0a122b
     s->dataplane = NULL;
0a122b
 #endif
0a122b
     qemu_del_vm_change_state_handler(s->change);
0a122b
-    unregister_savevm(dev, "virtio-blk", s);
0a122b
+    unregister_savevm(DEVICE(vdev), "virtio-blk", s);
0a122b
     blockdev_mark_auto_del(s->bs);
0a122b
     virtio_cleanup(vdev);
0a122b
-    return 0;
0a122b
 }
0a122b
 
0a122b
 static Property virtio_blk_properties[] = {
0a122b
@@ -754,10 +752,10 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
0a122b
 {
0a122b
     DeviceClass *dc = DEVICE_CLASS(klass);
0a122b
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
0a122b
-    dc->exit = virtio_blk_device_exit;
0a122b
     dc->props = virtio_blk_properties;
0a122b
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
0a122b
     vdc->init = virtio_blk_device_init;
0a122b
+    vdc->exit = virtio_blk_device_exit;
0a122b
     vdc->get_config = virtio_blk_update_config;
0a122b
     vdc->set_config = virtio_blk_set_config;
0a122b
     vdc->get_features = virtio_blk_get_features;
0a122b
-- 
0a122b
1.7.1
0a122b