History | View | Annotate | Download (13.6 kB)
qapi-types/visit.py: Pass whole expr dict for structs
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
qapi-types/visit.py: Inheritance for structs
This introduces a new 'base' key for struct definitions that refers toanother struct type. On the JSON level, the fields of the base type areincluded directly into the same namespace as the fields of the defined...
qapi: Anonymous unions
The discriminator for anonymous unions is the data type. This allows tohave a union type that allows both of these:
{ 'file': 'my_existing_block_device_id' } { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }...
qapi: Flat unions with arbitrary discriminator
Instead of the rather verbose syntax that distinguishes base andsubclass fields...
{ "type": "file", "read-only": true, "data": { "filename": "test" } }
...we can now have both in the same namespace, allowing a more direct...
qapi-visit.py: Split off generate_visit_struct_fields()
qapi-visit.py: Implement 'base' for unions
This implements the visitor part of base types for unions. Parsed intoQMP, this example schema definition...
{ 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } } { 'type': 'BlockOptionsQcow2, 'data': { 'lazy-refcounts': 'bool' } }...
qapi: qapi-visit.py, fix list handling for union types
Currently we assume non-list types when generating visitor routines forunion types. This is broken, since values like ['Type'] need to mappedto 'TypeList'.
We already have a type_name() function to handle this that we use for...
qapi: qapi-visit.py, native list support
Teach visitor generators about native types so they can generate theappropriate visitor routines.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>...
qapi: move include files to include/qobject/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qapi: move inclusions of qemu-common.h from headers to .c files
qapi: do not protect enum values from namespace pollution
Enum values are always preceded by the uppercase name of the enum, sothey do not conflict with reserved words.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
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)...
qapi: generate list struct and visit_list for enum
Currently, if we define an 'enum' and use it in one command'sdata, list struct for enum could not be generated, but it'sused in qmp function.
For example: KeyCodesList could not be generated.
qapi-schema.json:...
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...
qapi: untangle next_list
Right now, the semantics of next_list are complicated. The caller must:
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 theinput visitor, when there are errors.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
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 withobj being non-NULL while *obj is NULL.
qapi: add c_fun to escape function names
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi: complete implementation of unions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Acked-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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...
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...
qapi: modify visitor code generation for list iteration
Modify logic such that we never assign values to the list head argumentto progress through the list on subsequent iterations, instead rely onlyon having our return value passed back in as an argument on the next...
qapi: add qapi-visit.py code generator
This is the code generator for qapi visiter functions used tomarshal/unmarshal/dealloc qapi types. It generates the following 2files:
$(prefix)qapi-visit.c: visiter function for a particular c type, used to automagically convert qobjects into the...