mirror of
https://git.proxmox.com/git/qemu
synced 2025-07-17 22:30:20 +00:00
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 <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7148 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
ad06714858
commit
41bd13afda
2
hw/hw.h
2
hw/hw.h
@ -239,6 +239,8 @@ int register_savevm_live(const char *idstr,
|
|||||||
LoadStateHandler *load_state,
|
LoadStateHandler *load_state,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
|
void unregister_savevm(const char *idstr, void *opaque);
|
||||||
|
|
||||||
typedef void QEMUResetHandler(void *opaque);
|
typedef void QEMUResetHandler(void *opaque);
|
||||||
|
|
||||||
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
|
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
|
||||||
|
16
savevm.c
16
savevm.c
@ -647,6 +647,22 @@ int register_savevm(const char *idstr,
|
|||||||
NULL, save_state, load_state, opaque);
|
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_MAGIC 0x5145564d
|
||||||
#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002
|
#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002
|
||||||
#define QEMU_VM_FILE_VERSION 0x00000003
|
#define QEMU_VM_FILE_VERSION 0x00000003
|
||||||
|
Loading…
Reference in New Issue
Block a user