{"id":815764,"url":"http://patchwork.ozlabs.org/api/patches/815764/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919180038.26056-2-dgilbert@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170919180038.26056-2-dgilbert@redhat.com>","list_archive_url":null,"date":"2017-09-19T18:00:34","name":"[1/5] migration: pre_save return int","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5f22546874aa952cb83227dcd81e8483c3441968","submitter":{"id":48102,"url":"http://patchwork.ozlabs.org/api/people/48102/?format=json","name":"Dr. David Alan Gilbert","email":"dgilbert@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919180038.26056-2-dgilbert@redhat.com/mbox/","series":[{"id":3942,"url":"http://patchwork.ozlabs.org/api/series/3942/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3942","date":"2017-09-19T18:00:35","name":"migration: let pre_save fail","version":1,"mbox":"http://patchwork.ozlabs.org/series/3942/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815764/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815764/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dgilbert@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxW2Y0R30z9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 04:03:33 +1000 (AEST)","from localhost ([::1]:44652 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duMrr-0007Uf-4C\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 14:03:31 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:36953)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1duMpP-0005se-IK\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:01:04 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1duMpL-0008KI-0J\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:00:59 -0400","from mx1.redhat.com ([209.132.183.28]:60747)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgilbert@redhat.com>) id 1duMpK-0008D0-KQ\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:00:54 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id D48E4128B;\n\tTue, 19 Sep 2017 18:00:51 +0000 (UTC)","from dgilbert-t530.redhat.com (ovpn-117-120.ams2.redhat.com\n\t[10.36.117.120])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id F10DA5D983;\n\tTue, 19 Sep 2017 18:00:49 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com D48E4128B","From":"\"Dr. David Alan Gilbert (git)\" <dgilbert@redhat.com>","To":"qemu-devel@nongnu.org,\n\tquintela@redhat.com,\n\tpeterx@redhat.com","Date":"Tue, 19 Sep 2017 19:00:34 +0100","Message-Id":"<20170919180038.26056-2-dgilbert@redhat.com>","In-Reply-To":"<20170919180038.26056-1-dgilbert@redhat.com>","References":"<20170919180038.26056-1-dgilbert@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tTue, 19 Sep 2017 18:00:52 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH 1/5] migration: pre_save return int","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, cohuck@redhat.com, rth@twiddle.net","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>\n\nModify the pre_save method on VMStateDescription to return an int\nrather than void so that it potentially can fail.\n\nChanged zillions of devices to make them return 0; the only\ncase I've made it return non-0 is hw/intc/s390_flic_kvm.c that already\nhad an error_report/return case.\n\nNote: If you add an error exit in your pre_save you must emit\nan error_report to say why.\n\nSigned-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n docs/devel/migration.txt       |  2 +-\n hw/arm/pxa2xx.c                |  4 +++-\n hw/arm/strongarm.c             |  4 +++-\n hw/audio/wm8750.c              |  4 +++-\n hw/block/fdc.c                 |  4 +++-\n hw/block/m25p80.c              |  4 +++-\n hw/block/nand.c                |  4 +++-\n hw/block/onenand.c             |  4 +++-\n hw/char/serial.c               |  4 +++-\n hw/display/qxl.c               |  4 +++-\n hw/i2c/core.c                  |  4 +++-\n hw/i386/kvm/clock.c            |  4 +++-\n hw/ide/core.c                  |  4 +++-\n hw/ide/pci.c                   |  4 +++-\n hw/input/ps2.c                 |  8 ++++++--\n hw/input/tsc210x.c             |  4 +++-\n hw/intc/apic_common.c          |  4 +++-\n hw/intc/arm_gic_common.c       |  4 +++-\n hw/intc/arm_gicv3_common.c     |  4 +++-\n hw/intc/arm_gicv3_its_common.c |  4 +++-\n hw/intc/i8259_common.c         |  4 +++-\n hw/intc/ioapic_common.c        |  4 +++-\n hw/intc/s390_flic_kvm.c        |  6 ++++--\n hw/intc/xics.c                 |  8 ++++++--\n hw/net/e1000.c                 |  4 +++-\n hw/net/e1000e.c                |  4 +++-\n hw/net/rtl8139.c               |  4 +++-\n hw/net/virtio-net.c            | 16 ++++++++++++----\n hw/net/vmxnet3.c               |  4 +++-\n hw/pci-host/piix.c             |  4 +++-\n hw/ppc/ppc.c                   |  4 +++-\n hw/ppc/spapr_iommu.c           |  4 +++-\n hw/ppc/spapr_pci.c             |  6 ++++--\n hw/s390x/css.c                 | 10 +++++++---\n hw/s390x/virtio-ccw.c          |  4 +++-\n hw/scsi/lsi53c895a.c           |  4 +++-\n hw/scsi/vmw_pvscsi.c           |  4 +++-\n hw/timer/cadence_ttc.c         |  4 +++-\n hw/timer/hpet.c                |  4 +++-\n hw/timer/i8254_common.c        |  4 +++-\n hw/timer/mc146818rtc.c         |  4 +++-\n hw/timer/pl031.c               |  4 +++-\n hw/timer/twl92230.c            |  4 +++-\n hw/usb/dev-smartcard-reader.c  |  4 +++-\n hw/usb/hcd-ehci.c              |  4 +++-\n hw/usb/redirect.c              |  4 +++-\n hw/virtio/vhost-vsock.c        |  4 +++-\n include/migration/vmstate.h    |  2 +-\n migration/colo-comm.c          |  4 +++-\n migration/global_state.c       |  4 +++-\n migration/savevm.c             |  4 +++-\n replay/replay-snapshot.c       |  4 +++-\n slirp/slirp.c                  |  8 ++++++--\n target/arm/machine.c           |  4 +++-\n target/i386/machine.c          |  7 +++++--\n target/ppc/machine.c           |  4 +++-\n target/s390x/machine.c         |  4 +++-\n target/sparc/machine.c         |  4 +++-\n tests/test-vmstate.c           |  4 +++-\n 59 files changed, 199 insertions(+), 70 deletions(-)","diff":"diff --git a/docs/devel/migration.txt b/docs/devel/migration.txt\nindex 1b940a829b..4030703726 100644\n--- a/docs/devel/migration.txt\n+++ b/docs/devel/migration.txt\n@@ -202,7 +202,7 @@ The functions to do that are inside a vmstate definition, and are called:\n \n   This function is called after we load the state of one device.\n \n-- void (*pre_save)(void *opaque);\n+- int (*pre_save)(void *opaque);\n \n   This function is called before we save the state of one device.\n \ndiff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c\nindex b0ac3cfd64..3648f01d05 100644\n--- a/hw/arm/pxa2xx.c\n+++ b/hw/arm/pxa2xx.c\n@@ -1143,13 +1143,15 @@ static void pxa2xx_rtc_init(Object *obj)\n     sysbus_init_mmio(dev, &s->iomem);\n }\n \n-static void pxa2xx_rtc_pre_save(void *opaque)\n+static int pxa2xx_rtc_pre_save(void *opaque)\n {\n     PXA2xxRTCState *s = (PXA2xxRTCState *) opaque;\n \n     pxa2xx_rtc_hzupdate(s);\n     pxa2xx_rtc_piupdate(s);\n     pxa2xx_rtc_swupdate(s);\n+\n+    return 0;\n }\n \n static int pxa2xx_rtc_post_load(void *opaque, int version_id)\ndiff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c\nindex 884242b2dc..37d7e36b35 100644\n--- a/hw/arm/strongarm.c\n+++ b/hw/arm/strongarm.c\n@@ -406,11 +406,13 @@ static void strongarm_rtc_init(Object *obj)\n     sysbus_init_mmio(dev, &s->iomem);\n }\n \n-static void strongarm_rtc_pre_save(void *opaque)\n+static int strongarm_rtc_pre_save(void *opaque)\n {\n     StrongARMRTCState *s = opaque;\n \n     strongarm_rtc_hzupdate(s);\n+\n+    return 0;\n }\n \n static int strongarm_rtc_post_load(void *opaque, int version_id)\ndiff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c\nindex f8b5bebfc2..fff49f8bb5 100644\n--- a/hw/audio/wm8750.c\n+++ b/hw/audio/wm8750.c\n@@ -567,11 +567,13 @@ static int wm8750_rx(I2CSlave *i2c)\n     return 0x00;\n }\n \n-static void wm8750_pre_save(void *opaque)\n+static int wm8750_pre_save(void *opaque)\n {\n     WM8750State *s = opaque;\n \n     s->rate_vmstate = s->rate - wm_rate_table;\n+\n+    return 0;\n }\n \n static int wm8750_post_load(void *opaque, int version_id)\ndiff --git a/hw/block/fdc.c b/hw/block/fdc.c\nindex db40e174c9..af9ba77270 100644\n--- a/hw/block/fdc.c\n+++ b/hw/block/fdc.c\n@@ -1102,11 +1102,13 @@ static int reconstruct_phase(FDCtrl *fdctrl)\n     }\n }\n \n-static void fdc_pre_save(void *opaque)\n+static int fdc_pre_save(void *opaque)\n {\n     FDCtrl *s = opaque;\n \n     s->dor_vmstate = s->dor | GET_CUR_DRV(s);\n+\n+    return 0;\n }\n \n static int fdc_pre_load(void *opaque)\ndiff --git a/hw/block/m25p80.c b/hw/block/m25p80.c\nindex 190573cefa..a2438b9ed2 100644\n--- a/hw/block/m25p80.c\n+++ b/hw/block/m25p80.c\n@@ -1251,9 +1251,11 @@ static void m25p80_reset(DeviceState *d)\n     reset_memory(s);\n }\n \n-static void m25p80_pre_save(void *opaque)\n+static int m25p80_pre_save(void *opaque)\n {\n     flash_sync_dirty((Flash *)opaque, -1);\n+\n+    return 0;\n }\n \n static Property m25p80_properties[] = {\ndiff --git a/hw/block/nand.c b/hw/block/nand.c\nindex 0d33ac281f..76dcd3f76e 100644\n--- a/hw/block/nand.c\n+++ b/hw/block/nand.c\n@@ -325,11 +325,13 @@ static void nand_command(NANDFlashState *s)\n     }\n }\n \n-static void nand_pre_save(void *opaque)\n+static int nand_pre_save(void *opaque)\n {\n     NANDFlashState *s = NAND(opaque);\n \n     s->ioaddr_vmstate = s->ioaddr - s->io;\n+\n+    return 0;\n }\n \n static int nand_post_load(void *opaque, int version_id)\ndiff --git a/hw/block/onenand.c b/hw/block/onenand.c\nindex b7423607d9..30e40f3914 100644\n--- a/hw/block/onenand.c\n+++ b/hw/block/onenand.c\n@@ -137,7 +137,7 @@ static void onenand_intr_update(OneNANDState *s)\n     qemu_set_irq(s->intr, ((s->intstatus >> 15) ^ (~s->config[0] >> 6)) & 1);\n }\n \n-static void onenand_pre_save(void *opaque)\n+static int onenand_pre_save(void *opaque)\n {\n     OneNANDState *s = opaque;\n     if (s->current == s->otp) {\n@@ -147,6 +147,8 @@ static void onenand_pre_save(void *opaque)\n     } else {\n         s->current_direction = 0;\n     }\n+\n+    return 0;\n }\n \n static int onenand_post_load(void *opaque, int version_id)\ndiff --git a/hw/char/serial.c b/hw/char/serial.c\nindex 9aec6c60d8..376bd2f240 100644\n--- a/hw/char/serial.c\n+++ b/hw/char/serial.c\n@@ -630,10 +630,12 @@ static void serial_event(void *opaque, int event)\n         serial_receive_break(s);\n }\n \n-static void serial_pre_save(void *opaque)\n+static int serial_pre_save(void *opaque)\n {\n     SerialState *s = opaque;\n     s->fcr_vmstate = s->fcr;\n+\n+    return 0;\n }\n \n static int serial_pre_load(void *opaque)\ndiff --git a/hw/display/qxl.c b/hw/display/qxl.c\nindex ae3677fd1e..d92fe05f1a 100644\n--- a/hw/display/qxl.c\n+++ b/hw/display/qxl.c\n@@ -2204,7 +2204,7 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)\n     qxl_realize_common(qxl, errp);\n }\n \n-static void qxl_pre_save(void *opaque)\n+static int qxl_pre_save(void *opaque)\n {\n     PCIQXLDevice* d = opaque;\n     uint8_t *ram_start = d->vga.vram_ptr;\n@@ -2216,6 +2216,8 @@ static void qxl_pre_save(void *opaque)\n         d->last_release_offset = (uint8_t *)d->last_release - ram_start;\n     }\n     assert(d->last_release_offset < d->vga.vram_size);\n+\n+    return 0;\n }\n \n static int qxl_pre_load(void *opaque)\ndiff --git a/hw/i2c/core.c b/hw/i2c/core.c\nindex 2c1234cdff..59068f157e 100644\n--- a/hw/i2c/core.c\n+++ b/hw/i2c/core.c\n@@ -41,7 +41,7 @@ static const TypeInfo i2c_bus_info = {\n     .instance_size = sizeof(I2CBus),\n };\n \n-static void i2c_bus_pre_save(void *opaque)\n+static int i2c_bus_pre_save(void *opaque)\n {\n     I2CBus *bus = opaque;\n \n@@ -53,6 +53,8 @@ static void i2c_bus_pre_save(void *opaque)\n             bus->saved_address = I2C_BROADCAST;\n         }\n     }\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_i2c_bus = {\ndiff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c\nindex 363d1b5743..75ad1ba6f0 100644\n--- a/hw/i386/kvm/clock.c\n+++ b/hw/i386/kvm/clock.c\n@@ -254,11 +254,13 @@ static const VMStateDescription kvmclock_reliable_get_clock = {\n  *  final pages of memory (which happens between vm_stop()\n  *  and pre_save()) takes max_downtime.\n  */\n-static void kvmclock_pre_save(void *opaque)\n+static int kvmclock_pre_save(void *opaque)\n {\n     KVMClockState *s = opaque;\n \n     kvm_update_clock(s);\n+\n+    return 0;\n }\n \n static const VMStateDescription kvmclock_vmsd = {\ndiff --git a/hw/ide/core.c b/hw/ide/core.c\nindex bea39536b0..588f375daf 100644\n--- a/hw/ide/core.c\n+++ b/hw/ide/core.c\n@@ -2696,7 +2696,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void ide_drive_pio_pre_save(void *opaque)\n+static int ide_drive_pio_pre_save(void *opaque)\n {\n     IDEState *s = opaque;\n     int idx;\n@@ -2712,6 +2712,8 @@ static void ide_drive_pio_pre_save(void *opaque)\n     } else {\n         s->end_transfer_fn_idx = idx;\n     }\n+\n+    return 0;\n }\n \n static bool ide_drive_pio_state_needed(void *opaque)\ndiff --git a/hw/ide/pci.c b/hw/ide/pci.c\nindex 3cfb510afe..552e4ad179 100644\n--- a/hw/ide/pci.c\n+++ b/hw/ide/pci.c\n@@ -303,7 +303,7 @@ static bool ide_bmdma_status_needed(void *opaque)\n     return ((bm->status & abused_bits) != 0);\n }\n \n-static void ide_bmdma_pre_save(void *opaque)\n+static int ide_bmdma_pre_save(void *opaque)\n {\n     BMDMAState *bm = opaque;\n     uint8_t abused_bits = BM_MIGRATION_COMPAT_STATUS_BITS;\n@@ -317,6 +317,8 @@ static void ide_bmdma_pre_save(void *opaque)\n     bm->migration_retry_nsector = bm->bus->retry_nsector;\n     bm->migration_compat_status =\n         (bm->status & ~abused_bits) | (bm->bus->error_status & abused_bits);\n+\n+    return 0;\n }\n \n /* This function accesses bm->bus->error_status which is loaded only after\ndiff --git a/hw/input/ps2.c b/hw/input/ps2.c\nindex 77906d5f46..dff3f1e024 100644\n--- a/hw/input/ps2.c\n+++ b/hw/input/ps2.c\n@@ -1216,12 +1216,14 @@ static int ps2_kbd_post_load(void* opaque, int version_id)\n     return 0;\n }\n \n-static void ps2_kbd_pre_save(void *opaque)\n+static int ps2_kbd_pre_save(void *opaque)\n {\n     PS2KbdState *s = (PS2KbdState *)opaque;\n     PS2State *ps2 = &s->common;\n \n     ps2_common_post_load(ps2);\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_ps2_keyboard = {\n@@ -1254,12 +1256,14 @@ static int ps2_mouse_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void ps2_mouse_pre_save(void *opaque)\n+static int ps2_mouse_pre_save(void *opaque)\n {\n     PS2MouseState *s = (PS2MouseState *)opaque;\n     PS2State *ps2 = &s->common;\n \n     ps2_common_post_load(ps2);\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_ps2_mouse = {\ndiff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c\nindex b068343771..75ac8c2ab5 100644\n--- a/hw/input/tsc210x.c\n+++ b/hw/input/tsc210x.c\n@@ -976,10 +976,12 @@ static void tsc210x_i2s_set_rate(TSC210xState *s, int in, int out)\n     s->i2s_rx_rate = in;\n }\n \n-static void tsc210x_pre_save(void *opaque)\n+static int tsc210x_pre_save(void *opaque)\n {\n     TSC210xState *s = (TSC210xState *) opaque;\n     s->now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);\n+\n+    return 0;\n }\n \n static int tsc210x_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c\nindex e1ac33042f..78903ea909 100644\n--- a/hw/intc/apic_common.c\n+++ b/hw/intc/apic_common.c\n@@ -360,7 +360,7 @@ static int apic_pre_load(void *opaque)\n     return 0;\n }\n \n-static void apic_dispatch_pre_save(void *opaque)\n+static int apic_dispatch_pre_save(void *opaque)\n {\n     APICCommonState *s = APIC_COMMON(opaque);\n     APICCommonClass *info = APIC_COMMON_GET_CLASS(s);\n@@ -368,6 +368,8 @@ static void apic_dispatch_pre_save(void *opaque)\n     if (info->pre_save) {\n         info->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int apic_dispatch_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c\nindex 70f1134823..aee50a20e0 100644\n--- a/hw/intc/arm_gic_common.c\n+++ b/hw/intc/arm_gic_common.c\n@@ -23,7 +23,7 @@\n #include \"gic_internal.h\"\n #include \"hw/arm/linux-boot-if.h\"\n \n-static void gic_pre_save(void *opaque)\n+static int gic_pre_save(void *opaque)\n {\n     GICState *s = (GICState *)opaque;\n     ARMGICCommonClass *c = ARM_GIC_COMMON_GET_CLASS(s);\n@@ -31,6 +31,8 @@ static void gic_pre_save(void *opaque)\n     if (c->pre_save) {\n         c->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int gic_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c\nindex 410915a2ac..7b54d52376 100644\n--- a/hw/intc/arm_gicv3_common.c\n+++ b/hw/intc/arm_gicv3_common.c\n@@ -28,7 +28,7 @@\n #include \"gicv3_internal.h\"\n #include \"hw/arm/linux-boot-if.h\"\n \n-static void gicv3_pre_save(void *opaque)\n+static int gicv3_pre_save(void *opaque)\n {\n     GICv3State *s = (GICv3State *)opaque;\n     ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s);\n@@ -36,6 +36,8 @@ static void gicv3_pre_save(void *opaque)\n     if (c->pre_save) {\n         c->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int gicv3_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c\nindex 68b20fccd1..f2cce597a9 100644\n--- a/hw/intc/arm_gicv3_its_common.c\n+++ b/hw/intc/arm_gicv3_its_common.c\n@@ -23,7 +23,7 @@\n #include \"hw/intc/arm_gicv3_its_common.h\"\n #include \"qemu/log.h\"\n \n-static void gicv3_its_pre_save(void *opaque)\n+static int gicv3_its_pre_save(void *opaque)\n {\n     GICv3ITSState *s = (GICv3ITSState *)opaque;\n     GICv3ITSCommonClass *c = ARM_GICV3_ITS_COMMON_GET_CLASS(s);\n@@ -31,6 +31,8 @@ static void gicv3_its_pre_save(void *opaque)\n     if (c->pre_save) {\n         c->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int gicv3_its_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c\nindex c2fd563b5b..18427b459a 100644\n--- a/hw/intc/i8259_common.c\n+++ b/hw/intc/i8259_common.c\n@@ -46,7 +46,7 @@ void pic_reset_common(PICCommonState *s)\n     /* Note: ELCR is not reset */\n }\n \n-static void pic_dispatch_pre_save(void *opaque)\n+static int pic_dispatch_pre_save(void *opaque)\n {\n     PICCommonState *s = opaque;\n     PICCommonClass *info = PIC_COMMON_GET_CLASS(s);\n@@ -54,6 +54,8 @@ static void pic_dispatch_pre_save(void *opaque)\n     if (info->pre_save) {\n         info->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int pic_dispatch_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c\nindex 97c4f9c2df..3b3d0a7680 100644\n--- a/hw/intc/ioapic_common.c\n+++ b/hw/intc/ioapic_common.c\n@@ -102,7 +102,7 @@ void ioapic_reset_common(DeviceState *dev)\n     }\n }\n \n-static void ioapic_dispatch_pre_save(void *opaque)\n+static int ioapic_dispatch_pre_save(void *opaque)\n {\n     IOAPICCommonState *s = IOAPIC_COMMON(opaque);\n     IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);\n@@ -110,6 +110,8 @@ static void ioapic_dispatch_pre_save(void *opaque)\n     if (info->pre_save) {\n         info->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int ioapic_dispatch_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c\nindex 7ead17ac3e..d208cb81c4 100644\n--- a/hw/intc/s390_flic_kvm.c\n+++ b/hw/intc/s390_flic_kvm.c\n@@ -420,7 +420,7 @@ typedef struct KVMS390FLICStateMigTmp {\n     uint8_t nimm;\n } KVMS390FLICStateMigTmp;\n \n-static void kvm_flic_ais_pre_save(void *opaque)\n+static int kvm_flic_ais_pre_save(void *opaque)\n {\n     KVMS390FLICStateMigTmp *tmp = opaque;\n     KVMS390FLICState *flic = tmp->parent;\n@@ -433,11 +433,13 @@ static void kvm_flic_ais_pre_save(void *opaque)\n \n     if (ioctl(flic->fd, KVM_GET_DEVICE_ATTR, &attr)) {\n         error_report(\"Failed to retrieve kvm flic ais states\");\n-        return;\n+        return -EINVAL;\n     }\n \n     tmp->simm = ais.simm;\n     tmp->nimm = ais.nimm;\n+\n+    return 0;\n }\n \n static int kvm_flic_ais_post_load(void *opaque, int version_id)\ndiff --git a/hw/intc/xics.c b/hw/intc/xics.c\nindex a84ba51ad8..4d6a25ade6 100644\n--- a/hw/intc/xics.c\n+++ b/hw/intc/xics.c\n@@ -241,7 +241,7 @@ static void icp_irq(ICSState *ics, int server, int nr, uint8_t priority)\n     }\n }\n \n-static void icp_dispatch_pre_save(void *opaque)\n+static int icp_dispatch_pre_save(void *opaque)\n {\n     ICPState *icp = opaque;\n     ICPStateClass *info = ICP_GET_CLASS(icp);\n@@ -249,6 +249,8 @@ static void icp_dispatch_pre_save(void *opaque)\n     if (info->pre_save) {\n         info->pre_save(icp);\n     }\n+\n+    return 0;\n }\n \n static int icp_dispatch_post_load(void *opaque, int version_id)\n@@ -533,7 +535,7 @@ static void ics_simple_reset(void *dev)\n     }\n }\n \n-static void ics_simple_dispatch_pre_save(void *opaque)\n+static int ics_simple_dispatch_pre_save(void *opaque)\n {\n     ICSState *ics = opaque;\n     ICSStateClass *info = ICS_BASE_GET_CLASS(ics);\n@@ -541,6 +543,8 @@ static void ics_simple_dispatch_pre_save(void *opaque)\n     if (info->pre_save) {\n         info->pre_save(ics);\n     }\n+\n+    return 0;\n }\n \n static int ics_simple_dispatch_post_load(void *opaque, int version_id)\ndiff --git a/hw/net/e1000.c b/hw/net/e1000.c\nindex eebe3a9c13..cae95185a5 100644\n--- a/hw/net/e1000.c\n+++ b/hw/net/e1000.c\n@@ -1343,7 +1343,7 @@ static bool is_version_1(void *opaque, int version_id)\n     return version_id == 1;\n }\n \n-static void e1000_pre_save(void *opaque)\n+static int e1000_pre_save(void *opaque)\n {\n     E1000State *s = opaque;\n     NetClientState *nc = qemu_get_queue(s->nic);\n@@ -1361,6 +1361,8 @@ static void e1000_pre_save(void *opaque)\n     if (nc->link_down && have_autoneg(s)) {\n         s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;\n     }\n+\n+    return 0;\n }\n \n static int e1000_post_load(void *opaque, int version_id)\ndiff --git a/hw/net/e1000e.c b/hw/net/e1000e.c\nindex 6c42b4478c..744f0f3b91 100644\n--- a/hw/net/e1000e.c\n+++ b/hw/net/e1000e.c\n@@ -523,13 +523,15 @@ static void e1000e_qdev_reset(DeviceState *dev)\n     e1000e_core_reset(&s->core);\n }\n \n-static void e1000e_pre_save(void *opaque)\n+static int e1000e_pre_save(void *opaque)\n {\n     E1000EState *s = opaque;\n \n     trace_e1000e_cb_pre_save();\n \n     e1000e_core_pre_save(&s->core);\n+\n+    return 0;\n }\n \n static int e1000e_post_load(void *opaque, int version_id)\ndiff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c\nindex 3be24bbee7..d6c8188ae1 100644\n--- a/hw/net/rtl8139.c\n+++ b/hw/net/rtl8139.c\n@@ -3162,7 +3162,7 @@ static const VMStateDescription vmstate_rtl8139_hotplug_ready ={\n     }\n };\n \n-static void rtl8139_pre_save(void *opaque)\n+static int rtl8139_pre_save(void *opaque)\n {\n     RTL8139State* s = opaque;\n     int64_t current_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);\n@@ -3170,6 +3170,8 @@ static void rtl8139_pre_save(void *opaque)\n     /* for migration to older versions */\n     s->TCTR = (current_time - s->TCTR_base) / PCI_PERIOD;\n     s->rtl8139_mmio_io_addr_dummy = 0;\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_rtl8139 = {\ndiff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c\nindex 148071a396..150fd0748e 100644\n--- a/hw/net/virtio-net.c\n+++ b/hw/net/virtio-net.c\n@@ -1712,7 +1712,7 @@ struct VirtIONetMigTmp {\n  * pointer and count and also validate the count.\n  */\n \n-static void virtio_net_tx_waiting_pre_save(void *opaque)\n+static int virtio_net_tx_waiting_pre_save(void *opaque)\n {\n     struct VirtIONetMigTmp *tmp = opaque;\n \n@@ -1721,6 +1721,8 @@ static void virtio_net_tx_waiting_pre_save(void *opaque)\n     if (tmp->parent->curr_queues == 0) {\n         tmp->curr_queues_1 = 0;\n     }\n+\n+    return 0;\n }\n \n static int virtio_net_tx_waiting_pre_load(void *opaque)\n@@ -1768,11 +1770,13 @@ static int virtio_net_ufo_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void virtio_net_ufo_pre_save(void *opaque)\n+static int virtio_net_ufo_pre_save(void *opaque)\n {\n     struct VirtIONetMigTmp *tmp = opaque;\n \n     tmp->has_ufo = tmp->parent->has_ufo;\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_virtio_net_has_ufo = {\n@@ -1800,11 +1804,13 @@ static int virtio_net_vnet_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void virtio_net_vnet_pre_save(void *opaque)\n+static int virtio_net_vnet_pre_save(void *opaque)\n {\n     struct VirtIONetMigTmp *tmp = opaque;\n \n     tmp->has_vnet_hdr = tmp->parent->has_vnet_hdr;\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_virtio_net_has_vnet = {\n@@ -2079,13 +2085,15 @@ static void virtio_net_instance_init(Object *obj)\n                                   DEVICE(n), NULL);\n }\n \n-static void virtio_net_pre_save(void *opaque)\n+static int virtio_net_pre_save(void *opaque)\n {\n     VirtIONet *n = opaque;\n \n     /* At this point, backend must be stopped, otherwise\n      * it might keep writing to memory. */\n     assert(!n->vhost_started);\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_virtio_net = {\ndiff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c\nindex a19a7a31dd..b43b58be2b 100644\n--- a/hw/net/vmxnet3.c\n+++ b/hw/net/vmxnet3.c\n@@ -2388,11 +2388,13 @@ static int vmxnet3_mcast_list_pre_load(void *opaque)\n }\n \n \n-static void vmxnet3_pre_save(void *opaque)\n+static int vmxnet3_pre_save(void *opaque)\n {\n     VMXNET3State *s = opaque;\n \n     s->mcast_list_buff_size = s->mcast_list_len * sizeof(MACAddr);\n+\n+    return 0;\n }\n \n static const VMStateDescription vmxstate_vmxnet3_mcast_list = {\ndiff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c\nindex 894e131c00..dec345fd24 100644\n--- a/hw/pci-host/piix.c\n+++ b/hw/pci-host/piix.c\n@@ -579,7 +579,7 @@ static int piix3_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void piix3_pre_save(void *opaque)\n+static int piix3_pre_save(void *opaque)\n {\n     int i;\n     PIIX3State *piix3 = opaque;\n@@ -588,6 +588,8 @@ static void piix3_pre_save(void *opaque)\n         piix3->pci_irq_levels_vmstate[i] =\n             pci_bus_get_irq_level(piix3->dev.bus, i);\n     }\n+\n+    return 0;\n }\n \n static bool piix3_rcr_needed(void *opaque)\ndiff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c\nindex f76886f4d3..05da316e0b 100644\n--- a/hw/ppc/ppc.c\n+++ b/hw/ppc/ppc.c\n@@ -937,11 +937,13 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int running,\n  *  final pages of memory (which happens between vm_stop()\n  *  and pre_save()) takes max_downtime.\n  */\n-static void timebase_pre_save(void *opaque)\n+static int timebase_pre_save(void *opaque)\n {\n     PPCTimebase *tb = opaque;\n \n     timebase_save(tb);\n+\n+    return 0;\n }\n \n const VMStateDescription vmstate_ppc_timebase = {\ndiff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c\nindex fa8b969840..5ccd785d5a 100644\n--- a/hw/ppc/spapr_iommu.c\n+++ b/hw/ppc/spapr_iommu.c\n@@ -140,7 +140,7 @@ static IOMMUTLBEntry spapr_tce_translate_iommu(IOMMUMemoryRegion *iommu,\n     return ret;\n }\n \n-static void spapr_tce_table_pre_save(void *opaque)\n+static int spapr_tce_table_pre_save(void *opaque)\n {\n     sPAPRTCETable *tcet = SPAPR_TCE_TABLE(opaque);\n \n@@ -149,6 +149,8 @@ static void spapr_tce_table_pre_save(void *opaque)\n \n     trace_spapr_iommu_pre_save(tcet->liobn, tcet->mig_nb_table,\n                                tcet->bus_offset, tcet->page_shift);\n+\n+    return 0;\n }\n \n static uint64_t spapr_tce_get_min_page_size(IOMMUMemoryRegion *iommu)\ndiff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c\nindex d7880f257a..a00f67b0f8 100644\n--- a/hw/ppc/spapr_pci.c\n+++ b/hw/ppc/spapr_pci.c\n@@ -1860,7 +1860,7 @@ static const VMStateDescription vmstate_spapr_pci_msi = {\n     },\n };\n \n-static void spapr_pci_pre_save(void *opaque)\n+static int spapr_pci_pre_save(void *opaque)\n {\n     sPAPRPHBState *sphb = opaque;\n     GHashTableIter iter;\n@@ -1885,7 +1885,7 @@ static void spapr_pci_pre_save(void *opaque)\n     sphb->msi_devs = NULL;\n     sphb->msi_devs_num = g_hash_table_size(sphb->msi);\n     if (!sphb->msi_devs_num) {\n-        return;\n+        return 0;\n     }\n     sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));\n \n@@ -1894,6 +1894,8 @@ static void spapr_pci_pre_save(void *opaque)\n         sphb->msi_devs[i].key = *(uint32_t *) key;\n         sphb->msi_devs[i].value = *(spapr_pci_msi *) value;\n     }\n+\n+    return 0;\n }\n \n static int spapr_pci_post_load(void *opaque, int version_id)\ndiff --git a/hw/s390x/css.c b/hw/s390x/css.c\nindex 901dc6a0f3..ad23eaf6e6 100644\n--- a/hw/s390x/css.c\n+++ b/hw/s390x/css.c\n@@ -196,7 +196,7 @@ static const VMStateDescription vmstate_schdev_orb = {\n };\n \n static int subch_dev_post_load(void *opaque, int version_id);\n-static void subch_dev_pre_save(void *opaque);\n+static int subch_dev_pre_save(void *opaque);\n \n const char err_hint_devno[] = \"Devno mismatch, tried to load wrong section!\"\n     \" Likely reason: some sequences of plug and unplug  can break\"\n@@ -249,7 +249,7 @@ static int post_load_ind_addr(void *opaque, int version_id)\n     return 0;\n }\n \n-static void pre_save_ind_addr(void *opaque)\n+static int pre_save_ind_addr(void *opaque)\n {\n     IndAddrPtrTmp *ptmp = opaque;\n     IndAddr *ind_addr = *(ptmp->parent);\n@@ -261,6 +261,8 @@ static void pre_save_ind_addr(void *opaque)\n         ptmp->len = 0;\n         ptmp->addr = 0L;\n     }\n+\n+    return 0;\n }\n \n const VMStateDescription vmstate_ind_addr_tmp = {\n@@ -358,12 +360,14 @@ static ChannelSubSys channel_subsys = {\n         QTAILQ_HEAD_INITIALIZER(channel_subsys.indicator_addresses),\n };\n \n-static void subch_dev_pre_save(void *opaque)\n+static int subch_dev_pre_save(void *opaque)\n {\n     SubchDev *s = opaque;\n \n     /* Prepare remote_schid for save */\n     s->migrated_schid = s->schid;\n+\n+    return 0;\n }\n \n static int subch_dev_post_load(void *opaque, int version_id)\ndiff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c\nindex b1976fdd19..7553ec1253 100644\n--- a/hw/s390x/virtio-ccw.c\n+++ b/hw/s390x/virtio-ccw.c\n@@ -62,13 +62,15 @@ typedef struct VirtioCcwDeviceTmp {\n     uint16_t config_vector;\n } VirtioCcwDeviceTmp;\n \n-static void virtio_ccw_dev_tmp_pre_save(void *opaque)\n+static int virtio_ccw_dev_tmp_pre_save(void *opaque)\n {\n     VirtioCcwDeviceTmp *tmp = opaque;\n     VirtioCcwDevice *dev = tmp->parent;\n     VirtIODevice *vdev = virtio_bus_get_device(&dev->bus);\n \n     tmp->config_vector = vdev->config_vector;\n+\n+    return 0;\n }\n \n static int virtio_ccw_dev_tmp_post_load(void *opaque, int version_id)\ndiff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c\nindex 3e56ab267c..a67ee074d9 100644\n--- a/hw/scsi/lsi53c895a.c\n+++ b/hw/scsi/lsi53c895a.c\n@@ -2083,7 +2083,7 @@ static void lsi_scsi_reset(DeviceState *dev)\n     lsi_soft_reset(s);\n }\n \n-static void lsi_pre_save(void *opaque)\n+static int lsi_pre_save(void *opaque)\n {\n     LSIState *s = opaque;\n \n@@ -2092,6 +2092,8 @@ static void lsi_pre_save(void *opaque)\n         assert(s->current->dma_len == 0);\n     }\n     assert(QTAILQ_EMPTY(&s->queue));\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_lsi_scsi = {\ndiff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c\nindex 77d8b6f9e2..b18d35248e 100644\n--- a/hw/scsi/vmw_pvscsi.c\n+++ b/hw/scsi/vmw_pvscsi.c\n@@ -1167,7 +1167,7 @@ pvscsi_reset(DeviceState *dev)\n     pvscsi_reset_adapter(s);\n }\n \n-static void\n+static int\n pvscsi_pre_save(void *opaque)\n {\n     PVSCSIState *s = (PVSCSIState *) opaque;\n@@ -1176,6 +1176,8 @@ pvscsi_pre_save(void *opaque)\n \n     assert(QTAILQ_EMPTY(&s->pending_queue));\n     assert(QTAILQ_EMPTY(&s->completion_queue));\n+\n+    return 0;\n }\n \n static int\ndiff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c\nindex 03f5b9c206..5e65fdb5a0 100644\n--- a/hw/timer/cadence_ttc.c\n+++ b/hw/timer/cadence_ttc.c\n@@ -421,9 +421,11 @@ static void cadence_ttc_init(Object *obj)\n     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);\n }\n \n-static void cadence_timer_pre_save(void *opaque)\n+static int cadence_timer_pre_save(void *opaque)\n {\n     cadence_timer_sync((CadenceTimerState *)opaque);\n+\n+    return 0;\n }\n \n static int cadence_timer_post_load(void *opaque, int version_id)\ndiff --git a/hw/timer/hpet.c b/hw/timer/hpet.c\nindex a2c18b30c3..577371bc6d 100644\n--- a/hw/timer/hpet.c\n+++ b/hw/timer/hpet.c\n@@ -216,12 +216,14 @@ static void update_irq(struct HPETTimer *timer, int set)\n     }\n }\n \n-static void hpet_pre_save(void *opaque)\n+static int hpet_pre_save(void *opaque)\n {\n     HPETState *s = opaque;\n \n     /* save current counter value */\n     s->hpet_counter = hpet_get_ticks(s);\n+\n+    return 0;\n }\n \n static int hpet_pre_load(void *opaque)\ndiff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c\nindex ee064aa819..b623c96198 100644\n--- a/hw/timer/i8254_common.c\n+++ b/hw/timer/i8254_common.c\n@@ -237,7 +237,7 @@ static int pit_load_old(QEMUFile *f, void *opaque, int version_id)\n     return 0;\n }\n \n-static void pit_dispatch_pre_save(void *opaque)\n+static int pit_dispatch_pre_save(void *opaque)\n {\n     PITCommonState *s = opaque;\n     PITCommonClass *c = PIT_COMMON_GET_CLASS(s);\n@@ -245,6 +245,8 @@ static void pit_dispatch_pre_save(void *opaque)\n     if (c->pre_save) {\n         c->pre_save(s);\n     }\n+\n+    return 0;\n }\n \n static int pit_dispatch_post_load(void *opaque, int version_id)\ndiff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c\nindex 82843ed03f..7764be25ec 100644\n--- a/hw/timer/mc146818rtc.c\n+++ b/hw/timer/mc146818rtc.c\n@@ -795,11 +795,13 @@ static void rtc_set_date_from_host(ISADevice *dev)\n     rtc_set_cmos(s, &tm);\n }\n \n-static void rtc_pre_save(void *opaque)\n+static int rtc_pre_save(void *opaque)\n {\n     RTCState *s = opaque;\n \n     rtc_update_time(s);\n+\n+    return 0;\n }\n \n static int rtc_post_load(void *opaque, int version_id)\ndiff --git a/hw/timer/pl031.c b/hw/timer/pl031.c\nindex dbbeb9b16b..d3aacce80d 100644\n--- a/hw/timer/pl031.c\n+++ b/hw/timer/pl031.c\n@@ -211,7 +211,7 @@ static void pl031_init(Object *obj)\n     s->timer = timer_new_ns(rtc_clock, pl031_interrupt, s);\n }\n \n-static void pl031_pre_save(void *opaque)\n+static int pl031_pre_save(void *opaque)\n {\n     PL031State *s = opaque;\n \n@@ -219,6 +219,8 @@ static void pl031_pre_save(void *opaque)\n      * store the base time relative to the QEMU_CLOCK_VIRTUAL for backwards-compatibility.  */\n     int64_t delta = qemu_clock_get_ns(rtc_clock) - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);\n     s->tick_offset_vmstate = s->tick_offset + delta / NANOSECONDS_PER_SECOND;\n+\n+    return 0;\n }\n \n static int pl031_post_load(void *opaque, int version_id)\ndiff --git a/hw/timer/twl92230.c b/hw/timer/twl92230.c\nindex c0aa8ae3de..eb58c378e0 100644\n--- a/hw/timer/twl92230.c\n+++ b/hw/timer/twl92230.c\n@@ -791,11 +791,13 @@ static const VMStateDescription vmstate_menelaus_tm = {\n     }\n };\n \n-static void menelaus_pre_save(void *opaque)\n+static int menelaus_pre_save(void *opaque)\n {\n     MenelausState *s = opaque;\n     /* Should be <= 1000 */\n     s->rtc_next_vmstate =  s->rtc.next - qemu_clock_get_ms(rtc_clock);\n+\n+    return 0;\n }\n \n static int menelaus_post_load(void *opaque, int version_id)\ndiff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c\nindex bef1f03c42..0c77d2a41d 100644\n--- a/hw/usb/dev-smartcard-reader.c\n+++ b/hw/usb/dev-smartcard-reader.c\n@@ -1374,7 +1374,7 @@ static int ccid_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void ccid_pre_save(void *opaque)\n+static int ccid_pre_save(void *opaque)\n {\n     USBCCIDState *s = opaque;\n \n@@ -1386,6 +1386,8 @@ static void ccid_pre_save(void *opaque)\n          */\n         s->migration_state = MIGRATION_MIGRATED;\n     }\n+\n+    return 0;\n }\n \n static VMStateDescription bulk_in_vmstate = {\ndiff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c\nindex 604912cb3e..c2bf237e6c 100644\n--- a/hw/usb/hcd-ehci.c\n+++ b/hw/usb/hcd-ehci.c\n@@ -2380,7 +2380,7 @@ static USBBusOps ehci_bus_ops_standalone = {\n     .wakeup_endpoint = ehci_wakeup_endpoint,\n };\n \n-static void usb_ehci_pre_save(void *opaque)\n+static int usb_ehci_pre_save(void *opaque)\n {\n     EHCIState *ehci = opaque;\n     uint32_t new_frindex;\n@@ -2389,6 +2389,8 @@ static void usb_ehci_pre_save(void *opaque)\n     new_frindex = ehci->frindex & ~7;\n     ehci->last_run_ns -= (ehci->frindex - new_frindex) * UFRAME_TIMER_NS;\n     ehci->frindex = new_frindex;\n+\n+    return 0;\n }\n \n static int usb_ehci_post_load(void *opaque, int version_id)\ndiff --git a/hw/usb/redirect.c b/hw/usb/redirect.c\nindex 5e42730449..ec174309db 100644\n--- a/hw/usb/redirect.c\n+++ b/hw/usb/redirect.c\n@@ -2111,11 +2111,13 @@ static void usbredir_buffered_bulk_packet(void *priv, uint64_t id,\n  * Migration code\n  */\n \n-static void usbredir_pre_save(void *priv)\n+static int usbredir_pre_save(void *priv)\n {\n     USBRedirDevice *dev = priv;\n \n     usbredir_fill_already_in_flight(dev);\n+\n+    return 0;\n }\n \n static int usbredir_post_load(void *priv, int version_id)\ndiff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c\nindex 49e0022533..5ec1c6a2a2 100644\n--- a/hw/virtio/vhost-vsock.c\n+++ b/hw/virtio/vhost-vsock.c\n@@ -254,13 +254,15 @@ static void vhost_vsock_post_load_timer_cb(void *opaque)\n     vhost_vsock_send_transport_reset(vsock);\n }\n \n-static void vhost_vsock_pre_save(void *opaque)\n+static int vhost_vsock_pre_save(void *opaque)\n {\n     VHostVSock *vsock = opaque;\n \n     /* At this point, backend must be stopped, otherwise\n      * it might keep writing to memory. */\n     assert(!vsock->vhost_dev.started);\n+\n+    return 0;\n }\n \n static int vhost_vsock_post_load(void *opaque, int version_id)\ndiff --git a/include/migration/vmstate.h b/include/migration/vmstate.h\nindex 85e43da568..da46b1a36d 100644\n--- a/include/migration/vmstate.h\n+++ b/include/migration/vmstate.h\n@@ -179,7 +179,7 @@ struct VMStateDescription {\n     LoadStateHandler *load_state_old;\n     int (*pre_load)(void *opaque);\n     int (*post_load)(void *opaque, int version_id);\n-    void (*pre_save)(void *opaque);\n+    int (*pre_save)(void *opaque);\n     bool (*needed)(void *opaque);\n     VMStateField *fields;\n     const VMStateDescription **subsections;\ndiff --git a/migration/colo-comm.c b/migration/colo-comm.c\nindex b61aa19a38..df26e4dfe7 100644\n--- a/migration/colo-comm.c\n+++ b/migration/colo-comm.c\n@@ -34,11 +34,13 @@ COLOMode get_colo_mode(void)\n     }\n }\n \n-static void colo_info_pre_save(void *opaque)\n+static int colo_info_pre_save(void *opaque)\n {\n     COLOInfo *s = opaque;\n \n     s->colo_requested = migrate_colo_enabled();\n+\n+    return 0;\n }\n \n static bool colo_info_need(void *opaque)\ndiff --git a/migration/global_state.c b/migration/global_state.c\nindex dfdaf63910..8e8ab5c51e 100644\n--- a/migration/global_state.c\n+++ b/migration/global_state.c\n@@ -101,12 +101,14 @@ static int global_state_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void global_state_pre_save(void *opaque)\n+static int global_state_pre_save(void *opaque)\n {\n     GlobalState *s = opaque;\n \n     trace_migrate_global_state_pre_save((char *)s->runstate);\n     s->size = strlen((char *)s->runstate) + 1;\n+\n+    return 0;\n }\n \n static const VMStateDescription vmstate_globalstate = {\ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex 7a55023d1a..8d18a57ca0 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -295,7 +295,7 @@ static SaveState savevm_state = {\n     .global_section_id = 0,\n };\n \n-static void configuration_pre_save(void *opaque)\n+static int configuration_pre_save(void *opaque)\n {\n     SaveState *state = opaque;\n     const char *current_name = MACHINE_GET_CLASS(current_machine)->name;\n@@ -303,6 +303,8 @@ static void configuration_pre_save(void *opaque)\n     state->len = strlen(current_name);\n     state->name = current_name;\n     state->target_page_bits = qemu_target_page_bits();\n+\n+    return 0;\n }\n \n static int configuration_pre_load(void *opaque)\ndiff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c\nindex a4ded2956d..b2e10769a6 100644\n--- a/replay/replay-snapshot.c\n+++ b/replay/replay-snapshot.c\n@@ -21,10 +21,12 @@\n #include \"migration/vmstate.h\"\n #include \"migration/snapshot.h\"\n \n-static void replay_pre_save(void *opaque)\n+static int replay_pre_save(void *opaque)\n {\n     ReplayState *state = opaque;\n     state->file_offset = ftell(replay_file);\n+\n+    return 0;\n }\n \n static int replay_post_load(void *opaque, int version_id)\ndiff --git a/slirp/slirp.c b/slirp/slirp.c\nindex 1d6756821c..1cb6b07004 100644\n--- a/slirp/slirp.c\n+++ b/slirp/slirp.c\n@@ -1203,11 +1203,13 @@ struct sbuf_tmp {\n     uint32_t roff, woff;\n };\n \n-static void sbuf_tmp_pre_save(void *opaque)\n+static int sbuf_tmp_pre_save(void *opaque)\n {\n     struct sbuf_tmp *tmp = opaque;\n     tmp->woff = tmp->parent->sb_wptr - tmp->parent->sb_data;\n     tmp->roff = tmp->parent->sb_rptr - tmp->parent->sb_data;\n+\n+    return 0;\n }\n \n static int sbuf_tmp_post_load(void *opaque, int version)\n@@ -1303,7 +1305,7 @@ typedef struct SS_FamilyTmpStruct {\n #define SS_FAMILY_MIG_IPV6  10  /* Linux */\n #define SS_FAMILY_MIG_OTHER 0xffff\n \n-static void ss_family_pre_save(void *opaque)\n+static int ss_family_pre_save(void *opaque)\n {\n     SS_FamilyTmpStruct *tss = opaque;\n \n@@ -1314,6 +1316,8 @@ static void ss_family_pre_save(void *opaque)\n     } else if (tss->parent->ss.ss_family == AF_INET6) {\n         tss->portable_family = SS_FAMILY_MIG_IPV6;\n     }\n+\n+    return 0;\n }\n \n static int ss_family_post_load(void *opaque, int version_id)\ndiff --git a/target/arm/machine.c b/target/arm/machine.c\nindex e5fe083da4..29df7ac87d 100644\n--- a/target/arm/machine.c\n+++ b/target/arm/machine.c\n@@ -394,7 +394,7 @@ static const VMStateInfo vmstate_powered_off = {\n     .put = put_power,\n };\n \n-static void cpu_pre_save(void *opaque)\n+static int cpu_pre_save(void *opaque)\n {\n     ARMCPU *cpu = opaque;\n \n@@ -415,6 +415,8 @@ static void cpu_pre_save(void *opaque)\n            cpu->cpreg_array_len * sizeof(uint64_t));\n     memcpy(cpu->cpreg_vmstate_values, cpu->cpreg_values,\n            cpu->cpreg_array_len * sizeof(uint64_t));\n+\n+    return 0;\n }\n \n static int cpu_post_load(void *opaque, int version_id)\ndiff --git a/target/i386/machine.c b/target/i386/machine.c\nindex eab33725a3..3bc11b74b7 100644\n--- a/target/i386/machine.c\n+++ b/target/i386/machine.c\n@@ -160,13 +160,15 @@ static floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)\n     return temp.d;\n }\n \n-static void fpreg_pre_save(void *opaque)\n+static int fpreg_pre_save(void *opaque)\n {\n     x86_FPReg_tmp *tmp = opaque;\n \n     /* we save the real CPU data (in case of MMX usage only 'mant'\n        contains the MMX register */\n     cpu_get_fp80(&tmp->tmp_mant, &tmp->tmp_exp, tmp->parent->d);\n+\n+    return 0;\n }\n \n static int fpreg_post_load(void *opaque, int version)\n@@ -196,7 +198,7 @@ static const VMStateDescription vmstate_fpreg = {\n     }\n };\n \n-static void cpu_pre_save(void *opaque)\n+static int cpu_pre_save(void *opaque)\n {\n     X86CPU *cpu = opaque;\n     CPUX86State *env = &cpu->env;\n@@ -228,6 +230,7 @@ static void cpu_pre_save(void *opaque)\n         env->segs[R_SS].flags &= ~(env->segs[R_SS].flags & DESC_DPL_MASK);\n     }\n \n+    return 0;\n }\n \n static int cpu_post_load(void *opaque, int version_id)\ndiff --git a/target/ppc/machine.c b/target/ppc/machine.c\nindex e36b7100cb..384caee800 100644\n--- a/target/ppc/machine.c\n+++ b/target/ppc/machine.c\n@@ -146,7 +146,7 @@ static bool cpu_pre_2_8_migration(void *opaque, int version_id)\n     return cpu->pre_2_8_migration;\n }\n \n-static void cpu_pre_save(void *opaque)\n+static int cpu_pre_save(void *opaque)\n {\n     PowerPCCPU *cpu = opaque;\n     CPUPPCState *env = &cpu->env;\n@@ -195,6 +195,8 @@ static void cpu_pre_save(void *opaque)\n         cpu->mig_insns_flags2 = env->insns_flags2 & insns_compat_mask2;\n         cpu->mig_nb_BATs = env->nb_BATs;\n     }\n+\n+    return 0;\n }\n \n /*\ndiff --git a/target/s390x/machine.c b/target/s390x/machine.c\nindex 097a147dbb..e1b7015d20 100644\n--- a/target/s390x/machine.c\n+++ b/target/s390x/machine.c\n@@ -37,13 +37,15 @@ static int cpu_post_load(void *opaque, int version_id)\n     return 0;\n }\n \n-static void cpu_pre_save(void *opaque)\n+static int cpu_pre_save(void *opaque)\n {\n     S390CPU *cpu = opaque;\n \n     if (kvm_enabled()) {\n         kvm_s390_vcpu_interrupt_pre_save(cpu);\n     }\n+\n+    return 0;\n }\n \n static inline bool fpu_needed(void *opaque)\ndiff --git a/target/sparc/machine.c b/target/sparc/machine.c\nindex 6bd6b8ee3e..8ff9dea297 100644\n--- a/target/sparc/machine.c\n+++ b/target/sparc/machine.c\n@@ -88,7 +88,7 @@ static const VMStateInfo vmstate_psr = {\n     .put = put_psr,\n };\n \n-static void cpu_pre_save(void *opaque)\n+static int cpu_pre_save(void *opaque)\n {\n     SPARCCPU *cpu = opaque;\n     CPUSPARCState *env = &cpu->env;\n@@ -97,6 +97,8 @@ static void cpu_pre_save(void *opaque)\n      * window as the outs of the first window\n      */\n     cpu_set_cwp(env, env->cwp);\n+\n+    return 0;\n }\n \n /* 32-bit SPARC retains migration compatibility with older versions\ndiff --git a/tests/test-vmstate.c b/tests/test-vmstate.c\nindex ee292c7bee..e643ac662b 100644\n--- a/tests/test-vmstate.c\n+++ b/tests/test-vmstate.c\n@@ -765,11 +765,13 @@ typedef struct TmpTestStruct {\n     int64_t diff;\n } TmpTestStruct;\n \n-static void tmp_child_pre_save(void *opaque)\n+static int tmp_child_pre_save(void *opaque)\n {\n     struct TmpTestStruct *tts = opaque;\n \n     tts->diff = tts->parent->b - tts->parent->a;\n+\n+    return 0;\n }\n \n static int tmp_child_post_load(void *opaque, int version_id)\n","prefixes":["1/5"]}