[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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC PATCH 00/11] qapi changes in preparation for blockdev-add, Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 01/11] qapi-types.py: Split off generate_struct_fields(), Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 03/11] qapi-visit.py: Split off generate_visit_struct_fields(), Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 04/11] qapi-visit.py: Implement 'base' for unions, Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 02/11] qapi-types.py: Implement 'base' for unions, Kevin Wolf, 2013/07/09
- Re: [Qemu-devel] [RFC PATCH 02/11] qapi-types.py: Implement 'base' for unions,
Eric Blake <=
- [Qemu-devel] [RFC PATCH 05/11] qapi: Add visitor for implicit structs, Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 06/11] qapi: Flat unions with arbitrary discriminator, Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 09/11] Implement qdict_flatten(), Kevin Wolf, 2013/07/09
- [Qemu-devel] [RFC PATCH 07/11] qapi: Add consume argument to qmp_input_get_object(), Kevin Wolf, 2013/07/09