render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0008-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch

bacd9b
From e8821c68009a5b801ffef6d7d9ed5d770c0bfd9f Mon Sep 17 00:00:00 2001
298366
From: Paolo Bonzini <pbonzini@redhat.com>
298366
Date: Fri, 20 Sep 2013 16:57:54 +0200
298366
Subject: [PATCH] virtio-blk: 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/block/virtio-blk.c | 10 ++++------
298366
 1 file changed, 4 insertions(+), 6 deletions(-)
298366
298366
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
45bdef
index 13f6d82..7f0440f 100644
298366
--- a/hw/block/virtio-blk.c
298366
+++ b/hw/block/virtio-blk.c
45bdef
@@ -728,20 +728,18 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
298366
     return 0;
298366
 }
298366
 
298366
-static int virtio_blk_device_exit(DeviceState *dev)
298366
+static void virtio_blk_device_exit(VirtIODevice *vdev)
298366
 {
298366
-    VirtIODevice *vdev = VIRTIO_DEVICE(dev);
298366
-    VirtIOBlock *s = VIRTIO_BLK(dev);
298366
+    VirtIOBlock *s = VIRTIO_BLK(vdev);
298366
 #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
298366
     remove_migration_state_change_notifier(&s->migration_state_notifier);
298366
     virtio_blk_data_plane_destroy(s->dataplane);
298366
     s->dataplane = NULL;
298366
 #endif
298366
     qemu_del_vm_change_state_handler(s->change);
298366
-    unregister_savevm(dev, "virtio-blk", s);
298366
+    unregister_savevm(DEVICE(vdev), "virtio-blk", s);
298366
     blockdev_mark_auto_del(s->bs);
298366
     virtio_cleanup(vdev);
298366
-    return 0;
298366
 }
298366
 
298366
 static Property virtio_blk_properties[] = {
45bdef
@@ -753,10 +751,10 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
298366
 {
298366
     DeviceClass *dc = DEVICE_CLASS(klass);
298366
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
298366
-    dc->exit = virtio_blk_device_exit;
298366
     dc->props = virtio_blk_properties;
298366
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
298366
     vdc->init = virtio_blk_device_init;
298366
+    vdc->exit = virtio_blk_device_exit;
298366
     vdc->get_config = virtio_blk_update_config;
298366
     vdc->set_config = virtio_blk_set_config;
298366
     vdc->get_features = virtio_blk_get_features;