From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8bZK-0005No-0D for qemu-devel@nongnu.org; Thu, 12 Nov 2009 10:26:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8bZE-0005GG-KD for qemu-devel@nongnu.org; Thu, 12 Nov 2009 10:26:41 -0500 Received: from [199.232.76.173] (port=41373 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8bZD-0005Fu-LG for qemu-devel@nongnu.org; Thu, 12 Nov 2009 10:26:36 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]:56857) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N8bZD-0003xD-CV for qemu-devel@nongnu.org; Thu, 12 Nov 2009 10:26:35 -0500 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e5.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id nACFG3uh001115 for ; Thu, 12 Nov 2009 10:16:03 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nACFQYSR055602 for ; Thu, 12 Nov 2009 10:26:34 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAC5Nmw4010089 for ; Thu, 12 Nov 2009 00:23:49 -0500 Message-ID: <4AFC2927.4040605@linux.vnet.ibm.com> Date: Thu, 12 Nov 2009 09:26:31 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [RFC 0/8]: QError v2 References: <1257365047-25895-1-git-send-email-lcapitulino@redhat.com> <4AFB2A9E.9050309@codemonkey.ws> <20091112114108.4cca3405@doriath> <4AFC1F33.4060405@linux.vnet.ibm.com> <20091112131051.13d2fda7@doriath> In-Reply-To: <20091112131051.13d2fda7@doriath> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: pbonzini@redhat.com, hollisb@linux.vnet.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com Luiz Capitulino wrote: > On Thu, 12 Nov 2009 08:44:03 -0600 > Anthony Liguori wrote: > > >> Luiz Capitulino wrote: >> >>>> #define QERR_DEVICE_ALREADY_OPEN "{'class': 'DeviceAlreadyOpen', 'data' >>>> : {'bus_num': %d, 'addr': %d}" >>>> >>>> qemu_error_new(QERR_DEVICE_ALREADY_OPEN, bus_num, addr); >>>> >>>> >>> What about DeviceAlreadyOpen errors with a different argument list? >>> >>> >> Why would you have this? That would seem like a problem to me. I think >> the errors need to be very well structured (just like everything else in >> QMP). >> > > This can happen with errors that carry specific info which are different > among subsystems, eg. USB device info vs. PCI device info. > This example demonstrates the problem with this. You haven't included enough information in the error to properly distinguish what happened. I would suggest changing to: 'data' : { 'device_type' : %s, 'addr': %s } qemu_error_new(QERR_DEVICE_ALREADY_OPEN, "pci", addr); Or, if you really wanted to get fancy: 'data' : { 'device_type': %s, 'addr': %p } qemu_error_new(QERR_DEVICE_ALREADY_OPEN, "pci", qobject_from_jsonf("{'bus': %d, 'slot': %d, 'function': %d}", bus, dev, fn)); Personally, I'd stick with the first one though. -- Regards, Anthony Liguori