From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlidP-0007BA-QL for qemu-devel@nongnu.org; Wed, 27 Nov 2013 12:10:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlidJ-0001LK-Qj for qemu-devel@nongnu.org; Wed, 27 Nov 2013 12:10:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlidJ-0001LF-Cz for qemu-devel@nongnu.org; Wed, 27 Nov 2013 12:10:37 -0500 Message-ID: <52962779.6090305@redhat.com> Date: Wed, 27 Nov 2013 18:10:17 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385001528-12003-1-git-send-email-imammedo@redhat.com> <1385001528-12003-6-git-send-email-imammedo@redhat.com> <87r4aaxdqt.fsf@blackfin.pond.sub.org> <20131125163642.4d832fd5@nial.usersys.redhat.com> <20131125160337.GB10326@redhat.com> <52937BA2.6020605@redhat.com> <52937E44.10503@redhat.com> <874n6y7wyc.fsf@blackfin.pond.sub.org> <52960D10.8010506@redhat.com> <8761rdye0m.fsf@blackfin.pond.sub.org> In-Reply-To: <8761rdye0m.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: peter.maydell@linaro.org, stefanha@redhat.com, "Michael S. Tsirkin" , hutao@cn.fujitsu.com, quintela@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, stefanb@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, vasilis.liaskovitis@profitbricks.com, kraxel@redhat.com, aliguori@amazon.com, Igor Mammedov , marcel.a@redhat.com, lcapitulino@redhat.com, chegu_vinod@hp.com, afaerber@suse.de Il 27/11/2013 18:02, Markus Armbruster ha scritto: > I have to admit I can't tell offhand what the heck QMP's netdev_add > accepts, because I don't understand what "'*props:': '**'" means in > qapi-schema.json. Even today, we permit code to serve as documentation > and specification for new features. I wish we didn't. It is ignored, because qmp_netdev_add does not use an automatically-generated unmarshaler. > Anyway, whatever it parses ends up in a QDict, as usual. The QDict comes straight from the monitor dispatch. It is the QDict that ordinarily would be unmarshaled by automatically-generated code. > The part that sucks is the use of QemuOpts as netdev_add() parameter, > > It made some sense when it was done, because then the command line was > the only user, its data type for option parameters was (and is) > QemuOpts, and QemuOpts was the least inconvenient way to do a function > that wants a a discriminated union of parameters, like netdev_add does. > > It stopped making sense when we started using it from QMP, whose data > type for parameters is QDict. I shoehorned netdev_add into QMP in its > early days. Hinsight 20/20... Yes. > In my opinion, use of QemuOpts for anything but parsing parameter > strings has become a mistake. Yes. OTOH QemuOpts is the only reason why QMP and HMP can use a common back-end (netdev_add). With object-add you don't use QemuOpts (for good reasons: you want to separate the human-oriented parsing and the JSON-oriented parsing) and thus you need separate code for QMP and HMP---at least for now. The HMP code can use QemuOpts just like vl.c. The QMP code would use qdict_iter or qdict_first/next and call object_set_property for each element of the dictionary. > Laszlo converted net.c to saner internal interfaces (commit > d195325..1a0c095). Perhaps we can build on that. Yeah, that could be an idea. Another is to convert netdevs to QOM (reusing Laszlo's data structures of course) and then just use object-add and -object. Paolo