Statistics
| Branch: | Revision:

root / scripts / qapi-visit.py @ 85938981

History | View | Annotate | Download (13.6 kB)

# Date Author Comment
14d36307 10/11/2013 05:50 pm Kevin Wolf

qapi-types/visit.py: Pass whole expr dict for structs

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

622f557f 10/11/2013 05:50 pm Kevin Wolf

qapi-types/visit.py: Inheritance for structs

This introduces a new 'base' key for struct definitions that refers to
another struct type. On the JSON level, the fields of the base type are
included directly into the same namespace as the fields of the defined...

69dd62df 07/26/2013 10:10 pm Kevin Wolf

qapi: Anonymous unions

The discriminator for anonymous unions is the data type. This allows to
have a union type that allows both of these:

{ 'file': 'my_existing_block_device_id' }
{ 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }...
50f2bdc7 07/26/2013 10:09 pm Kevin Wolf

qapi: Flat unions with arbitrary discriminator

Instead of the rather verbose syntax that distinguishes base and
subclass fields...

{ "type": "file",
"read-only": true,
"data": {
"filename": "test"
} }

...we can now have both in the same namespace, allowing a more direct...

d131c897 07/26/2013 09:17 pm Kevin Wolf

qapi-visit.py: Split off generate_visit_struct_fields()

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

0aef92b9 07/26/2013 09:17 pm Kevin Wolf

qapi-visit.py: Implement 'base' for unions

This implements the visitor part of base types for unions. Parsed into
QMP, this example schema definition...

{ 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } }
{ 'type': 'BlockOptionsQcow2, 'data': { 'lazy-refcounts': 'bool' } }...
c664aef5 05/23/2013 04:44 pm Michael Roth

qapi: qapi-visit.py, fix list handling for union types

Currently we assume non-list types when generating visitor routines for
union types. This is broken, since values like ['Type'] need to mapped
to 'TypeList'.

We already have a type_name() function to handle this that we use for...

7c946bc4 05/23/2013 04:44 pm Michael Roth

qapi: qapi-visit.py, native list support

Teach visitor generators about native types so they can generate the
appropriate visitor routines.

Signed-off-by: Michael Roth <>
Reviewed-by: Laszlo Ersek <>
Reviewed-by: Amos Kong <>...

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

79ee7df8 12/19/2012 09:31 am Paolo Bonzini

qapi: move inclusions of qemu-common.h from headers to .c files

Signed-off-by: Paolo Bonzini <>

eda50a65 09/26/2012 04:45 pm Paolo Bonzini

qapi: do not protect enum values from namespace pollution

Enum values are always preceded by the uppercase name of the enum, so
they do not conflict with reserved words.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Luiz Capitulino <>

227ccf6b 09/05/2012 09:48 pm Stefan Weil

qapi: Fix potential NULL pointer segfault

Report from smatch:

qapi-visit.c:1640 visit_type_BlockdevAction(8) error:
we previously assumed 'obj' could be null (see line 1639)
qapi-visit.c:2432 visit_type_NetClientOptions(8) error:
we previously assumed 'obj' could be null (see line 2431)...

b9c4b48d 09/05/2012 09:48 pm Amos Kong

qapi: generate list struct and visit_list for enum

Currently, if we define an 'enum' and use it in one command's
data, list struct for enum could not be generated, but it's
used in qmp function.

For example: KeyCodesList could not be generated.

qapi-schema.json:...

d195325b 07/23/2012 01:55 pm Paolo Bonzini

qapi: fix error propagation

Don't overwrite / leak previously set errors.
Make traversal cope with missing mandatory sub-structs.
Don't try to end a container that could not be started.

v1->v2:
- unchanged

v2->v3:
- instead of examining, assert that we never overwrite errors with...

3a86a0fa 03/27/2012 03:14 pm Paolo Bonzini

qapi: untangle next_list

Right now, the semantics of next_list are complicated. The caller must:

  • call start_list
  • call next_list for each element including the first
  • on the first call to next_list, the second argument should point to
    NULL and the result is the head of the list. On subsequent calls,...
69b50071 03/27/2012 03:14 pm Paolo Bonzini

qapi: allow freeing partially-allocated objects

Objects going through the dealloc visitor can be only partially allocated.
Detect the situation and avoid a segfault. This also helps with the
input visitor, when there are errors.

Signed-off-by: Paolo Bonzini <>...

b6f0474f 03/27/2012 03:13 pm Paolo Bonzini

qapi: shortcut visits on errors

We can exit very soon if we enter a visitor with a preexisting error.
This simplifies some cases because we will not have to deal with
obj being non-NULL while *obj is NULL.

Signed-off-by: Paolo Bonzini <>...

c9da228b 03/26/2012 09:21 pm Federico Simoncelli

qapi: add c_fun to escape function names

Signed-off-by: Federico Simoncelli <>
Signed-off-by: Anthony Liguori <>

dc8fb6df 03/12/2012 04:14 pm Paolo Bonzini

qapi: complete implementation of unions

Signed-off-by: Paolo Bonzini <>
Acked-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

19bf7c87 01/12/2012 06:03 pm Avi Kivity

Fix qapi code generation fix

The fixes to qapi code generation had multiple bugs:
- the Null class used to drop output was missing some methods
- in some scripts it was never instantiated, leading to a None return,
which is missing even more methods
- the --source and --header options were swapped...

8d3bc517 12/27/2011 05:28 pm Avi Kivity

Fix qapi code generation wrt parallel build

Make's multiple output syntax

x.c x.h: x.template
gen < x.template

actually invokes the command once for x.c and once for x.h (with differing $@
in each invocation). During a parallel build, the two commands may be invoked...

e1bc2f7b 10/04/2011 05:00 pm Michael Roth

qapi: modify visitor code generation for list iteration

Modify logic such that we never assign values to the list head argument
to progress through the list on subsequent iterations, instead rely only
on having our return value passed back in as an argument on the next...

06d64c62 07/21/2011 10:48 pm Michael Roth

qapi: add qapi-visit.py code generator

This is the code generator for qapi visiter functions used to
marshal/unmarshal/dealloc qapi types. It generates the following 2
files:

$(prefix)qapi-visit.c: visiter function for a particular c type, used
to automagically convert qobjects into the...