Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAmH2-0000f1-4v for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:16:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAmGx-0000cg-HS for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:16:47 -0500 Received: from [199.232.76.173] (port=56651 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAmGx-0000cb-DR for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:16:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48517) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAmGw-0005zS-S2 for qemu-devel@nongnu.org; Wed, 18 Nov 2009 10:16:43 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 08/10] monitor: QError support References: <1258487037-24950-1-git-send-email-lcapitulino@redhat.com> <1258487037-24950-9-git-send-email-lcapitulino@redhat.com> Date: Wed, 18 Nov 2009 16:16:40 +0100 In-Reply-To: <1258487037-24950-9-git-send-email-lcapitulino@redhat.com> (Luiz Capitulino's message of "Tue, 17 Nov 2009 17:43:55 -0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com 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()?