From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8auG-0001QW-V0 for qemu-devel@nongnu.org; Thu, 12 Nov 2009 09:44:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8auA-0001Oz-Nk for qemu-devel@nongnu.org; Thu, 12 Nov 2009 09:44:15 -0500 Received: from [199.232.76.173] (port=60216 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8au9-0001Om-Gl for qemu-devel@nongnu.org; Thu, 12 Nov 2009 09:44:09 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:39630) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N8au9-0004KN-7I for qemu-devel@nongnu.org; Thu, 12 Nov 2009 09:44:09 -0500 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e7.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id nACEeAZZ031504 for ; Thu, 12 Nov 2009 09:40:10 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nACEi6IE112092 for ; Thu, 12 Nov 2009 09:44:06 -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 nAC4fLvb007494 for ; Wed, 11 Nov 2009 23:41:22 -0500 Message-ID: <4AFC1F33.4060405@linux.vnet.ibm.com> Date: Thu, 12 Nov 2009 08:44:03 -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> In-Reply-To: <20091112114108.4cca3405@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: Anthony Liguori , qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com, hollisb@linux.vnet.ibm.com 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). >> That gives us a nice simple interface with full error checking on the >> parameters. >> > > I've said this is not so simple because people writing those macros > would find out that the 'class' or 'data' _keys_ are missing or incorrect > only at run-time, when the error is triggered. > Sure but introducing new types of errors is not the common case. Using existing errors is the common case. >> For human readable strings, I'd suggest making a table somewhere else >> that looked like: >> >> QErrorStringTable qerror_descriptions[] = { >> { QERR_DEVICE_ALREADY_OPEN, "This device at %(bus_num)d.%(addr)d is >> already open." }, >> ... >> }; >> > > How do you suggest we lookup the table? Doing a strcmp() on > QERR_DEVICE_ALREADY_OPEN? > We can either change the index on the table to be just the class code or find something more clever. >> There are a number of advantages to an approach like this. The table >> can be reused by both in the server and by a client. >> > > My suggestions on both problems makes me willing go back to my initial > series, which had a table indexed by an error number. > I don't understand why. -- Regards, Anthony Liguori