aboutsummaryrefslogtreecommitdiff
path: root/migration/vmstate.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2017-09-25 12:29:15 +0100
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-09-27 11:38:21 +0100
commitf3cadd39c4489d539ea0e17169cfcf2126ed3d50 (patch)
treef33df96c49bde595c6c263e5a9cc9e9f28c1819d /migration/vmstate.c
parent88b0faf1853937b87a35cae8c74e38971aff0bba (diff)
downloadqemu-f3cadd39c4489d539ea0e17169cfcf2126ed3d50.zip
qemu-f3cadd39c4489d539ea0e17169cfcf2126ed3d50.tar.gz
qemu-f3cadd39c4489d539ea0e17169cfcf2126ed3d50.tar.bz2
migration: wire vmstate_save_state errors up to vmstate_subsection_save
Route the errors from vmstate_save_state up through vmstate_subsection_save (and back down, all rather recursive). Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20170925112917.21340-5-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> Commit message fixed up as per Peter's review
Diffstat (limited to 'migration/vmstate.c')
-rw-r--r--migration/vmstate.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 848e844..0b3282c 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -21,8 +21,8 @@
#include "trace.h"
#include "qjson.h"
-static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, QJSON *vmdesc);
+static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
+ void *opaque, QJSON *vmdesc);
static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque);
@@ -395,9 +395,7 @@ int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
json_end_array(vmdesc);
}
- vmstate_subsection_save(f, vmsd, opaque, vmdesc);
-
- return 0;
+ return vmstate_subsection_save(f, vmsd, opaque, vmdesc);
}
static const VMStateDescription *
@@ -463,11 +461,12 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
return 0;
}
-static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, QJSON *vmdesc)
+static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
+ void *opaque, QJSON *vmdesc)
{
const VMStateDescription **sub = vmsd->subsections;
bool subsection_found = false;
+ int ret = 0;
trace_vmstate_subsection_save_top(vmsd->name);
while (sub && *sub && (*sub)->needed) {
@@ -491,7 +490,10 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len);
qemu_put_be32(f, vmsdsub->version_id);
- vmstate_save_state(f, vmsdsub, opaque, vmdesc);
+ ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc);
+ if (ret) {
+ return ret;
+ }
if (vmdesc) {
json_end_object(vmdesc);
@@ -503,4 +505,6 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
if (vmdesc && subsection_found) {
json_end_array(vmdesc);
}
+
+ return ret;
}