From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbBra-0002ci-2E for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:09:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbBrV-0002jT-77 for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:09:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbBrU-0002j5-Vh for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:09:45 -0400 Message-ID: <526FDDC4.9010803@redhat.com> Date: Tue, 29 Oct 2013 10:09:40 -0600 From: Eric Blake MIME-Version: 1.0 References: <1382321765-29052-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1382321765-29052-4-git-send-email-xiawenc@linux.vnet.ibm.com> <5265917D.3000903@redhat.com> <526E3FF1.7060305@redhat.com> <526F4631.50706@linux.vnet.ibm.com> In-Reply-To: <526F4631.50706@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nxlCs4jO04EJah7qSVrodi9R7fU4GII8K" Subject: Re: [Qemu-devel] [PATCH 3/6] qapi: rename prefix QEVENT to Q_EVENT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia , Paolo Bonzini Cc: kwolf@redhat.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nxlCs4jO04EJah7qSVrodi9R7fU4GII8K Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/28/2013 11:22 PM, Wenchao Xia wrote: >> > MONITOR_EVENT seems tide to monitor too much, since it will be presen= t > in qapi-schema, I think Q_EVENT_ or QMP_EVENT_KIND would be better? I don't have a strong enough opinion on the bikeshed color. MONITOR_EVENT implies the event is always associated with delivery over a monitor; but how else would you receive an event without a monitor? >=20 > I am coding v2, which fully support event define in qapi-schema. Ther= e > is another thing I hope to know your opinion: > Should we support use enum as discriminator? >=20 > { 'enum': 'QEvent', > 'data': [ 'SHUTDOWN', 'POWERDOWN'] >=20 > { 'type': 'QmpEventBase', > 'data': { 'event': 'QEvent', 'timestamp': 'EventTimestamp' } } >=20 > { 'Union': 'QmpEvent', > 'base': 'QmpEventBase', > 'discriminator': 'event', I raised that question when Kevin first added discriminated unions; if I recall, the answer was along the lines: "yes, it would be a nice addition, but someone would have to code it, and we'd have to teach the generator.py to loudly fail if all branches of the enum are not covered in the union's data". So go for it! > 'data': { > 'SHUTDOWN' : 'EventShutdown', > 'POWERDOWN' : 'EventPowerdown' > } > } >=20 > By default 'QmpEvent' will generate a hidden enum type 'QmpEventKind'= =2E > but the hidden type define is needed by query-event, so there is two wa= y > to archieve it: > 1 just use the hidden type in qapi-schema.json. > 2 modified the script to support use predefined enum type. > In my draft code, both can work, but which one do you prefer? I'd like to see the addition of an enum-typed discriminator, rather than forcing the discriminator to be string-only. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nxlCs4jO04EJah7qSVrodi9R7fU4GII8K 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.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSb93EAAoJEKeha0olJ0NqGpcH/2XmFkZrPqYG6G0KwmbdCY+L jedFH3YQdu/NvANir6xa5nT0+q92RALUrBETYC53QJJbpt5NanKDw/ukIBOBbB7t guE+JIp28qwuwCpouI7fha5xFN6+DpKP0EbcHuQuWIsdzf7ukFrXHNU9iqmbhcdT ViL8AISpG5KzgO0EE26xj+avzRa6jthohvOxGdbf5RldiZA0Lm/iiXOo5i5lv+TQ nq2/dVr5m3bLKqo00hklLXvOuke+/mMLMfabrP449KYQOFVNZcTADLAEyKcNJ+B5 PKpfEhhiX8q90gjDDPa8XNIbmv3oHTmuY9Y6wESliKxIG2JVc8CbceuzrhgIxL4= =Ixp6 -----END PGP SIGNATURE----- --nxlCs4jO04EJah7qSVrodi9R7fU4GII8K--