From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDG8A-0003lj-4N for qemu-devel@nongnu.org; Tue, 11 Feb 2014 11:24:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDG85-0002RW-1j for qemu-devel@nongnu.org; Tue, 11 Feb 2014 11:24:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDG84-0002R3-QL for qemu-devel@nongnu.org; Tue, 11 Feb 2014 11:24:12 -0500 Message-ID: <52FA4EA7.9090209@redhat.com> Date: Tue, 11 Feb 2014 09:24:07 -0700 From: Eric Blake MIME-Version: 1.0 References: <20140210161600.4f9b34a1@redhat.com> <52F94654.8080401@redhat.com> <20140211105114.1912c198@redhat.com> In-Reply-To: <20140211105114.1912c198@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BdxLmKjAxXpecG90NpXf14xfBse3TDV5f" Subject: Re: [Qemu-devel] [PATCH v3] qmp: expose list of supported character device backends List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: Martin Kletzander , qemu-devel@nongnu.org, Anthony Liguori , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BdxLmKjAxXpecG90NpXf14xfBse3TDV5f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/11/2014 08:51 AM, Luiz Capitulino wrote: >>>> +## >>>> +{ 'type': 'ChardevBackendInfo', 'data': {'name': 'str'} } >>> >>> We already have ChardevBackend, it's an union though. I'm wondering i= f >>> you could change it to an enum and use it instead of plain 'str'? >> >> and we also document in qapi-code-gen.txt that when using >> 'discriminator', you either have to have a base class (and the >> discriminator is a string-typed member of that base class), or the >> discriminator is {} because it is an anonymous union. But I'm asking >> about yet another situation, of having a typed discriminator with no >> change to the wire format (no base class), something like: >> >> { 'enum': 'ChardevBackendTypes', [ 'file', 'serial', ... ] } >> { 'union': 'ChardevBackend', >> 'discriminator': 'ChardevBackendTypes', >> 'data': { 'file': 'ChardevFile', ... >> >> The benefit of such a plan is that we then have an introspectible enum= >> of all possible backends known at compile time (ChardevBackendTypes), >> and the new addition in this patch becomes: >> >> { 'type': 'ChardevBackendInfo', >> 'data': {'name', 'ChardevBackendTypes' } } >> >> rather than raw 'str', while still allowing potential future additions= >> of additional backend info. Note that there would still be a differen= ce >> between ChardevBackendTypes (an enum of all possible known types at >> compile time) vs. query-chardev-backends (a runtime list of the possib= le >> types that can be used for this particular machine, even if it is a >> subset of all possible ChardevBackendTypes). >=20 > Do you envision whether, by applying Martin's patch now, it would be > compatible to do what you suggest on top? Yes, changing 'str' to an enum type should not cause any change to the actual QMP wire format, so it is an improvement that could be made later. I see nothing preventing us from taking Martin's patch as currently written, even if we do add later patches to make it more typesa= fe. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --BdxLmKjAxXpecG90NpXf14xfBse3TDV5f 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+k6nAAoJEKeha0olJ0NqNmgIAJ6+V6iqLVXr3wTIACVQ3m/3 bN9hKWpdTSrKA4FiTG8viEQBQ7wU7h6PYPRxHeKHUdLV93qv8FzjvM3jDeau9ij9 2qhXnjUpyJM3mtLqf9EDjW90bCRah/LwHQJ/Rtly+4OAmdeQxKXpl01ukIgvEZyr 4agDvo8uUYHWYSzAIOR8jKzzJDeynzKQBHKmYo+AaoWimz7jEXLE9NJ1NJrFHChY ZLoB5s3Ww9VU16TB56o3rxlz+w22uCeMpAUpK+/4NUUkqbkta8BERwP6eyBB3JWW aG9BSj+G7Ah5kYsR2egH5NNAqoHmoek8ev1ABcRTlvzNd17PiTzhawaEPQUfNMM= =Vn8C -----END PGP SIGNATURE----- --BdxLmKjAxXpecG90NpXf14xfBse3TDV5f--