qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V5 00/10] qapi script: support enum as discrimin


From: Wenchao Xia
Subject: Re: [Qemu-devel] [PATCH V5 00/10] qapi script: support enum as discriminator and better enum name
Date: Tue, 11 Feb 2014 13:20:21 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

于 2014/1/29 0:02, Luiz Capitulino 写道:
> On Wed, 22 Jan 2014 11:07:24 -0500
> Luiz Capitulino <address@hidden> wrote:
> 
>> On Fri, 20 Dec 2013 13:23:06 +0800
>> Wenchao Xia <address@hidden> wrote:
>>
>>> This series address two issues:
>>>
>>> 1. support using enum as discriminator in union.
>>> For example, if we have following define in qapi schema:
>>> { 'enum': 'EnumOne',
>>>    'data': [ 'value1', 'value2', 'value3' ] }
>>>
>>> { 'type': 'UserDefBase0',
>>>    'data': { 'base-string0': 'str', 'base-enum0': 'EnumOne' } }
>>>
>>> Before this series, discriminator in union must be a string, and a
>>> hidden enum type as discriminator is generated. After this series,
>>> qapi schema can directly use predefined enum type:
>>> { 'union': 'UserDefEnumDiscriminatorUnion',
>>>    'base': 'UserDefBase0',
>>>    'discriminator' : 'base-enum0',
>>>    'data': { 'value1' : 'UserDefA',
>>>              'value2' : 'UserDefInherit',
>>>              'value3' : 'UserDefB' } }
>>>
>>> The benefit is that every thing is defined explicitly in schema file,
>>> the discriminator enum type can be used in other API define in schema,
>>> and a compile time check will be put to verify the correctness according
>>> to enum define. Currently BlockdevOptions used discriminator which can
>>> be converted, in the future other union can also use enum discriminator.
>>
>> Applied to the qmp branch, thanks.
> 
> Unfortunately this doesn't build anymore due to some block changes that
> were merged. Can you please rebase it?
> 
 Sure. I just come back from vacation, will respin it.




reply via email to

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