qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Martin Kletzander <mkletzan@redhat.com>,
	qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3] qmp: expose list of supported character device backends
Date: Tue, 11 Feb 2014 09:24:07 -0700	[thread overview]
Message-ID: <52FA4EA7.9090209@redhat.com> (raw)
In-Reply-To: <20140211105114.1912c198@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

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 if
>>> 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 difference
>> between ChardevBackendTypes (an enum of all possible known types at
>> compile time) vs. query-chardev-backends (a runtime list of the possible
>> types that can be used for this particular machine, even if it is a
>> subset of all possible ChardevBackendTypes).
> 
> 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 typesafe.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-02-11 16:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 11:52 [Qemu-devel] [PATCH v3] qmp: expose list of supported character device backends Martin Kletzander
2014-02-03 18:03 ` Eric Blake
2014-02-10 21:16 ` Luiz Capitulino
2014-02-10 21:36   ` Eric Blake
2014-02-11  8:32     ` Markus Armbruster
2014-02-11 13:14       ` Eric Blake
2014-02-11 15:51     ` Luiz Capitulino
2014-02-11 16:24       ` Eric Blake [this message]
2014-02-11 16:40 ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FA4EA7.9090209@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mkletzan@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).