diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-09-25 12:29:12 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-09-27 11:35:59 +0100 |
commit | 44b1ff319c4781c7ab13f7e119b3114a1e6a52e2 (patch) | |
tree | b8e8aa9c74c890808876e7a5969b69ac25c1930a /hw/net/virtio-net.c | |
parent | 9ac78b6171bec47083a9b6ce88dc1f114caea2f9 (diff) |
migration: pre_save return int
Modify the pre_save method on VMStateDescription to return an int
rather than void so that it potentially can fail.
Changed zillions of devices to make them return 0; the only
case I've made it return non-0 is hw/intc/s390_flic_kvm.c that already
had an error_report/return case.
Note: If you add an error exit in your pre_save you must emit
an error_report to say why.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170925112917.21340-2-dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r-- | hw/net/virtio-net.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 148071a396..150fd0748e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1712,7 +1712,7 @@ struct VirtIONetMigTmp { * pointer and count and also validate the count. */ -static void virtio_net_tx_waiting_pre_save(void *opaque) +static int virtio_net_tx_waiting_pre_save(void *opaque) { struct VirtIONetMigTmp *tmp = opaque; @@ -1721,6 +1721,8 @@ static void virtio_net_tx_waiting_pre_save(void *opaque) if (tmp->parent->curr_queues == 0) { tmp->curr_queues_1 = 0; } + + return 0; } static int virtio_net_tx_waiting_pre_load(void *opaque) @@ -1768,11 +1770,13 @@ static int virtio_net_ufo_post_load(void *opaque, int version_id) return 0; } -static void virtio_net_ufo_pre_save(void *opaque) +static int virtio_net_ufo_pre_save(void *opaque) { struct VirtIONetMigTmp *tmp = opaque; tmp->has_ufo = tmp->parent->has_ufo; + + return 0; } static const VMStateDescription vmstate_virtio_net_has_ufo = { @@ -1800,11 +1804,13 @@ static int virtio_net_vnet_post_load(void *opaque, int version_id) return 0; } -static void virtio_net_vnet_pre_save(void *opaque) +static int virtio_net_vnet_pre_save(void *opaque) { struct VirtIONetMigTmp *tmp = opaque; tmp->has_vnet_hdr = tmp->parent->has_vnet_hdr; + + return 0; } static const VMStateDescription vmstate_virtio_net_has_vnet = { @@ -2079,13 +2085,15 @@ static void virtio_net_instance_init(Object *obj) DEVICE(n), NULL); } -static void virtio_net_pre_save(void *opaque) +static int virtio_net_pre_save(void *opaque) { VirtIONet *n = opaque; /* At this point, backend must be stopped, otherwise * it might keep writing to memory. */ assert(!n->vhost_started); + + return 0; } static const VMStateDescription vmstate_virtio_net = { |