[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/12] virtio-net: convert to VIRTIO_DEF_DEVICE_VMSD
From: |
Halil Pasic |
Subject: |
[Qemu-devel] [PATCH 03/12] virtio-net: convert to VIRTIO_DEF_DEVICE_VMSD |
Date: |
Fri, 30 Sep 2016 16:19:54 +0200 |
Refactor so the previously introduced VIRTIO_DEF_DEVICE_VMSD
replaces VMSTATE_VIRTIO_DEVICE.
Signed-off-by: Halil Pasic <address@hidden>
---
hw/net/virtio-net.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 6b8ae2c..101c006 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1498,17 +1498,6 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int
multiqueue)
virtio_net_set_queues(n);
}
-static void virtio_net_save(QEMUFile *f, void *opaque, size_t size)
-{
- VirtIONet *n = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(n);
-
- /* At this point, backend must be stopped, otherwise
- * it might keep writing to memory. */
- assert(!n->vhost_started);
- virtio_save(vdev, f);
-}
-
static void virtio_net_save_device(VirtIODevice *vdev, QEMUFile *f)
{
VirtIONet *n = VIRTIO_NET(vdev);
@@ -1544,14 +1533,6 @@ static void virtio_net_save_device(VirtIODevice *vdev,
QEMUFile *f)
}
}
-static int virtio_net_load(QEMUFile *f, void *opaque, size_t size)
-{
- VirtIONet *n = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(n);
-
- return virtio_load(vdev, f, VIRTIO_NET_VM_VERSION);
-}
-
static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f,
int version_id)
{
@@ -1854,8 +1835,17 @@ static void virtio_net_instance_init(Object *obj)
DEVICE(n), NULL);
}
-VMSTATE_VIRTIO_DEVICE(net, VIRTIO_NET_VM_VERSION, virtio_net_load,
- virtio_net_save);
+static void virtio_net_pre_save(void *opaque)
+{
+ VirtIONet *n = opaque;
+
+ /* At this point, backend must be stopped, otherwise
+ * it might keep writing to memory. */
+ assert(!n->vhost_started);
+}
+
+VIRTIO_DEF_DEVICE_VMSD(net, VIRTIO_NET_VM_VERSION,
+ .pre_save = virtio_net_pre_save)
static Property virtio_net_properties[] = {
DEFINE_PROP_BIT("csum", VirtIONet, host_features, VIRTIO_NET_F_CSUM, true),
--
2.8.4
- [Qemu-devel] [PATCH 00/11] virtio migration: simplify vmstate helper, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 01/12] virtio: add VIRTIO_DEF_DEVICE_VMSD macro, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 05/12] virtio-serial: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 03/12] virtio-net: convert to VIRTIO_DEF_DEVICE_VMSD,
Halil Pasic <=
- [Qemu-devel] [PATCH 02/12] virtio-blk: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 07/12] virtio-input: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 12/12] virtio: remove unused VMSTATE_VIRTIO_DEVICE, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 10/12] virtio-rng: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 11/12] vhost-vsock: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 04/12] virtio-9p: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 06/12] virtio-gpu: do not use VMSTATE_VIRTIO_DEVICE, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 08/12] virtio-scsi: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- [Qemu-devel] [PATCH 09/12] virtio-balloon: convert to VIRTIO_DEF_DEVICE_VMSD, Halil Pasic, 2016/09/30
- Re: [Qemu-devel] [PATCH 00/11] virtio migration: simplify vmstate helper, Paolo Bonzini, 2016/09/30