From patchwork Wed Oct 5 13:22:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 117876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 728BFB6F7C for ; Thu, 6 Oct 2011 01:57:13 +1100 (EST) Received: from localhost ([::1]:59527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRRZ-0005SG-Uk for incoming@patchwork.ozlabs.org; Wed, 05 Oct 2011 09:23:29 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQt-0004BJ-4B for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBRQr-0001ug-9d for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQr-0001td-1q for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:45 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p95DMi9D030804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Oct 2011 09:22:44 -0400 Received: from localhost (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p95DMhDp000698; Wed, 5 Oct 2011 09:22:43 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Wed, 5 Oct 2011 10:22:01 -0300 Message-Id: <1317820931-25872-17-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> References: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 16/26] vl: Change qemu_vmstop_requested() to return a bool X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); } }