From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKvk7-0002Gc-9K for qemu-devel@nongnu.org; Thu, 30 Jul 2015 17:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKvk4-0004du-3E for qemu-devel@nongnu.org; Thu, 30 Jul 2015 17:51:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKvk3-0004dj-RU for qemu-devel@nongnu.org; Thu, 30 Jul 2015 17:51:56 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-27-git-send-email-armbru@redhat.com> <55B95DAA.3040302@redhat.com> <87oaiu5eox.fsf@blackfin.pond.sub.org> <55BA1CAE.8030405@redhat.com> <87si85y747.fsf@blackfin.pond.sub.org> <55BA528F.5050907@redhat.com> From: Eric Blake Message-ID: <55BA9C75.1020408@redhat.com> Date: Thu, 30 Jul 2015 15:51:49 -0600 MIME-Version: 1.0 In-Reply-To: <55BA528F.5050907@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Vshs9h0mgUm4aJA690qnPQvfmpV8mD3eH" Subject: Re: [Qemu-devel] [PATCH RFC v2 26/47] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Vshs9h0mgUm4aJA690qnPQvfmpV8mD3eH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/30/2015 10:36 AM, Eric Blake wrote: > On 07/30/2015 09:53 AM, Markus Armbruster wrote: >=20 >>> Or, we could ditch the qtypes lookup altogether, and merely create th= e >>> alternate enum as a non-consecutive QTYPE mapping, for one less level= of >>> indirection, as in: >>> >>> typedef enum BlockdevRefKind { >>> BLOCKDEV_REF_DEFINITION =3D QTYPE_QOBJECT, >> >> QTYPE_QDICT, but I get what you mean. >> >>> BLOCKDEV_REF_REFERENCE =3D QTYPE_QSTRING, >>> }; >>> >> Hmm, your new BlockdevRefKind is basically a subset of qtype_code with= >> the members renamed. Could we simply use qtype_code directly? >=20 > We could, except that clients that manipulate the generated struct then= > have to know the qtype mapping directly; while keeping symbolic names > lets them do 'foo->type =3D BLOCKDEV_REF_REFERENCE; foo->reference =3D = xyz;' > as a nice visual indicator of which union member within the struct is > being assigned according to the discriminator. >=20 > I guess I'll see how much code currently manipulates the generated > structs (I already recall from other patches in this series that > blockdev played a bit loose by validating that the QMP was okay and > then using QDict for everything else rather than the generated struct) > and make my decision when posting my RFC patch. Turns out that using it directly was easier, and less code: http://thread.gmane.org/gmane.comp.emulators.qemu/353204/focus=3D354008 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Vshs9h0mgUm4aJA690qnPQvfmpV8mD3eH 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/ iQEcBAEBCAAGBQJVupx1AAoJEKeha0olJ0NqrKEH/AykbAv/w3cf1jodKufeRqd5 E27mzULioQCByq1r9XNqGrJhv/jvxt3VLW63pUR4EK30xrVfGyEFY2eH9AlIQhXR H1g8aEvfCmr5WE+cAo8IVzUKXCFUD3IWa1+i3BDzEMrtfe/bV/8d7lDYCRAuVz6z vaELXFplBrFRcBDjAcOo6su9gE/w4jCWYYkWsyK89r0iANizAyZhAEDk8FNhVt0w v22usV227hlfM08RGiF1KO6aoVVKADMtbpx4HD3ZZbYjaghZfYg6XufAU5NtAyJt 4F1Dj0aiFbJFw1ZFISMt3tef30Vg297D3D9oTeH2TUUR3Phh2DcvQmQu9mesmBU= =BzLT -----END PGP SIGNATURE----- --Vshs9h0mgUm4aJA690qnPQvfmpV8mD3eH--