On 07/23/2013 07:03 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.
> 
> For example the following schema definition...
> 
>     { 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } }
> 
>     { 'union': 'BlockOptions',
>       'base': 'BlockOptionsBase',
>       'data': {
>           'raw': 'BlockOptionsRaw'
>           'qcow2': 'BlockOptionsQcow2'
>       } }
> 
> ...would result in this generated C struct:
> 
>     struct BlockOptions
>     {
>         BlockOptionsKind kind;
>         union {
>             void *data;
>             BlockOptionsRaw * raw;
>             BlockOptionsQcow2 * qcow2;
>         };
>         bool read_only;
>     };
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  scripts/qapi-types.py | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <ebl...@redhat.com>

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