From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDKJF-0007rL-Rv for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:43:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDKJA-0007ol-Rp for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:42:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDKJA-0007mU-K2 for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:42:52 -0400 Date: Thu, 29 Mar 2012 15:42:34 -0300 From: Luiz Capitulino Message-ID: <20120329154234.13c18fbe@doriath.home> In-Reply-To: <4F74A95A.7050403@us.ibm.com> References: <1333042003-15490-1-git-send-email-lcapitulino@redhat.com> <1333042003-15490-13-git-send-email-lcapitulino@redhat.com> <4F74A95A.7050403@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 12/13] qapi: support for keyworded variable-length argument list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, kraxel@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On Thu, 29 Mar 2012 13:26:34 -0500 Anthony Liguori wrote: > On 03/29/2012 12:26 PM, Luiz Capitulino wrote: > > This allows for QAPI functions to receive a variable-length argument > > list. This is going to be used by device_add and netdev_add commands. > > > > In the schema, the argument list is represented by type name '**', > > like this example: > > > > { 'command': 'foo', 'data': { 'arg-list': '**' } } > > > > Each argument is represented by the KeyValues type and the C > > implementation should expect a KeyValuesList, like: > > > > void qmp_foo(KeyValuesList *values_list, Error **errp); > > > > XXX: This implementation is simple but very hacky. We just iterate > > through all arguments and build the KeyValuesList list to be > > passed to the QAPI function. > > > > Maybe we could have a kwargs type, that does exactly this but > > through a visitor instead? > > > > Signed-off-by: Luiz Capitulino > > What about just treating '**' as "marshal remaining arguments to a string" and > then pass that string to device_add? qmp_device_add can then parse that string > with QemuOpts. If this turns out to be simple enough, I'm fine with it. > It's a bit ugly, but that's how things worked. When we introduce qom_add, this > problem goes away because you would make multiple calls to qom_set to set all of > the properties. Just out of curiosity, is qom_add going to supersede device_add?