diff options
author | Jianjun Duan <duanj@linux.vnet.ibm.com> | 2017-01-19 11:00:50 -0800 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-01-24 17:54:47 +0000 |
commit | 2c21ee769e4674348560480cecc7b20f3750ee84 (patch) | |
tree | 250ee21fc200f8901ee437569e153e952e6c1342 /hw/virtio | |
parent | d7fc72ceb52ad77f5f29befc04d5215096b8caa8 (diff) |
migration: extend VMStateInfo
Current migration code cannot handle some data structures such as
QTAILQ in qemu/queue.h. Here we extend the signatures of put/get
in VMStateInfo so that customized handling is supported. put now
will return int type.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>
Message-Id: <1484852453-12728-2-git-send-email-duanj@linux.vnet.ibm.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r-- | hw/virtio/virtio-pci.c | 8 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 15 |
2 files changed, 17 insertions, 6 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 09230c05df..b5af2a00f3 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -108,7 +108,8 @@ static bool virtio_pci_has_extra_state(DeviceState *d) return proxy->flags & VIRTIO_PCI_FLAG_MIGRATE_EXTRA; } -static int get_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size) +static int get_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size, + VMStateField *field) { VirtIOPCIProxy *proxy = pv; int i; @@ -137,7 +138,8 @@ static void virtio_pci_save_modern_queue_state(VirtIOPCIQueue *vq, qemu_put_be32(f, vq->used[1]); } -static void put_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size) +static int put_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) { VirtIOPCIProxy *proxy = pv; int i; @@ -149,6 +151,8 @@ static void put_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size) for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { virtio_pci_save_modern_queue_state(&proxy->vqs[i], f); } + + return 0; } static const VMStateInfo vmstate_info_virtio_pci_modern_state = { diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index cc17b97899..f292a53940 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1555,7 +1555,8 @@ static const VMStateDescription vmstate_virtio_ringsize = { } }; -static int get_extra_state(QEMUFile *f, void *pv, size_t size) +static int get_extra_state(QEMUFile *f, void *pv, size_t size, + VMStateField *field) { VirtIODevice *vdev = pv; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); @@ -1568,13 +1569,15 @@ static int get_extra_state(QEMUFile *f, void *pv, size_t size) } } -static void put_extra_state(QEMUFile *f, void *pv, size_t size) +static int put_extra_state(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) { VirtIODevice *vdev = pv; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); k->save_extra_state(qbus->parent, f); + return 0; } static const VMStateInfo vmstate_info_extra_state = { @@ -1709,13 +1712,17 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) } /* A wrapper for use as a VMState .put function */ -static void virtio_device_put(QEMUFile *f, void *opaque, size_t size) +static int virtio_device_put(QEMUFile *f, void *opaque, size_t size, + VMStateField *field, QJSON *vmdesc) { virtio_save(VIRTIO_DEVICE(opaque), f); + + return 0; } /* A wrapper for use as a VMState .get function */ -static int virtio_device_get(QEMUFile *f, void *opaque, size_t size) +static int virtio_device_get(QEMUFile *f, void *opaque, size_t size, + VMStateField *field) { VirtIODevice *vdev = VIRTIO_DEVICE(opaque); DeviceClass *dc = DEVICE_CLASS(VIRTIO_DEVICE_GET_CLASS(vdev)); |