aboutsummaryrefslogtreecommitdiff
path: root/hw/block/virtio-blk.c
diff options
context:
space:
mode:
authorHalil Pasic <pasic@linux.vnet.ibm.com>2016-10-06 14:55:40 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-10-10 02:21:42 +0300
commit977a117f78f3abcad8ea925f6c8282f2b3386f53 (patch)
tree99ae24d17cbb458152961fe67cfdb645b0267526 /hw/block/virtio-blk.c
parent1a665855d7144bb3df382630a2b5e4039e95e466 (diff)
virtio-blk: convert VMSTATE_VIRTIO_DEVICE
Use the new VMSTATE_VIRTIO_DEVICE macro. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/block/virtio-blk.c')
-rw-r--r--hw/block/virtio-blk.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 0ddd7fbbe5..10c5794063 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -11,6 +11,8 @@
*
*/
+#define VMSTATE_VIRTIO_DEVICE_USE_NEW
+
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
@@ -822,13 +824,6 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
}
}
-static void virtio_blk_save(QEMUFile *f, void *opaque, size_t size)
-{
- VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
-
- virtio_save(vdev, f);
-}
-
static void virtio_blk_save_device(VirtIODevice *vdev, QEMUFile *f)
{
VirtIOBlock *s = VIRTIO_BLK(vdev);
@@ -847,14 +842,6 @@ static void virtio_blk_save_device(VirtIODevice *vdev, QEMUFile *f)
qemu_put_sbyte(f, 0);
}
-static int virtio_blk_load(QEMUFile *f, void *opaque, size_t size)
-{
- VirtIOBlock *s = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(s);
-
- return virtio_load(vdev, f, 2);
-}
-
static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,
int version_id)
{
@@ -975,7 +962,15 @@ static void virtio_blk_instance_init(Object *obj)
DEVICE(obj), NULL);
}
-VMSTATE_VIRTIO_DEVICE(blk, 2, virtio_blk_load, virtio_blk_save);
+static const VMStateDescription vmstate_virtio_blk = {
+ .name = "virtio-blk",
+ .minimum_version_id = 2,
+ .version_id = 2,
+ .fields = (VMStateField[]) {
+ VMSTATE_VIRTIO_DEVICE,
+ VMSTATE_END_OF_LIST()
+ },
+};
static Property virtio_blk_properties[] = {
DEFINE_BLOCK_PROPERTIES(VirtIOBlock, conf.conf),