Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3ZxQ-0004wl-Jm for qemu-devel@nongnu.org; Thu, 29 Oct 2009 14:42:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3ZxM-0004vH-31 for qemu-devel@nongnu.org; Thu, 29 Oct 2009 14:42:48 -0400 Received: from [199.232.76.173] (port=39759 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3ZxL-0004vD-Tu for qemu-devel@nongnu.org; Thu, 29 Oct 2009 14:42:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16086) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N3ZxK-0008Ls-QM for qemu-devel@nongnu.org; Thu, 29 Oct 2009 14:42:43 -0400 From: Luiz Capitulino Date: Thu, 29 Oct 2009 16:42:23 -0200 Message-Id: <1256841750-15228-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [RFC 0/7] QError v1 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, aliguori@us.ibm.com, kraxel@redhat.com, hollisb@us.ibm.com Hi there, This is a new version of the QError framework. I've been through the last QError thread and tried to collect the best suggestions. The important changes are: - Dropped the .user_print function - Added Paolo's suggestion on having a printf-like format for 'desc' - Line number and filename are also stored in the QError object - Uses QJSon Now, a call like: monitor_printf(mon, "husb: host usb device %d.%d is already open\n", bus_num, addr); Would become: qemu_error_structed("{ 'bus_num': %d, 'addr': %d }", bus_num, addr); Its error table entry should be: { .code = QERR_USB_EOPEN, .desc = "husb: host usb device %(bus_num)d.%(addr)d is already open", } Finally, on the wire we'd have: { "error": { "code": 45, "data": { "bus_num": 1, "addr": 0xff } } } As the previous version, qemu_error_structed() builds on top of Gerd's QemuErrorSink API. Besides introducing QError, this series also has simple usage examples for qdev_device_add() and do_info_balloon(). A last note: this series is on top of the (to be merged) QJSon module, that's why it's a RFC and.. I didn't test it too much. :) Thanks.