[7158] Add unregister_savevm() (Mark McLoughlin)
Revision: 7158
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7158 Author: aliguori Date: 2009-04-17 18:06:46 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
Add unregister_savevm() (Mark McLoughlin)
Currently there's no way to unregister a savevm callback, so e.g. if a NIC is hot-unplugged and a savevm is issued, we'll segfault.
Signed-off-by Mark McLoughlin <[email protected]>
Signed-off-by Anthony Liguori <[email protected]>
Modified Paths:
--------------
branches/stable_0_10/hw/hw.h
branches/stable_0_10/savevm.cModified: branches/stable_0_10/hw/hw.h
===================================================================
stable_0_10/hw/hw.h +2 -0
@@ -239,6 +239,8 @@ LoadStateHandler *load_state, void *opaque); +void unregister_savevm (const char *idstr,void *opaque); +typedef void QEMUResetHandler (void *opaque);void qemu_register_reset (QEMUResetHandler *func,void *opaque);
Modified: branches/stable_0_10/savevm.c
===================================================================
stable_0_10/savevm.c +16 -0
@@ -643,6 +643,22 @@ NULL, save_state, load_state, opaque); } +void unregister_savevm (const char *idstr,void *opaque) +{ +SaveStateEntry **pse; + + pse = &first_se; +while (*pse !=NULL ) { +if (strcmp ((*pse)->idstr, idstr) ==0 && (*pse)->opaque == opaque) { +SaveStateEntry *next = (*pse)->next; +qemu_free (*pse); + *pse = next; +continue ; + } + pse = &(*pse)->next; + } +} +#define QEMU_VM_FILE_MAGIC 0x5145564d#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002#define QEMU_VM_FILE_VERSION 0x00000003