summary refs log tree commit diff stats
path: root/scripts/qapi-visit.py
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-07-02 12:18:47 +0200
committerKevin Wolf <kwolf@redhat.com>2013-07-26 20:17:15 +0200
commite2503f5e213e30e3e9a397d454a35c10b5bdc899 (patch)
tree74a03e01560d5e6be5291e81143c4857bdca81b5 /scripts/qapi-visit.py
parent003e26bc9f7c4f5cd90e046ae112c1d09363b8d1 (diff)
downloadfocaccia-qemu-e2503f5e213e30e3e9a397d454a35c10b5bdc899.tar.gz
focaccia-qemu-e2503f5e213e30e3e9a397d454a35c10b5bdc899.zip
qapi-types.py: Implement 'base' for unions
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 <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi-visit.py')
0 files changed, 0 insertions, 0 deletions