summaryrefslogtreecommitdiffstats
path: root/migration/vmstate.c
diff options
context:
space:
mode:
authorAaron Lindsay2019-01-21 11:23:13 +0100
committerPeter Maydell2019-01-21 11:38:55 +0100
commit8c07559fc7ee132e2145ad09299a08c10ebe7804 (patch)
tree78da6eb7ab56ca982e0f95a5ed341c510f284b26 /migration/vmstate.c
parenttarget/arm: Tidy TBI handling in gen_a64_set_pc (diff)
downloadqemu-8c07559fc7ee132e2145ad09299a08c10ebe7804.tar.gz
qemu-8c07559fc7ee132e2145ad09299a08c10ebe7804.tar.xz
qemu-8c07559fc7ee132e2145ad09299a08c10ebe7804.zip
migration: Add post_save function to VMStateDescription
In some cases it may be helpful to modify state before saving it for migration, and then modify the state back after it has been saved. The existing pre_save function provides half of this functionality. This patch adds a post_save function to provide the second half. Signed-off-by: Aaron Lindsay <aclindsa@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 20181211151945.29137-2-aaron@os.amperecomputing.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/vmstate.c')
-rw-r--r--migration/vmstate.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 80b59009aa..e2bbb7b5f7 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -390,6 +390,9 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
if (ret) {
error_report("Save of field %s/%s failed",
vmsd->name, field->name);
+ if (vmsd->post_save) {
+ vmsd->post_save(opaque);
+ }
return ret;
}
@@ -415,7 +418,15 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
json_end_array(vmdesc);
}
- return vmstate_subsection_save(f, vmsd, opaque, vmdesc);
+ ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc);
+
+ if (vmsd->post_save) {
+ int ps_ret = vmsd->post_save(opaque);
+ if (!ret) {
+ ret = ps_ret;
+ }
+ }
+ return ret;
}
static const VMStateDescription *