From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIPSk-0006AV-AW for qemu-devel@nongnu.org; Thu, 23 Jul 2015 18:59:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIPSh-0000JK-3E for qemu-devel@nongnu.org; Thu, 23 Jul 2015 18:59:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIPSg-0000Iy-RS for qemu-devel@nongnu.org; Thu, 23 Jul 2015 18:59:35 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-43-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B171D0.1060509@redhat.com> Date: Thu, 23 Jul 2015 16:59:28 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-43-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VXPKA6SlgPxBaqDMuiFO3vlhakntwn1xf" Subject: Re: [Qemu-devel] [PATCH RFC v2 42/47] qapi-schema: Fix up misleading specification of netdev_add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VXPKA6SlgPxBaqDMuiFO3vlhakntwn1xf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, Markus Armbruster wrote: > It doesn't take a 'props' argument, let alone one in the format > "NAME=3DVALUE,..." >=20 > The bogus arguments specification doesn't matter due to 'gen': false. > Clean it up to be incomplete rather than wrong, and document the > incompleteness. >=20 > Signed-off-by: Markus Armbruster > --- > docs/qapi-code-gen.txt | 2 +- > qapi-schema.json | 13 +++++++------ > 2 files changed, 8 insertions(+), 7 deletions(-) >=20 > +++ b/qapi-schema.json > @@ -2062,11 +2062,12 @@ > # > # @id: the name of the new network backend > # > -# @props: #optional a list of properties to be passed to the backend i= n > -# the format 'name=3Dvalue', like 'ifname=3Dtap0,script=3Dno' > +# Additional arguments depend on the type. In other words, this would be a perfect candidate to write as taking a flat union as the argument, where 'type' is the discriminator, and where the additional arguments are branches of the union. Except that we don't yet support passing a union as the direct "arguments":{...} of a QMP call, so we still have some design work to do if we want to go there. Later, of course. > # > -# Notes: The semantics of @props is not well defined. Future commands= will be > -# introduced that provide stronger typing for backend creation.= > +# TODO This command effectively bypasses QAPI completely due to its > +# "additional arguments" business. It shouldn't have been added to > +# the schema in this form. It should be qapified properly, or > +# replaced by a properly qapified command. I like that you are getting rid of the sentence about strong typing (since flat unions ARE strongly typed) and instead couching it in terms of an incomplete qapi description. I think we may even be able to come up with a way to express it without needing a new command, and without breaking back-compat, once we figure out how to pass unions as a command argument. In fact, let's suppose we do have a new union type, NetdevInfo, as well as a way to flag that a given command will be called by the marshaler using JUST a pointer to the struct, rather than as a list of parameters to members of the struct. { 'enum': 'NetdevTypes', [ ... ] } { 'struct': 'NetdevInfoBase', 'data': { 'type': 'NetdevTypes', 'id': 'str' } } { 'union': 'NetdevInfo', 'base': 'NetdevInfoBase', 'discriminator': 'type', 'data': { ... } } { 'command': 'netdev_add', 'boxed': true, 'data': 'NetdevInfo' } resulting in the marshaller calling void qmp_netdev_add(NetdevInfo *data, Error **errp) Here, 'boxed' is an optional key to each 'command', defaulting to false; but when true, 'data' is passed in a box to the command called by the marshaler, instead of broken out into fields. 'boxed' must be true for unions, but may be true elsewhere. And if we have that, then OTHER commands that have complained about super-long parameter lists when their struct is exploded into a parameter list could also use this mechanism, to write their handler in terms of a single pointer to the struct. Enough rambling about stuff for the future. This patch is fine as-is; Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --VXPKA6SlgPxBaqDMuiFO3vlhakntwn1xf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVsXHQAAoJEKeha0olJ0NqFKcH/2CrvJNjzetoex4jOo/LInEW M4WqOqVprNz3nwY6T6RN3ktJCuV4/IB34KZJkfVyRcGGbX+H/sulvnZgXjP4KPx5 FBLCoZXJ/pKQ9fqdBwiZYyLhylO1AkzTUpIAxJw5zlEGkXG/DYPCO2LxqFR5sYji LTpXM8sCbM9cStvgpJHKx5vjRSepeMEEM+UEMF1/x+xOLp7kZr5Ztdb3YRDNEo4e WFGF48z7cw2Zd+9IP7L4XvKK0KBS2Q0OJZRjA0YAZRznYt3jd2pKyzoFIA2TrEdZ K77n+HAncclOgqsp2DeUV9lhh6ZoffaJufVLPu/GyijzMGuYQuPrNX0rdx56Lsc= =cQNr -----END PGP SIGNATURE----- --VXPKA6SlgPxBaqDMuiFO3vlhakntwn1xf--