aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-22 17:15:29 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-22 17:15:29 +0000
commit9781e0401ad7d2d30e48fd532372d4ef80be58b6 (patch)
tree4660f374d3cd785ce476d45d9407fcd094e72c59 /vl.c
parent5c047c0d3f7d732620ece04d5f8574d19ea1626d (diff)
Rework vm_state_change notifiers (Jan Kiszka)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6402 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/vl.c b/vl.c
index 73de9c3854..0348eb4e61 100644
--- a/vl.c
+++ b/vl.c
@@ -3451,37 +3451,21 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
qemu_free (e);
}
-static void vm_state_notify(int running)
+static void vm_state_notify(int running, int reason)
{
VMChangeStateEntry *e;
for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
- e->cb(e->opaque, running);
+ e->cb(e->opaque, running, reason);
}
}
-/* XXX: support several handlers */
-static VMStopHandler *vm_stop_cb;
-static void *vm_stop_opaque;
-
-int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque)
-{
- vm_stop_cb = cb;
- vm_stop_opaque = opaque;
- return 0;
-}
-
-void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque)
-{
- vm_stop_cb = NULL;
-}
-
void vm_start(void)
{
if (!vm_running) {
cpu_enable_ticks();
vm_running = 1;
- vm_state_notify(1);
+ vm_state_notify(1, 0);
qemu_rearm_alarm_timer(alarm_timer);
}
}
@@ -3491,12 +3475,7 @@ void vm_stop(int reason)
if (vm_running) {
cpu_disable_ticks();
vm_running = 0;
- if (reason != 0) {
- if (vm_stop_cb) {
- vm_stop_cb(vm_stop_opaque, reason);
- }
- }
- vm_state_notify(0);
+ vm_state_notify(0, reason);
}
}