From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLuox-0003ka-9Z for qemu-devel@nongnu.org; Wed, 01 Jul 2009 04:05:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLuot-0003kK-Tw for qemu-devel@nongnu.org; Wed, 01 Jul 2009 04:05:35 -0400 Received: from [199.232.76.173] (port=49576 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLuot-0003kH-Ox for qemu-devel@nongnu.org; Wed, 01 Jul 2009 04:05:31 -0400 Received: from mx2.redhat.com ([66.187.237.31]:56007) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLuos-0000sd-Tp for qemu-devel@nongnu.org; Wed, 01 Jul 2009 04:05:31 -0400 Message-ID: <4A4B192A.1040207@redhat.com> Date: Wed, 01 Jul 2009 11:07:06 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file References: <4A412339.5000109@redhat.com> <4A4252DD.70300@redhat.com> <20090624190539.GR14121@shareable.org> <5b31733c0906241224j50baa7e6lc80b8c79c5d6baa7@mail.gmail.com> <20090624211358.GA14121@shareable.org> <4A43768A.2090604@eu.citrix.com> <4A438FDD.5060206@redhat.com> <4A43935D.6000506@codemonkey.ws> <4A4395B8.4010401@redhat.com> <4A43BD5D.80307@codemonkey.ws> <4A43C264.6060803@redhat.com> <4A43D600.8060605@codemonkey.ws> <4A449113.8070907@redhat.com> <4A44CB74.1070808@codemonkey.ws> <4A44E2F3.8050804@codemonkey.ws> <4A476C60.1080609@redhat.com> <4A47A70B.7070806@codemonkey.ws> <4A47A9B4.4050600@redhat.com> <4A480E0F.6030000@codemonkey.ws> <4A485971.1010000@redhat.com> <4A4922AC.4030707@codemonkey.ws> <4A49A482.30908@redhat.com> <4A4A1390.2050602@codemonkey.ws> <4A4A18B4.2070004@redhat.com> <4A4A198A.3050505@codemonkey.ws> <20090630110332.39436ed7@doriath> <4A4A37E6.9090705@red! hat.com> <4A4A57B6.1090702@codemonkey.ws> In-Reply-To: <4A4A57B6.1090702@codemonkey.ws> 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: Anthony Liguori Cc: "ehabkost@redhat.com" , Stefano Stabellini , "jan.kiszka@siemens.com" , "dlaor@redhat.com" , "qemu-devel@nongnu.org" , Luiz Capitulino , Filip Navara , Vincent Hanquez On 06/30/2009 09:21 PM, Anthony Liguori wrote: >> 1. Add QValue, QArray, QDictionary >> >> QValue is a polymorphic object that can be a number, a string, an >> array, or a dictionary. It needs a bunch of accessors like >> qvalue_to_qarray() to check if a value is an array, and things like >> qarray_get() or qdict_put() to manipulate them. For the simpler data >> types, qvalue_to_int64() and qvalue_from_int64() should suffice. > > > And add a return value to the monitor functions. I think this is a > good first step. > > Passing a QArray to each monitor function is one way to go. Another > way to go is to use something like libffi to do proper dynamic > dispatch. The later approach has the benefit of requiring less code > churn and reusing the static type checking. If/when we switch to passing dictionaries instead of arrays, this won't work. I also think libffi is a little to exotic for something like the monitor. You could potentially introduce some serious ninja action by doing something like: > value = qvalue_create("[%s, {'f': %s, 'b': %s', 'c': %d}]", ...); Seriously nifty... -- error compiling committee.c: too many arguments to function