mirror of https://github.com/xemu-project/xemu.git
virtio-serial: Wrap in vmstate
Forcibly convert it to a vmstate wrapper; proper conversion comes later. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
290c242845
commit
42e6c0390b
|
@ -594,12 +594,6 @@ static void vser_reset(VirtIODevice *vdev)
|
||||||
guest_reset(vser);
|
guest_reset(vser);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_serial_save(QEMUFile *f, void *opaque)
|
|
||||||
{
|
|
||||||
/* The virtio device */
|
|
||||||
virtio_save(VIRTIO_DEVICE(opaque), f);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
|
static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
|
||||||
{
|
{
|
||||||
VirtIOSerial *s = VIRTIO_SERIAL(vdev);
|
VirtIOSerial *s = VIRTIO_SERIAL(vdev);
|
||||||
|
@ -734,14 +728,10 @@ static int fetch_active_ports_list(QEMUFile *f,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
|
static int virtio_serial_load(QEMUFile *f, void *opaque, size_t size)
|
||||||
{
|
{
|
||||||
if (version_id != 3) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The virtio device */
|
/* The virtio device */
|
||||||
return virtio_load(VIRTIO_DEVICE(opaque), f, version_id);
|
return virtio_load(VIRTIO_DEVICE(opaque), f, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_serial_load_device(VirtIODevice *vdev, QEMUFile *f,
|
static int virtio_serial_load_device(VirtIODevice *vdev, QEMUFile *f,
|
||||||
|
@ -1042,13 +1032,6 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
vser->post_load = NULL;
|
vser->post_load = NULL;
|
||||||
|
|
||||||
/*
|
|
||||||
* Register for the savevm section with the virtio-console name
|
|
||||||
* to preserve backward compat
|
|
||||||
*/
|
|
||||||
register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
|
|
||||||
virtio_serial_load, vser);
|
|
||||||
|
|
||||||
QLIST_INSERT_HEAD(&vserdevices.devices, vser, next);
|
QLIST_INSERT_HEAD(&vserdevices.devices, vser, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,8 +1062,6 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
QLIST_REMOVE(vser, next);
|
QLIST_REMOVE(vser, next);
|
||||||
|
|
||||||
unregister_savevm(dev, "virtio-console", vser);
|
|
||||||
|
|
||||||
g_free(vser->ivqs);
|
g_free(vser->ivqs);
|
||||||
g_free(vser->ovqs);
|
g_free(vser->ovqs);
|
||||||
g_free(vser->ports_map);
|
g_free(vser->ports_map);
|
||||||
|
@ -1093,6 +1074,9 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
virtio_cleanup(vdev);
|
virtio_cleanup(vdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: 'console' is used for backwards compatibility */
|
||||||
|
VMSTATE_VIRTIO_DEVICE(console, 3, virtio_serial_load, virtio_vmstate_save);
|
||||||
|
|
||||||
static Property virtio_serial_properties[] = {
|
static Property virtio_serial_properties[] = {
|
||||||
DEFINE_PROP_UINT32("max_ports", VirtIOSerial, serial.max_virtserial_ports,
|
DEFINE_PROP_UINT32("max_ports", VirtIOSerial, serial.max_virtserial_ports,
|
||||||
31),
|
31),
|
||||||
|
@ -1108,6 +1092,7 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data)
|
||||||
QLIST_INIT(&vserdevices.devices);
|
QLIST_INIT(&vserdevices.devices);
|
||||||
|
|
||||||
dc->props = virtio_serial_properties;
|
dc->props = virtio_serial_properties;
|
||||||
|
dc->vmsd = &vmstate_virtio_console;
|
||||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||||
vdc->realize = virtio_serial_device_realize;
|
vdc->realize = virtio_serial_device_realize;
|
||||||
vdc->unrealize = virtio_serial_device_unrealize;
|
vdc->unrealize = virtio_serial_device_unrealize;
|
||||||
|
|
Loading…
Reference in New Issue