From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxGBG-0005Oe-Mg for qemu-devel@nongnu.org; Thu, 11 Jul 2013 08:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UxGBF-0004dq-E0 for qemu-devel@nongnu.org; Thu, 11 Jul 2013 08:41:06 -0400 Received: from qmta02.emeryville.ca.mail.comcast.net ([76.96.30.24]:59798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxGBF-0004de-31 for qemu-devel@nongnu.org; Thu, 11 Jul 2013 08:41:05 -0400 Message-ID: <51DEA7DD.1030301@redhat.com> Date: Thu, 11 Jul 2013 06:41:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1373363617-4723-1-git-send-email-kwolf@redhat.com> <1373363617-4723-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1373363617-4723-6-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2PICSFQMEKBKLEOPWNQLM" Subject: Re: [Qemu-devel] [RFC PATCH 05/11] qapi: Add visitor for implicit structs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2PICSFQMEKBKLEOPWNQLM Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/09/2013 03:53 AM, Kevin Wolf wrote: > These can be used when an embedded struct is parsed and members not > belonging to the struct may be present in the input (parsing flat > namespect QMP union with discriminator) namespect? Not sure if you meant 'namespaced'? Again, a comment demonstrating in sample QMP on what this is attempting would be helpful in the commit message. Without looking at later patches yet, I'm guessing from your description that your intent is to reach a point where: { 'type': 'Extra1', 'data': { 'foo': 'str' } } { 'type': 'Extra2', 'data': { 'bar': 'str' } } { 'union': 'Type', 'data': { 'variant1': 'Extra1', 'variant2': 'Extra2' } } { 'command': 'test', 'data': { 'arg': 'Type' } } which currently requires this over the wire: { "execute": "test", "arguments": { "arg": { "type": "variant1", "data": { "foo": "hello" } } } } can be shortened to: { "execute": "test", "arguments": { "arg": { "type": "variant1", "foo": "hello" } } } by allowing the struct passed as "arg" to inline the contents of the union rather than require another nesting level through "data". This patch sets up the entry points so that a future patch can parse the struct of arg as an implicit struct, and not choke over the key "foo", instead of the current visitor of a union type that expects exactly the two keys "type" and "data". >=20 > Signed-off-by: Kevin Wolf > --- > include/qapi/visitor-impl.h | 4 ++++ > include/qapi/visitor.h | 3 +++ > qapi/qapi-visit-core.c | 16 ++++++++++++++++ > qapi/qmp-input-visitor.c | 14 ++++++++++++++ > 4 files changed, 37 insertions(+) Although the commit message left me floundering, the code itself seems reasonable - you are just adding two new entry points to allow a new type of parse. It remains to later patches to see how the new parsers are useful, but that doesn't stop me from giving: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2PICSFQMEKBKLEOPWNQLM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR3qfdAAoJEKeha0olJ0NqTFMH/j0O1DW/e5fAdf62g0sbNVrs UxPTgeSny3WlgRy3Q5pXeD5B9icVRjppS563iKvoaXsk19iSVHaTe8JdsKftPHh2 3g3caumndafQjku7AHdTiIXgFEq54InHdph+8Lqi2ZlpXquFxwcrdZr01Fki2jnc p0KJ8aDzP4T6QNzyO4ixvIYHuUDO5ikUwAJ2d+XUZX0DWn39dDYt+vK0WaCF3Am6 PcU86V0e99drfRXXIox2XXn3aR76pnOdpx0jXM70qeZYLr4dUxexwVpFk+g4qdrt s2i9ZcVQfER7vpx9bAfPlFnQPvRej3c2ZHkV7YUCubNdbpWle3eGTt9dvheDwzY= =gKIv -----END PGP SIGNATURE----- ------enig2PICSFQMEKBKLEOPWNQLM--