virtio-scsi: 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
5943124cc0
commit
5a289a2883
|
@ -663,22 +663,17 @@ static void virtio_scsi_reset(VirtIODevice *vdev)
|
|||
/* The device does not have anything to save beyond the virtio data.
|
||||
* Request data is saved with callbacks from SCSI devices.
|
||||
*/
|
||||
static void virtio_scsi_save(QEMUFile *f, void *opaque)
|
||||
static void virtio_scsi_save(QEMUFile *f, void *opaque, size_t size)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
|
||||
virtio_save(vdev, f);
|
||||
}
|
||||
|
||||
static int virtio_scsi_load(QEMUFile *f, void *opaque, int version_id)
|
||||
static int virtio_scsi_load(QEMUFile *f, void *opaque, size_t size)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
|
||||
int ret;
|
||||
|
||||
ret = virtio_load(vdev, f, version_id);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
return virtio_load(vdev, f, 1);
|
||||
}
|
||||
|
||||
void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
||||
|
@ -862,7 +857,6 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VirtIOSCSI *s = VIRTIO_SCSI(dev);
|
||||
static int virtio_scsi_id;
|
||||
Error *err = NULL;
|
||||
|
||||
virtio_scsi_common_realize(dev, &err, virtio_scsi_handle_ctrl,
|
||||
|
@ -885,9 +879,6 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
register_savevm(dev, "virtio-scsi", virtio_scsi_id++, 1,
|
||||
virtio_scsi_save, virtio_scsi_load, s);
|
||||
}
|
||||
|
||||
static void virtio_scsi_instance_init(Object *obj)
|
||||
|
@ -911,9 +902,6 @@ void virtio_scsi_common_unrealize(DeviceState *dev, Error **errp)
|
|||
|
||||
static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtIOSCSI *s = VIRTIO_SCSI(dev);
|
||||
|
||||
unregister_savevm(dev, "virtio-scsi", s);
|
||||
virtio_scsi_common_unrealize(dev, errp);
|
||||
}
|
||||
|
||||
|
@ -930,6 +918,8 @@ static Property virtio_scsi_properties[] = {
|
|||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
VMSTATE_VIRTIO_DEVICE(scsi, 1, virtio_scsi_load, virtio_scsi_save);
|
||||
|
||||
static void virtio_scsi_common_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
|
@ -946,6 +936,7 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
|
|||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
|
||||
dc->props = virtio_scsi_properties;
|
||||
dc->vmsd = &vmstate_virtio_scsi;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
vdc->realize = virtio_scsi_device_realize;
|
||||
vdc->unrealize = virtio_scsi_device_unrealize;
|
||||
|
|
Loading…
Reference in a new issue