]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
register_savevm etc.: make save function optional
authorIan Jackson <iwj@mariner.uk.xensource.com>
Fri, 16 May 2008 16:01:12 +0000 (17:01 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 16 May 2008 16:01:12 +0000 (17:01 +0100)
This allows a device to provide only a loading function, not a saving
function.

This is useful if a later version of an emulation restores its state
in some other way (eg by having a different device name, or by
exploiting invariants in the state); when this happens it is still
necessary to load or skip the information when it is found in old
savefiles.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
vl.c

diff --git a/vl.c b/vl.c
index 67712f0ce3a1f82b56bf96fe939a68db7b6ccf3d..3a9135cd0d9c5e5064f19573387cb6a7196d1b2a 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -5988,6 +5988,10 @@ static int qemu_savevm_state(QEMUFile *f)
     qemu_put_be64(f, 0); /* total size */
 
     for(se = first_se; se != NULL; se = se->next) {
+       if (se->save_state == NULL)
+           /* this one has a loader only, for backwards compatibility */
+           continue;
+
         /* ID string */
         len = strlen(se->idstr);
         qemu_put_byte(f, len);