From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAoLk-0006IV-GJ for qemu-devel@nongnu.org; Wed, 18 Nov 2009 12:29:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAoLf-0006G8-Pc for qemu-devel@nongnu.org; Wed, 18 Nov 2009 12:29:48 -0500 Received: from [199.232.76.173] (port=36201 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAoLf-0006G5-L4 for qemu-devel@nongnu.org; Wed, 18 Nov 2009 12:29:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46838) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAoLe-0006qq-T8 for qemu-devel@nongnu.org; Wed, 18 Nov 2009 12:29:43 -0500 Date: Wed, 18 Nov 2009 15:29:34 -0200 From: Luiz Capitulino Subject: Re: [Qemu-devel] [PATCH 08/10] monitor: QError support Message-ID: <20091118152934.36cb6514@doriath> In-Reply-To: References: <1258487037-24950-1-git-send-email-lcapitulino@redhat.com> <1258487037-24950-9-git-send-email-lcapitulino@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com On Wed, 18 Nov 2009 16:16:40 +0100 Markus Armbruster wrote: > Luiz Capitulino 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 > > @@ -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.