mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
virtio: introduce qemu_get/put_virtqueue_element
Move allocation to virtio functions also when loading/saving a VirtQueueElement. This will also let the load/save functions keep backwards compatibility when the VirtQueueElement layout is changed. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
51b19ebe43
commit
ab281c1781
5 changed files with 23 additions and 19 deletions
|
@ -646,9 +646,7 @@ static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
|
|||
if (elem_popped) {
|
||||
qemu_put_be32s(f, &port->iov_idx);
|
||||
qemu_put_be64s(f, &port->iov_offset);
|
||||
|
||||
qemu_put_buffer(f, (unsigned char *)port->elem,
|
||||
sizeof(VirtQueueElement));
|
||||
qemu_put_virtqueue_element(f, port->elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -723,10 +721,8 @@ static int fetch_active_ports_list(QEMUFile *f, int version_id,
|
|||
qemu_get_be32s(f, &port->iov_idx);
|
||||
qemu_get_be64s(f, &port->iov_offset);
|
||||
|
||||
port->elem = g_new(VirtQueueElement, 1);
|
||||
qemu_get_buffer(f, (unsigned char *)port->elem,
|
||||
sizeof(VirtQueueElement));
|
||||
virtqueue_map(port->elem);
|
||||
port->elem =
|
||||
qemu_get_virtqueue_element(f, sizeof(VirtQueueElement));
|
||||
|
||||
/*
|
||||
* Port was throttled on source machine. Let's
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue