From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yczd6-0003v0-56 for qemu-devel@nongnu.org; Tue, 31 Mar 2015 13:07:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yczd0-0007wq-SC for qemu-devel@nongnu.org; Tue, 31 Mar 2015 13:07:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yczd0-0007wj-Kn for qemu-devel@nongnu.org; Tue, 31 Mar 2015 13:07:02 -0400 Message-ID: <551AD434.8070203@redhat.com> Date: Tue, 31 Mar 2015 11:07:00 -0600 From: Eric Blake MIME-Version: 1.0 References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-2-git-send-email-eblake@redhat.com> <20150331150958.GB4748@noname.redhat.com> In-Reply-To: <20150331150958.GB4748@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="V3o2V7NLvV4lsI5I9T6BQgldGfhRVJ94p" Subject: Re: [Qemu-devel] [PATCH v5 01/28] qapi: Document type-safety considerations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: armbru@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --V3o2V7NLvV4lsI5I9T6BQgldGfhRVJ94p Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/31/2015 09:09 AM, Kevin Wolf wrote: > Am 24.03.2015 um 21:03 hat Eric Blake geschrieben: >> Go into more details about the various types of valid expressions >> in a qapi schema, including tweaks to document fixes being done >> later in the current patch series. Also fix some stale and missing >> documentation in the QMP specification. >> >> Signed-off-by: Eric Blake >> +A flat union definition specifies a complex type as its base, and >> +avoids nesting on the wire. In this case, the fields of the complex >> +type are included as top-level fields of the union dictionary in the >> +QMP wire format, and the 'discriminator' field must be the name of an= >> +enum-typed member of the base type. An example definition is: >=20 > Adding full context: >=20 > { 'type': 'BlockdevCommonOptions', 'data': { 'readonly': 'bool' } = } > { 'union': 'BlockdevOptions', > 'base': 'BlockdevCommonOptions', > 'data': { 'raw': 'RawOptions', > 'qcow2': 'Qcow2Options' } } Oh, yikes. I even outlawed this type of "simple union with base class" later in the series, since no one was using it, and since it gets in the way of my desire to move towards "simple union with type-safe enum branching". I'll have to revisit that text and document an actual flat union in v6. >=20 > And it looks like this on the wire: >=20 > { "type": "qcow2", > "readonly": false, > "data" : { "backing-file": "/some/place/my-image", > "lazy-refcounts": true } } >=20 > This is not a flat union for me, but really a simple one with an added > base. Correct - it is a bad example. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --V3o2V7NLvV4lsI5I9T6BQgldGfhRVJ94p 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVGtQ0AAoJEKeha0olJ0NqHTQH/118Op0N31ia/Up2DQAsEVd/ gswC8a7dinZLtCBxEOLGq7zMYNpsC2OJqIhuMH/X50vHWzDkDPWDXLCjXqRLU3qJ h3UR3kusYNuhOOaHAfRCOobc8Hh+ExsV5gWXOjcfALvZiccRPFGPVkNVHGsaVUhE jb/8xRGnvBsFCiLLLTlqgTm8CH+rnssHilnArBB98dQcMbmldDmU0kwfzOV60Irs YNzmzSqWCUgePaN0HNBsEmvd0SBSkyrPw/0EJnEnObqAzb654tF/JBG7YmK9x2u1 zZcf3C81Zt7/KkoQq5GpHW5aVXNTMTTz0+iRtkNI1EC0beZFIsnDZN5W0gf4o2k= =oQDQ -----END PGP SIGNATURE----- --V3o2V7NLvV4lsI5I9T6BQgldGfhRVJ94p--