aboutsummaryrefslogtreecommitdiff
path: root/hw/net
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2017-09-25 12:29:12 +0100
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-09-27 11:35:59 +0100
commit44b1ff319c4781c7ab13f7e119b3114a1e6a52e2 (patch)
treeb8e8aa9c74c890808876e7a5969b69ac25c1930a /hw/net
parent9ac78b6171bec47083a9b6ce88dc1f114caea2f9 (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')
-rw-r--r--hw/net/e1000.c4
-rw-r--r--hw/net/e1000e.c4
-rw-r--r--hw/net/rtl8139.c4
-rw-r--r--hw/net/virtio-net.c16
-rw-r--r--hw/net/vmxnet3.c4
5 files changed, 24 insertions, 8 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index eebe3a9c13..cae95185a5 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1343,7 +1343,7 @@ static bool is_version_1(void *opaque, int version_id)
return version_id == 1;
}
-static void e1000_pre_save(void *opaque)
+static int e1000_pre_save(void *opaque)
{
E1000State *s = opaque;
NetClientState *nc = qemu_get_queue(s->nic);
@@ -1361,6 +1361,8 @@ static void e1000_pre_save(void *opaque)
if (nc->link_down && have_autoneg(s)) {
s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
}
+
+ return 0;
}
static int e1000_post_load(void *opaque, int version_id)
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index 6c42b4478c..744f0f3b91 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -523,13 +523,15 @@ static void e1000e_qdev_reset(DeviceState *dev)
e1000e_core_reset(&s->core);
}
-static void e1000e_pre_save(void *opaque)
+static int e1000e_pre_save(void *opaque)
{
E1000EState *s = opaque;
trace_e1000e_cb_pre_save();
e1000e_core_pre_save(&s->core);
+
+ return 0;
}
static int e1000e_post_load(void *opaque, int version_id)
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 3be24bbee7..d6c8188ae1 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -3162,7 +3162,7 @@ static const VMStateDescription vmstate_rtl8139_hotplug_ready ={
}
};
-static void rtl8139_pre_save(void *opaque)
+static int rtl8139_pre_save(void *opaque)
{
RTL8139State* s = opaque;
int64_t current_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
@@ -3170,6 +3170,8 @@ static void rtl8139_pre_save(void *opaque)
/* for migration to older versions */
s->TCTR = (current_time - s->TCTR_base) / PCI_PERIOD;
s->rtl8139_mmio_io_addr_dummy = 0;
+
+ return 0;
}
static const VMStateDescription vmstate_rtl8139 = {
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 = {
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index a19a7a31dd..b43b58be2b 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2388,11 +2388,13 @@ static int vmxnet3_mcast_list_pre_load(void *opaque)
}
-static void vmxnet3_pre_save(void *opaque)
+static int vmxnet3_pre_save(void *opaque)
{
VMXNET3State *s = opaque;
s->mcast_list_buff_size = s->mcast_list_len * sizeof(MACAddr);
+
+ return 0;
}
static const VMStateDescription vmxstate_vmxnet3_mcast_list = {