mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
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>
This commit is contained in:
parent
d7fc72ceb5
commit
2c21ee769e
22 changed files with 262 additions and 105 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue