qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 08/10] monitor: QError support


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 08/10] monitor: QError support
Date: Wed, 18 Nov 2009 16:16:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Luiz Capitulino <address@hidden> writes:

> This commit adds QError support in the Monitor.
>
> A QError member is added to the Monitor struct. This new member
> stores error information and is also used to check if an error
> has occurred when the called handler returns.
>
> Additionally, a new macro called qemu_error_new() is introduced.
> It builds on top of the QemuErrorSink API and should be used in
> place of qemu_error().
>
> When all conversion to qemu_error_new() is done, qemu_error() can
> be turned private.
>
> Basically, Monitor's error flow is something like this:
>
> 1. An error occurs in the handler, it calls qemu_error_new()
> 2. qemu_error_new() builds a new QError object and stores it in
>    the Monitor struct
> 3. The handler returns
> 4. Top level Monitor code checks the Monitor struct and calls
>    qerror_print() to print the error
[...]
> diff --git a/sysemu.h b/sysemu.h
> index b1887ef..656f6a4 100644
> --- a/sysemu.h
> +++ b/sysemu.h
> @@ -7,6 +7,7 @@
>  #include "qemu-queue.h"
>  #include "qemu-timer.h"
>  #include "qdict.h"
> +#include "qerror.h"
>  
>  #ifdef _WIN32
>  #include <windows.h>
> @@ -71,6 +72,11 @@ void qemu_errors_to_file(FILE *fp);
>  void qemu_errors_to_mon(Monitor *mon);
>  void qemu_errors_to_previous(void);
>  void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
> +void qemu_error_full(const char *file, int linenr, const char *fmt, ...)
> +                     __attribute__ ((format(printf, 3, 4)));
> +
> +#define qemu_error_new(fmt, ...) \
> +    qemu_error_full(__FILE__, __LINE__, fmt, ## __VA_ARGS__)
>  
>  #ifdef _WIN32
>  /* Polling handling */

The relationship between qemu_error_new() and qemu_error_full() is not
obvious from their names.  What about calling the latter
qemu_error_new_internal()?




reply via email to

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