From: Juan Quintela Date: Thu, 10 Sep 2009 01:04:29 +0000 (+0200) Subject: vmstate: add sensible arguments to vmstate_unregister() X-Git-Url: http://git.maemo.org/git/?p=qemu;a=commitdiff_plain;h=1eb7538b7753535f9502c8c5779fd9f4e80d1559 vmstate: add sensible arguments to vmstate_unregister() vmsd alone is not enugh, because we can have several structs saved with the same description (vmsd). Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- diff --git a/hw/hw.h b/hw/hw.h index a0cb94e..c703975 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -509,5 +509,5 @@ extern void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, const void *opaque); extern int vmstate_register(int instance_id, const VMStateDescription *vmsd, void *base); -extern void vmstate_unregister(const char *idstr, void *opaque); +void vmstate_unregister(const VMStateDescription *vmsd, void *opaque); #endif diff --git a/savevm.c b/savevm.c index 0dcab79..7b0989f 100644 --- a/savevm.c +++ b/savevm.c @@ -1002,9 +1002,16 @@ int vmstate_register(int instance_id, const VMStateDescription *vmsd, return 0; } -void vmstate_unregister(const char *idstr, void *opaque) +void vmstate_unregister(const VMStateDescription *vmsd, void *opaque) { - unregister_savevm(idstr, opaque); + SaveStateEntry *se, *new_se; + + TAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) { + if (se->vmsd == vmsd && se->opaque == opaque) { + TAILQ_REMOVE(&savevm_handlers, se, entry); + qemu_free(se); + } + } } int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,