Commit dda9b29f authored by Jan Kiszka's avatar Jan Kiszka Committed by Anthony Liguori
Browse files

Add qemu_unregister_reset



Will be used by '-boot once=...', and should also help in other use
cases.

Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 55ddfe8e
...@@ -261,6 +261,7 @@ void unregister_savevm(const char *idstr, void *opaque); ...@@ -261,6 +261,7 @@ 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);
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
/* handler to set the boot_device order for a specific type of QEMUMachine */ /* handler to set the boot_device order for a specific type of QEMUMachine */
/* return 0 if success */ /* return 0 if success */
......
...@@ -3509,12 +3509,25 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque) ...@@ -3509,12 +3509,25 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque)
TAILQ_INSERT_TAIL(&reset_handlers, re, entry); TAILQ_INSERT_TAIL(&reset_handlers, re, entry);
} }
void qemu_system_reset(void) void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
{ {
QEMUResetEntry *re; QEMUResetEntry *re;
/* reset all devices */
TAILQ_FOREACH(re, &reset_handlers, entry) { TAILQ_FOREACH(re, &reset_handlers, entry) {
if (re->func == func && re->opaque == opaque) {
TAILQ_REMOVE(&reset_handlers, re, entry);
qemu_free(re);
return;
}
}
}
void qemu_system_reset(void)
{
QEMUResetEntry *re, *nre;
/* reset all devices */
TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque); re->func(re->opaque);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment