From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIxdL-00080w-GS for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:29:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIxdG-0007zi-Ky for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:29:22 -0400 Received: from [199.232.76.173] (port=35683 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIxdG-0007zZ-GS for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:29:18 -0400 Received: from mx2.redhat.com ([66.187.237.31]:32815) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MIxdG-0003Dg-0L for qemu-devel@nongnu.org; Tue, 23 Jun 2009 00:29:18 -0400 Date: Tue, 23 Jun 2009 01:29:11 -0300 From: Luiz Capitulino Message-ID: <20090623012911.16b8c4d5@doriath> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 06/11] QMP: Introduce asynchronous events infrastructure 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 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 . Signed-off-by: Luiz Capitulino --- 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