From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9jns-0007kh-H2 for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9jnr-0008DL-6k for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9jnq-0008DD-Vz for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:27 -0400 From: Luiz Capitulino Date: Fri, 30 Sep 2011 17:34:41 -0300 Message-Id: <1317414891-4042-17-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317414891-4042-1-git-send-email-lcapitulino@redhat.com> References: <1317414891-4042-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 16/26] vl: Change qemu_vmstop_requested() to return a bool List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com 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 --- vl.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index bd4a5ce..4db58bd 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); } } -- 1.7.7.rc0.72.g4b5ea