These apply on top of master, and can also be obtained from: git://repo.or.cz/qemu/mdroth.git qapi_round1_v1
These patches are a backport of some of the QAPI-related work from Anthony's glib tree. The main goal is to get the basic code generation infrastructure in place so that it can be used by the guest agent to implement a QMP-like guest interface, and so that future work regarding the QMP conversion to QAPI can be decoupled from the infrastructure bits. Round1 incorporates the following components from Anthony's tree: - Pulls in GLib libraries (core GLib, GThreads, and GIO) - Adds code to do exception-like error propagation - New error reporting functions - Schema-based code generation for QAPI types and synchronous QMP commands using visiter patterns to cut reduce the amount of code generated by the previous scripts. This is just infrastructure, QMP will remain untouched until the actual conversion efforts are underway. Only a set of unit tests and, in the guest, virtagent, will utilize this infrastructure initially. The code in this patchest has been exercised fairly extensively with both the guest agent and the unit tests, and should be fairly close to final form. Only the qerror and glib dependencies will have any affect on the existing tree so the hope is that continued work can be done upstream. TESTING/USAGE: I was planning on including generated output examples for easy reference but I didn't want to get the patch count up too high. Reviewing that code should be be straightforward via the unit tests however: For type and visiter generation: `make test-visiter` For type, visiter, marshalling/dispatch: `make test-qmp-commands` Generated code will be output to $(SRC_DIR)/qapi-generated/ I'm planning on a Round2 after this which will capture a small set of patches related to hardening the json parser. Those will potentially impact QMP functionality so I didn't want to toss them in here. Comments and testing are very appreciated. Thanks! KNOWN ISSUES: - Extra newlines in the marshalling code - Memory leak in input marshalling code (input parameters need to be deallocated after they're passed to the QMP function) Makefile | 21 ++ Makefile.objs | 12 +- Makefile.target | 1 + configure | 13 ++ error.c | 132 +++++++++++++ error.h | 70 +++++++ error_int.h | 27 +++ module.h | 2 + qapi-schema-test.json | 16 ++ qapi/qapi-dealloc-visiter.c | 125 ++++++++++++ qapi/qapi-dealloc-visiter.h | 13 ++ qapi/qapi-types-core.h | 12 ++ qapi/qapi-visit-core.h | 175 +++++++++++++++++ qapi/qmp-core.h | 90 +++++++++ qapi/qmp-dispatch.c | 104 ++++++++++ qapi/qmp-input-visiter.c | 239 +++++++++++++++++++++++ qapi/qmp-input-visiter.h | 13 ++ qapi/qmp-output-visiter.c | 188 +++++++++++++++++++ qapi/qmp-output-visiter.h | 14 ++ qapi/qmp-registry.c | 38 ++++ qerror-report.c | 139 ++++++++++++++ qerror.c | 178 +++++------------- qerror.h | 7 + qlist.h | 10 + scripts/ordereddict.py | 128 +++++++++++++ scripts/qapi-commands.py | 437 +++++++++++++++++++++++++++++++++++++++++++ scripts/qapi-types.py | 243 ++++++++++++++++++++++++ scripts/qapi-visit.py | 219 ++++++++++++++++++++++ scripts/qapi.py | 181 ++++++++++++++++++ test-qmp-commands.c | 113 +++++++++++ test-visiter.c | 214 +++++++++++++++++++++ 31 files changed, 3045 insertions(+), 129 deletions(-)