qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 10/11] QMP: Introduce basic events


From: Luiz Capitulino
Subject: [Qemu-devel] [PATCH 10/11] QMP: Introduce basic events
Date: Tue, 23 Jun 2009 01:29:55 -0300

Reboot, shutdown and powerdown are very basic events and can be
added together.

Signed-off-by: Luiz Capitulino <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]