On Wed, 18 Nov 2009 16:16:40 +0100 Markus Armbruster <arm...@redhat.com> wrote:
> Luiz Capitulino <lcapitul...@redhat.com> 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()? Okay, as I'm going to post a new version anyway.