aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-07-29 14:26:33 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2011-09-15 16:39:32 -0300
commit1dfb4dd993f7122353fb2894f09dfcba894cd7d5 (patch)
tree72559b694b482e5b0dc1f77faf96aa31d3678f64 /cpus.c
parentbff046f86b4f8970c722c3bc3e32173b8000e716 (diff)
downloadqemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.zip
qemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.tar.gz
qemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.tar.bz2
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 <lcapitulino@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cpus.c b/cpus.c
index 54c188c..76a79ac 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)