From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDDDA-0001p8-9h for qemu-devel@nongnu.org; Tue, 11 Feb 2014 08:17:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDDD2-00041C-Hn for qemu-devel@nongnu.org; Tue, 11 Feb 2014 08:17:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDDD2-000415-9S for qemu-devel@nongnu.org; Tue, 11 Feb 2014 08:17:08 -0500 Message-ID: <52FA22D0.70407@redhat.com> Date: Tue, 11 Feb 2014 06:17:04 -0700 From: Eric Blake MIME-Version: 1.0 References: <1392068921-3327-1-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1392068921-3327-1-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dEFjOeb9mc07x7RFb46X7LN3xsA9IeIlW" Subject: Re: [Qemu-devel] [PATCH V6 00/10] qapi script: support enum as discriminator and better enum name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dEFjOeb9mc07x7RFb46X7LN3xsA9IeIlW Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/10/2014 02:48 PM, Wenchao Xia wrote: > This series address two issues: >=20 > 1. support using enum as discriminator in union. > For example, if we have following define in qapi schema: > { 'enum': 'EnumOne', > 'data': [ 'value1', 'value2', 'value3' ] } >=20 > { 'type': 'UserDefBase0', > 'data': { 'base-string0': 'str', 'base-enum0': 'EnumOne' } } >=20 > Before this series, discriminator in union must be a string, and a > hidden enum type as discriminator is generated. After this series, > qapi schema can directly use predefined enum type: > { 'union': 'UserDefEnumDiscriminatorUnion', > 'base': 'UserDefBase0', > 'discriminator' : 'base-enum0', > 'data': { 'value1' : 'UserDefA', > 'value2' : 'UserDefInherit', > 'value3' : 'UserDefB' } } See also: https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg01663.html There, I argued that even unions without a 'base':'TypeName' would benefit from having a discriminator that calls out an enum type listing the valid branches of the union. I think that could be a followup to this series. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --dEFjOeb9mc07x7RFb46X7LN3xsA9IeIlW 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/ iQEcBAEBCAAGBQJS+iLQAAoJEKeha0olJ0NqOzUIAIzKxng7SC/beRauhxtwxQYc OEXb3nUJEc4Rd+0Fk09g2JMyg+s/FYSzHr+LAvmCE5O1Cf/LvEVhirgKiqiOp1tH vTZ6hfMmxrhy30lxOOY/HSc4nyYhetSb9/IM+5aW3boBzEpcaprumjUbQTyJ7vqc UocCpfQhdS0IqfLdfZNFYddB39wgFDNkB/6Zl0Wsge4+lX3BbiUttjJLLayKdq09 NCPn9s7vGftfdlg/QhjDEMd6ARDY4i5EoU8/yZPMrVF5AxfcrLjThebVqpJnjMoi COZcGIewQcK6nKEnRqm7O36keQ7zT75iGdRpzwCkmBGGfftEvYvO5JTTZO+1pyY= =jgjD -----END PGP SIGNATURE----- --dEFjOeb9mc07x7RFb46X7LN3xsA9IeIlW--