diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-05-02 00:29:37 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-22 10:50:34 -0500 |
commit | fcaf8e576d0435a72093e803e752ea9f130e591b (patch) | |
tree | fff3d6f590833c0f894a6c7c300ab126b5259d95 /vl.c | |
parent | 654349ddbc0bccd2544e3aef9e2f582b6f40c5ed (diff) | |
download | qemu-fcaf8e576d0435a72093e803e752ea9f130e591b.tar.gz qemu-fcaf8e576d0435a72093e803e752ea9f130e591b.tar.bz2 qemu-fcaf8e576d0435a72093e803e752ea9f130e591b.zip |
Introduce reset notifier order
Add the parameter 'order' to qemu_register_reset and sort callbacks on
registration. On system reset, callbacks with lower order will be
invoked before those with higher order. Update all existing users to the
standard order 0.
Note: At least for x86, the existing users seem to assume that handlers
are called in their registration order. Therefore, the patch preserves
this property. If someone feels bored, (s)he could try to identify this
dependency and express it properly on callback registration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3579,6 +3579,7 @@ void vm_start(void) typedef struct QEMUResetEntry { QEMUResetHandler *func; void *opaque; + int order; struct QEMUResetEntry *next; } QEMUResetEntry; @@ -3634,16 +3635,18 @@ static void do_vm_stop(int reason) } } -void qemu_register_reset(QEMUResetHandler *func, void *opaque) +void qemu_register_reset(QEMUResetHandler *func, int order, void *opaque) { QEMUResetEntry **pre, *re; pre = &first_reset_entry; - while (*pre != NULL) + while (*pre != NULL && (*pre)->order >= order) { pre = &(*pre)->next; + } re = qemu_mallocz(sizeof(QEMUResetEntry)); re->func = func; re->opaque = opaque; + re->order = order; re->next = NULL; *pre = re; } |