From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIxe3-0008Dp-1e for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:30:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIxdy-0008Bt-E6 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:30:06 -0400 Received: from [199.232.76.173] (port=35694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIxdy-0008Bp-64 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:30:02 -0400 Received: from mx2.redhat.com ([66.187.237.31]:32838) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MIxdx-0003KQ-Ml for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:30:02 -0400 Date: Tue, 23 Jun 2009 01:29:55 -0300 From: Luiz Capitulino Message-ID: <20090623012955.2d152759@doriath> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 10/11] QMP: Introduce basic events List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, ehabkost@redhat.com, jan.kiszka@siemens.com, dlaor@redhat.com, avi@redhat.com Reboot, shutdown and powerdown are very basic events and can be added together. Signed-off-by: Luiz Capitulino --- monitor.c | 9 +++++++++ monitor.h | 3 +++ vl.c | 3 +++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/monitor.c b/monitor.c index 378a3ae..7ebf0ea 100644 --- a/monitor.c +++ b/monitor.c @@ -276,6 +276,15 @@ void monitor_notify_event(MonitorEvent event) monitor_puts(cur_mon, "* EVENT "); switch (event) { + case EVENT_REBOOT: + monitor_puts(cur_mon, "reboot"); + break; + case EVENT_SHUTDOWN: + monitor_puts(cur_mon, "shutdown"); + break; + case EVENT_POWERDOWN: + monitor_puts(cur_mon, "powerdown"); + break; case EVENT_MAX: // Avoid gcc warning, will never get here break; diff --git a/monitor.h b/monitor.h index 7cc88cc..579b80b 100644 --- a/monitor.h +++ b/monitor.h @@ -14,6 +14,9 @@ extern Monitor *cur_mon; /* QMP events */ typedef enum MonitorEvent { + EVENT_REBOOT, + EVENT_SHUTDOWN, + EVENT_POWERDOWN, EVENT_MAX, } MonitorEvent; diff --git a/vl.c b/vl.c index 60a00e1..7dc5954 100644 --- a/vl.c +++ b/vl.c @@ -3693,18 +3693,21 @@ void qemu_system_reset_request(void) reset_requested = 1; } qemu_notify_event(); + monitor_notify_event(EVENT_REBOOT); } void qemu_system_shutdown_request(void) { shutdown_requested = 1; qemu_notify_event(); + monitor_notify_event(EVENT_SHUTDOWN); } void qemu_system_powerdown_request(void) { powerdown_requested = 1; qemu_notify_event(); + monitor_notify_event(EVENT_POWERDOWN); } #ifdef CONFIG_IOTHREAD -- 1.6.3.GIT