qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 02/11] qapi-types.py: Implement 'base' for u


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC PATCH 02/11] qapi-types.py: Implement 'base' for unions
Date: Thu, 11 Jul 2013 05:57:37 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

On 07/09/2013 03:53 AM, Kevin Wolf wrote:
> The new 'base' key in a union definition refers to a struct type, which
> is inlined into the union definition and can represent fields common to
> all kinds.

Is it worth listing an example of intended use in the commit message?
If I understand correctly, then this qapi-schema.json file:

{ 'type': 'Base',
  'data': { 'main': 'str' } }
{ 'type': 'Extra1',
  'data': { 'foo': 'str' } }
{ 'type': 'Extra2',
  'data': { 'bar': 'str' } }
{ 'union': 'Type',
  'base': 'BaseType',
  'data': { 'variant1': 'Extra1',
            'variant2': 'Extra2' } }
{ 'command': 'test',
  'data': { 'arg': 'Type' } }

would then be used over the wire as:

{ "execute": "test",
  "arguments": { "arg": { "type": "variant1",
       "data": { "main": "hello", "foo": "world" } } } }
{ "execute": "test",
  "arguments": { "arg": { "type": "variant2",
       "data": { "main": "hi", "bar": "there" } } } }

> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  scripts/qapi-types.py | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)

I'm slowly learning python, so my review skills are still weak the more
complicated the changes are; but this seems easy enough to understand.

Reviewed-by: Eric Blake <address@hidden>

-- 
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]