summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-09-30 14:27:11 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2011-10-04 11:02:57 -0300
commit0d45b702918f855c24bfd13c0f91b31f89c2e097 (patch)
treea69f9d62927ea4c154a324bce912a2ed89c0429d
parent292a26027c8567556795dde771e46d87306bd013 (diff)
downloadfocaccia-qemu-0d45b702918f855c24bfd13c0f91b31f89c2e097.tar.gz
focaccia-qemu-0d45b702918f855c24bfd13c0f91b31f89c2e097.zip
vl: Change qemu_vmstop_requested() to return a bool
The stop reason is returned in the RunState argument. This is a
preparation for a future commit which will convert the query-status
command to the QAPI.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--vl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index bd4a5ce8a2..4db58bd976 100644
--- a/vl.c
+++ b/vl.c
@@ -1350,11 +1350,15 @@ static int qemu_debug_requested(void)
     return r;
 }
 
-static RunState qemu_vmstop_requested(void)
+static bool qemu_vmstop_requested(RunState *r)
 {
-    RunState s = vmstop_requested;
-    vmstop_requested = RSTATE_NO_STATE;
-    return s;
+    if (vmstop_requested != RSTATE_NO_STATE) {
+        *r = vmstop_requested;
+        vmstop_requested = RSTATE_NO_STATE;
+        return true;
+    }
+
+    return false;
 }
 
 void qemu_register_reset(QEMUResetHandler *func, void *opaque)
@@ -1567,7 +1571,7 @@ static void main_loop(void)
 #ifdef CONFIG_PROFILER
     int64_t ti;
 #endif
-    int r;
+    RunState r;
 
     qemu_main_loop_start();
 
@@ -1606,7 +1610,7 @@ static void main_loop(void)
             monitor_protocol_event(QEVENT_POWERDOWN, NULL);
             qemu_irq_raise(qemu_system_powerdown);
         }
-        if ((r = qemu_vmstop_requested())) {
+        if (qemu_vmstop_requested(&r)) {
             vm_stop(r);
         }
     }