From 1dfb4dd993f7122353fb2894f09dfcba894cd7d5 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Fri, 29 Jul 2011 14:26:33 -0300 Subject: Replace the VMSTOP macros with a proper state type Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino --- cpus.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cpus.c') diff --git a/cpus.c b/cpus.c index 54c188cf5c..76a79ac7d4 100644 --- a/cpus.c +++ b/cpus.c @@ -118,13 +118,13 @@ int cpu_is_stopped(CPUState *env) return !vm_running || env->stopped; } -static void do_vm_stop(int reason) +static void do_vm_stop(RunState state) { if (vm_running) { cpu_disable_ticks(); vm_running = 0; pause_all_vcpus(); - vm_state_notify(0, reason); + vm_state_notify(0, state); qemu_aio_flush(); bdrv_flush_all(); monitor_protocol_event(QEVENT_STOP, NULL); @@ -878,10 +878,10 @@ void cpu_stop_current(void) } } -void vm_stop(int reason) +void vm_stop(RunState state) { if (!qemu_thread_is_self(&io_thread)) { - qemu_system_vmstop_request(reason); + qemu_system_vmstop_request(state); /* * FIXME: should not return to device code in case * vm_stop() has been requested. @@ -889,7 +889,7 @@ void vm_stop(int reason) cpu_stop_current(); return; } - do_vm_stop(reason); + do_vm_stop(state); } static int tcg_cpu_exec(CPUState *env) -- cgit v1.2.1