[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/11] QMP: Introduce asynchronous events infrastruc
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 06/11] QMP: Introduce asynchronous events infrastructure |
Date: |
Tue, 23 Jun 2009 01:29:11 -0300 |
It is just an exported function that will be used by other subsystems
to print specific events to the output buffer.
This is based in ideas by Amit Shah <address@hidden>.
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 18 ++++++++++++++++++
monitor.h | 6 ++++++
qemu-tool.c | 4 ++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index 462f60b..df58bdd 100644
--- a/monitor.c
+++ b/monitor.c
@@ -266,6 +266,24 @@ void monitor_printf_data(Monitor *mon, const char *fmt,
...)
va_end(ap);
}
+/* Asynchronous events main function */
+void monitor_notify_event(MonitorEvent event)
+{
+ if (!monitor_ctrl_mode(cur_mon))
+ return;
+
+ assert(event < EVENT_MAX);
+ monitor_puts(cur_mon, "* EVENT ");
+
+ switch (event) {
+ case EVENT_MAX:
+ // Avoid gcc warning, will never get here
+ break;
+ }
+
+ monitor_puts(cur_mon, "\n");
+}
+
static int compare_cmd(const char *name, const char *list)
{
const char *p, *pstart;
diff --git a/monitor.h b/monitor.h
index 8b054eb..7cc88cc 100644
--- a/monitor.h
+++ b/monitor.h
@@ -12,6 +12,11 @@ extern Monitor *cur_mon;
#define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04
+/* QMP events */
+typedef enum MonitorEvent {
+ EVENT_MAX,
+} MonitorEvent;
+
void monitor_init(CharDriverState *chr, int flags);
int monitor_suspend(Monitor *mon);
@@ -28,6 +33,7 @@ void monitor_printf_bad(Monitor *mon, const char *fmt, ...);
void monitor_printf_err(Monitor *mon, const char *fmt, ...);
void monitor_printf_data(Monitor *mon, const char *fmt, ...);
void monitor_print_filename(Monitor *mon, const char *filename);
+void monitor_notify_event(MonitorEvent event);
void monitor_flush(Monitor *mon);
#endif /* !MONITOR_H */
diff --git a/qemu-tool.c b/qemu-tool.c
index 2ba9983..4798665 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -40,6 +40,10 @@ void monitor_print_filename(Monitor *mon, const char
*filename)
{
}
+void monitor_notify_event(MonitorEvent event)
+{
+}
+
void monitor_printf_bad(Monitor *mon, const char *fmt, ...)
{
}
--
1.6.3.GIT
- [Qemu-devel] [PATCH 06/11] QMP: Introduce asynchronous events infrastructure,
Luiz Capitulino <=