[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v2 26/47] qapi-types: Convert to QAPISchemaV

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v2 26/47] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions
Date: Thu, 30 Jul 2015 15:51:49 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/30/2015 10:36 AM, Eric Blake wrote:
> On 07/30/2015 09:53 AM, Markus Armbruster wrote:
>>> Or, we could ditch the qtypes lookup altogether, and merely create the
>>> alternate enum as a non-consecutive QTYPE mapping, for one less level of
>>> indirection, as in:
>>> typedef enum BlockdevRefKind {
>> QTYPE_QDICT, but I get what you mean.
>>> };

>> Hmm, your new BlockdevRefKind is basically a subset of qtype_code with
>> the members renamed.  Could we simply use qtype_code directly?
> 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 = BLOCKDEV_REF_REFERENCE; foo->reference = xyz;'
> as a nice visual indicator of which union member within the struct is
> being assigned according to the discriminator.
> 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:

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

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]