Skip to contentSkip to conversation

register_savevm etc.: make save function optional

PATCH New Ian Jackson 1 participant 1 message May 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 register_savevm etc.: make save function optional

register_savevm etc.: make save function optional

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.

vl.c +4 -0
index 67712f0..3a9135c 100644
@@ -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);