[PATCH v2 12/31] qapi/qom: Add ObjectOptions for can-*

Eric Blake eblake at redhat.com
Tue Mar 2 20:03:55 UTC 2021


On 3/2/21 12:32 PM, Kevin Wolf wrote:
> Am 26.02.2021 um 20:42 hat Eric Blake geschrieben:
>> On 2/24/21 7:52 AM, Kevin Wolf wrote:
>>> This adds a QAPI schema for the properties of the can-* objects.
>>>
>>> can-bus doesn't have any properties, so it only needs to be added to the
>>> ObjectType enum without adding a new branch to ObjectOptions.
>>
>> I somewhat prefer
>>
>> 'can-bus': {},
>>
>> to make it explicit that we thought about it, but since we allow
>> defaulted union branches, your approach works too.
> 
> The QAPI generator disagrees:
> 
> ../qapi/qom.json: In union 'ObjectOptions':
> ../qapi/qom.json:492: 'data' member 'can-bus' misses key 'type'
> 
> It seems we can't use inline definitions of struct types because we
> already use that for the extended description of branch types. And
> adding a whole named struct without content is probably a bit too much?

Oh, maybe I'm remembering an experiment I did with a patch to add that
once, but it never went anywhere, since in the meantime we added the
'any enum not listed is acceptable as adding no additional members'.  So
my preference stems from (faulty?) memory on my part, and your patch is
fine as is.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the libvir-list mailing list