From patchwork Fri Nov 27 00:59:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 39605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 733C91007D3 for ; Fri, 27 Nov 2009 12:24:54 +1100 (EST) Received: from localhost ([127.0.0.1]:48386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDpZr-0007pn-8l for incoming@patchwork.ozlabs.org; Thu, 26 Nov 2009 20:24:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDpBn-0001vK-8j for qemu-devel@nongnu.org; Thu, 26 Nov 2009 19:59:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDpBi-0001pu-7F for qemu-devel@nongnu.org; Thu, 26 Nov 2009 19:59:58 -0500 Received: from [199.232.76.173] (port=48303 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDpBh-0001pj-QO for qemu-devel@nongnu.org; Thu, 26 Nov 2009 19:59:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19813) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDpBh-0004TJ-9M for qemu-devel@nongnu.org; Thu, 26 Nov 2009 19:59:53 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAR0xq7h007348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 26 Nov 2009 19:59:52 -0500 Received: from localhost (vpn-10-232.rdu.redhat.com [10.11.10.232]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAR0xoqj009470; Thu, 26 Nov 2009 19:59:51 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 26 Nov 2009 22:59:04 -0200 Message-Id: <1259283550-3597-15-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259283550-3597-1-git-send-email-lcapitulino@redhat.com> References: <1259283550-3597-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, avi@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 14/20] QMP: Introduce basic asynchronous events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Debug, shutdown, reset, powerdown and stop are all basic events, as they are very simple they can be added in the same commit. Signed-off-by: Luiz Capitulino --- monitor.c | 15 +++++++++++++++ monitor.h | 5 +++++ vl.c | 11 +++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index a555f12..89115a6 100644 --- a/monitor.c +++ b/monitor.c @@ -342,6 +342,21 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) return; switch (event) { + case EVENT_DEBUG: + event_name = "DEBUG"; + break; + case EVENT_SHUTDOWN: + event_name = "SHUTDOWN"; + break; + case EVENT_RESET: + event_name = "RESET"; + break; + case EVENT_POWERDOWN: + event_name = "POWERDOWN"; + break; + case EVENT_STOP: + event_name = "STOP"; + break; default: abort(); break; diff --git a/monitor.h b/monitor.h index a1d8b7a..851fd33 100644 --- a/monitor.h +++ b/monitor.h @@ -15,6 +15,11 @@ extern Monitor *cur_mon; /* QMP events */ typedef enum MonitorEvent { + EVENT_DEBUG, + EVENT_SHUTDOWN, + EVENT_RESET, + EVENT_POWERDOWN, + EVENT_STOP, EVENT_MAX, } MonitorEvent; diff --git a/vl.c b/vl.c index dd9b74b..6c709d0 100644 --- a/vl.c +++ b/vl.c @@ -4110,9 +4110,12 @@ static void main_loop(void) #endif } while (vm_can_run()); - if (qemu_debug_requested()) + if (qemu_debug_requested()) { + monitor_protocol_event(EVENT_DEBUG, NULL); vm_stop(EXCP_DEBUG); + } if (qemu_shutdown_requested()) { + monitor_protocol_event(EVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(0); no_shutdown = 0; @@ -4120,15 +4123,19 @@ static void main_loop(void) break; } if (qemu_reset_requested()) { + monitor_protocol_event(EVENT_RESET, NULL); pause_all_vcpus(); qemu_system_reset(); resume_all_vcpus(); } if (qemu_powerdown_requested()) { + monitor_protocol_event(EVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } - if ((r = qemu_vmstop_requested())) + if ((r = qemu_vmstop_requested())) { + monitor_protocol_event(EVENT_STOP, NULL); vm_stop(r); + } } pause_all_vcpus(); }