[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 06/11] QMP: Introduce asynchronous events infras
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] Re: [PATCH 06/11] QMP: Introduce asynchronous events infrastructure |
Date: |
Tue, 23 Jun 2009 10:59:27 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
Luiz Capitulino wrote:
> 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");
> +}
> +
You shouldn't use cur_mon here. It's for legacy code that still assumes
there can be only one monitor terminal. Instead, iterate over all
monitors and distribute the event to those that are in control mode.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux