From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxpPX-0001Mg-DE for qemu-devel@nongnu.org; Tue, 13 Oct 2009 18:00:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxpPT-0001KW-S5 for qemu-devel@nongnu.org; Tue, 13 Oct 2009 18:00:03 -0400 Received: from [199.232.76.173] (port=54593 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxpPT-0001KT-Ov for qemu-devel@nongnu.org; Tue, 13 Oct 2009 17:59:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50690) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxpPT-0006iz-9n for qemu-devel@nongnu.org; Tue, 13 Oct 2009 17:59:59 -0400 Subject: Re: [Qemu-devel] [PATCH 5/9] monitor: QError support References: <1255453026-18637-1-git-send-email-lcapitulino@redhat.com> <1255453026-18637-6-git-send-email-lcapitulino@redhat.com> From: Markus Armbruster Date: Tue, 13 Oct 2009 23:59:56 +0200 In-Reply-To: <1255453026-18637-6-git-send-email-lcapitulino@redhat.com> (Luiz Capitulino's message of "Tue\, 13 Oct 2009 13\:57\:02 -0300") Message-ID: <87eip7550j.fsf@pike.pond.sub.org> 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 paves the way for QError support in the Monitor, > it adds a QError member to the Monitor struct and functions > to check and print it. > > Additionally, it introduces qemu_error_structed() which should > be used by functions that are called by monitor handlers and > print error information. > > This new function has to be used in place of qemu_error(), which > will become private when all the conversion is done. > > Basically, the Monitor's error flow is something like this: > > 1. An error happens in the handler, it calls qemu_error_structed() > 2. qemu_error_structed() builds the right QObjects with the error > information and stores them 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 896916f..02247fe 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 > @@ -70,6 +71,7 @@ int qemu_loadvm_state(QEMUFile *f); > void qemu_errors_to_file(FILE *fp); > void qemu_errors_to_mon(Monitor *mon); > void qemu_errors_to_previous(void); > +void qemu_error_structed(QErrorCode code, const char *fmt, ...); Needs __attribute__((format(printf, 2, 3))). > void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); > > #ifdef _WIN32