[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev int
From: |
Eric Blake |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union |
Date: |
Fri, 18 Sep 2015 06:36:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 09/17/2015 06:52 PM, Wen Congyang wrote:
>>
>
> OK, I will try it. What is difference between start_struct() and
> start_implicit_struct()?
If you have the following QDict:
{ "a":1, "b":2", "c:3" }
start_struct() corresponds to the {, and end_struct() corresponds to the
}. If the corresponding qapi type is completely inline, then that's all
the more you need:
struct Foo {
int a;
int b;
int c;
};
But oftentimes, we want some sub-structure in our qapi types. So
suppose we want to always parse 'b' and 'c' together, in a reusable
struct, as in:
struct Bar {
int b;
int c;
};
struct Foo {
int a;
Bar *sub;
}
With the above representation, we can do a boxed visit by using only
start_struct()/end_struct(), but it maps to two levels of {} nesting, as in:
{ "a":1, "sub":{ "b":2, "c":3 } }
But sometimes we want the C struct nesting while still keeping the QDict
representation flat. And that's where start_implicit_struct() enters
the picture. It says to start a new C struct while still keeping the
QDict nesting unchanged.
Right now, we use implicit structs for 'base' types and for flat unions,
although some of my pending qapi patches get rid of the use of implicit
structs for base types.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-ppc] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Eric Blake, 2015/09/10
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Wen Congyang, 2015/09/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Eric Blake, 2015/09/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Eric Blake, 2015/09/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Wen Congyang, 2015/09/17
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Markus Armbruster, 2015/09/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Wen Congyang, 2015/09/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union, Eric Blake, 2015/09/18
- Re: [Qemu-ppc] [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union,
Eric Blake <=