@@ -32,6 +32,7 @@
/qapi-visit.[ch]
/qapi-event.[ch]
/qmp-commands.h
+/qmp-introspect.[ch]
/qmp-marshal.c
/qemu-doc.html
/qemu-tech.html
@@ -52,6 +52,8 @@ endif
GENERATED_HEADERS = config-host.h qemu-options.def
GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h qapi-event.h
GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
+GENERATED_HEADERS += qmp-introspect.h
+GENERATED_SOURCES += qmp-introspect.c
GENERATED_HEADERS += trace/generated-events.h
GENERATED_SOURCES += trace/generated-events.c
@@ -263,7 +265,7 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
$(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
- $(SRC_PATH)/qapi/event.json
+ $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json
qapi-types.c qapi-types.h :\
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
@@ -285,6 +287,11 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py \
$(gen-out-type) -o "." -m $<, \
" GEN $@")
+qmp-introspect.h qmp-introspect.c :\
+$(qapi-modules) $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
+ $(gen-out-type) -o "." $<, \
+ " GEN $@")
QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
@@ -1,7 +1,8 @@
#######################################################################
# Common libraries for tools and emulators
stub-obj-y = stubs/
-util-obj-y = util/ qobject/ qapi/ qapi-types.o qapi-visit.o qapi-event.o
+util-obj-y = util/ qobject/ qapi/
+util-obj-y += qmp-introspect.o qapi-types.o qapi-visit.o qapi-event.o
#######################################################################
# block-obj-y is code used by both qemu system emulation and qemu-img
@@ -82,6 +83,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
# qapi
common-obj-y += qmp-marshal.o
+common-obj-y += qmp-introspect.o
common-obj-y += qmp.o hmp.o
endif
@@ -74,6 +74,7 @@
#include "block/qapi.h"
#include "qapi/qmp-event.h"
#include "qapi-event.h"
+#include "qmp-introspect.h"
#include "sysemu/block-backend.h"
/* for hmp_info_irq/pic */
@@ -924,6 +925,20 @@ EventInfoList *qmp_query_events(Error **errp)
return ev_list;
}
+/*
+ * Minor hack: generated marshalling suppressed for this command
+ * ('gen': false in the schema) so we can simply send the JSON string
+ * instead of first parsing it with visit_type_SchemaInfoList() into a
+ * SchemaInfoList, then unparse it right back in the generated output
+ * marshaller, every time.
+ * Instead, we do it in test-qmp-input-visitor.c, just to make sure
+ * qapi-introspect.py's output actually conforms to the schema.
+ */
+static void qmp_query_schema(QDict *qdict, QObject **ret_data, Error **errp)
+{
+ *ret_data = qobject_from_json(qmp_schema_json);
+}
+
/* set the current CPU defined by the user */
int monitor_set_cpu(int cpu_index)
{
@@ -14,6 +14,9 @@
# Tracing commands
{ 'include': 'qapi/trace.json' }
+# QAPI introspection
+{ 'include': 'qapi/introspect.json' }
+
##
# LostTickPolicy:
#
new file mode 100644
@@ -0,0 +1,69 @@
+# -*- Mode: Python -*-
+#
+# QAPI introspection
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# Authors:
+# Markus Armbruster <armbru@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+{ 'enum': 'SchemaMetaType',
+ 'data': [ 'builtin', 'enum', 'array', 'object', 'alternate',
+ 'command', 'event' ] }
+
+{ 'struct': 'SchemaInfoBase',
+ 'data': { 'name': 'str', 'meta-type': 'SchemaMetaType' } }
+
+{ 'enum': 'JSONType',
+ 'data': [ 'string', 'number', 'int', 'boolean', 'null',
+ 'object', 'array', 'value' ] }
+
+{ 'struct': 'SchemaInfoBuiltin',
+ 'data': { 'json-type': 'JSONType' } }
+
+{ 'struct': 'SchemaInfoEnum',
+ 'data': { 'values': ['str'] } }
+
+{ 'struct': 'SchemaInfoArray',
+ 'data': { 'element-type': 'str' } }
+
+{ 'struct': 'SchemaInfoObjectMember',
+ 'data': { 'name': 'str', 'type': 'str', '*default': 'any' } }
+# @default's type must match @type
+
+{ 'struct': 'SchemaInfoObjectVariant',
+ 'data': { 'case': 'str',
+ 'members': [ 'SchemaInfoObjectMember' ] } }
+
+{ 'struct': 'SchemaInfoObject',
+ 'data': { 'members': [ 'SchemaInfoObjectMember' ],
+ '*tag': 'str',
+ '*variants': [ 'SchemaInfoObjectVariant' ] } }
+
+{ 'struct': 'SchemaInfoAlternate',
+ 'data': { 'members': [ 'SchemaInfoObjectMember' ] } }
+
+{ 'struct': 'SchemaInfoCommand',
+ 'data': { 'args': 'str', 'returns': 'str' } }
+
+{ 'struct': 'SchemaInfoEvent',
+ 'data': { 'data': 'str' } }
+
+{ 'union': 'SchemaInfo',
+ 'base': 'SchemaInfoBase',
+ 'discriminator': 'meta-type',
+ 'data': {
+ 'builtin': 'SchemaInfoBuiltin',
+ 'enum': 'SchemaInfoEnum',
+ 'array': 'SchemaInfoArray',
+ 'object': 'SchemaInfoObject',
+ 'alternate': 'SchemaInfoAlternate',
+ 'command': 'SchemaInfoCommand',
+ 'event': 'SchemaInfoEvent' } }
+
+{ 'command': 'query-schema',
+ 'returns': [ 'SchemaInfo' ],
+ 'gen': false } # just to simplify qmp_query_json()
@@ -2165,6 +2165,22 @@ EQMP
},
SQMP
+query-schema
+------------
+
+Return the QMP schema.
+
+FIXME explain
+
+EQMP
+
+ {
+ .name = "query-schema",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_query_schema,
+ },
+
+SQMP
query-chardev
-------------
@@ -265,7 +265,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
self.defn = None
self.regy = None
self.visited_rets = None
- def visit_begin(self):
+ def visit_begin(self, schema):
self.decl = ''
self.defn = ''
self.regy = ''
@@ -273,7 +273,8 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
def visit_end(self):
if not middle_mode:
self.defn += gen_registry(self.regy)
- self.regy = None
+ self.regy = None
+ self.visited_rets = None
def visit_command(self, name, info, args, rets, gen, success_response):
if not gen:
return
@@ -139,13 +139,14 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor):
self.decl = None
self.defn = None
self.event_names = None
- def visit_begin(self):
+ def visit_begin(self, schema):
self.decl = ''
self.defn = ''
self.event_names = []
def visit_end(self):
self.decl += gen_enum(event_enum_name, self.event_names)
self.defn += gen_enum_lookup(event_enum_name, self.event_names)
+ self.event_names = None
def visit_event(self, name, info, data):
self.decl += gen_event_send_decl(name, data)
self.defn += gen_event_send(name, data)
new file mode 100644
@@ -0,0 +1,159 @@
+#
+# QAPI introspection generator
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# Authors:
+# Markus Armbruster <armbru@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.
+# See the COPYING file in the top-level directory.
+
+from qapi import *
+
+class QAPISchemaGenIntrospectVisitor(QAPISchemaVisitor):
+ def __init__(self):
+ self.schema = None
+ self.jsons = None
+ self.used_types = None
+ self.defn = None
+ self.decl = None
+
+ def visit_begin(self, schema):
+ self.schema = schema
+ self.jsons = []
+ self.used_types = []
+ return QAPISchemaType # don't visit types for now
+
+ def visit_end(self):
+ # visit the types that are actually used
+ for typ in self.used_types:
+ typ.visit(self)
+ self.jsons.sort()
+ name = prefix + 'qmp_schema_json'
+ self.decl = mcgen('''
+extern char %(c_name)s[];
+''',
+ c_name=c_name(name))
+ self.defn = mcgen('''
+char %(c_name)s[] = "["
+ "%(c_jsons)s]";
+''',
+ c_name=c_name(name),
+ c_jsons=', "\n "'.join(self.jsons))
+ self.schema = None
+ self.jsons = None
+ self.used_types = None
+
+ def _use_type(self, typ):
+ if typ not in self.used_types:
+ self.used_types.append(typ)
+ return typ.name
+
+ def _gen_json(self, name, mtype, extra):
+ self.jsons.append("{ 'name': '%s', 'meta-type': '%s', %s }"
+ % (name, mtype, extra))
+
+ def _gen_members(self, members):
+ return ("'members': [ "
+ + ", ".join([self._gen_member(m) for m in members])
+ + " ]")
+
+ def _gen_member(self, member):
+ default = ''
+ if member.optional:
+ default = ", 'default': null"
+ return "{ 'name': '%s', 'type': '%s'%s }" \
+ % (member.name, self._use_type(member.type), default)
+
+ def _gen_variants(self, tag_name, variants):
+ return ("'tag': '%s'" % tag_name
+ + ", 'variants': [ "
+ + ", ".join([self._gen_variant(v) for v in variants])
+ + " ]")
+
+ def _gen_variant(self, variant):
+ if variant.flat:
+ members = self._gen_members(variant.type.members)
+ else:
+ members = "'members': [ { 'name': 'data', 'type': '%s' } ]" \
+ % self._use_type(variant.type)
+ return "{ 'case': '%s', %s }" % (variant.name, members)
+
+ def visit_builtin_type(self, name, info, json_type):
+ self._gen_json(name, 'builtin',
+ "'json-type': '%s'" % json_type)
+
+ def visit_enum_type(self, name, info, values):
+ self._gen_json(name, 'enum',
+ "'values': [ %s ]" % ", ".join(["'%s'" % v
+ for v in values]))
+
+ def visit_array_type(self, name, info, element_type):
+ self._gen_json(name, 'array',
+ "'element-type': '%s'" % self._use_type(element_type))
+
+ def visit_object_type_flat(self, name, info, members, variants):
+ extra = self._gen_members(members)
+ if variants:
+ extra += ", " + self._gen_variants(variants.tag_name or "type",
+ variants.variants)
+ self._gen_json(name, 'object', extra)
+
+ def visit_alternate_type(self, name, info, variants):
+ self._gen_json(name, 'alternate',
+ self._gen_members(variants.variants))
+
+ def visit_command(self, name, info, args, rets, gen, success_response):
+ args = args or self.schema.the_empty_object_type
+ rets = rets or self.schema.the_empty_object_type
+ self._gen_json(name, 'command',
+ "'args': '%s', 'returns': '%s'" \
+ % (self._use_type(args), self._use_type(rets)))
+
+ def visit_event(self, name, info, data):
+ data = data or self.schema.the_empty_object_type
+ self._gen_json(name, 'event', "'data': '%s'" % self._use_type(data))
+
+(input_file, output_dir, do_c, do_h, prefix, dummy) = parse_command_line()
+
+c_comment = '''
+/*
+ * QAPI/QMP schema introspection
+ *
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+'''
+h_comment = '''
+/*
+ * QAPI/QMP schema introspection
+ *
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+'''
+
+(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+ 'qmp-introspect.c', 'qmp-introspect.h',
+ c_comment, h_comment)
+
+fdef.write(mcgen('''
+#include "%(prefix)sqmp-introspect.h"
+
+''',
+ prefix=prefix))
+
+schema = QAPISchema(input_file)
+gen = QAPISchemaGenIntrospectVisitor()
+schema.visit(gen)
+fdef.write(gen.defn)
+fdecl.write(gen.decl)
+
+close_output(fdef, fdecl)
@@ -184,7 +184,6 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
self.fwdecl = None
self.fwdefn = None
self.btin = None
- def visit_begin(self):
self.decl = ''
self.defn = ''
self.fwdecl = ''
@@ -326,7 +326,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
self.decl = None
self.defn = None
self.btin = None
- def visit_begin(self):
+ def visit_begin(self, schema):
self.decl = ''
self.defn = ''
self.btin = guardstart('QAPI_VISIT_BUILTIN_VISITOR_DECL')
@@ -764,7 +764,7 @@ class QAPISchemaEntity(object):
pass
class QAPISchemaVisitor(object):
- def visit_begin(self):
+ def visit_begin(self, schema):
pass
def visit_end(self):
pass
@@ -776,6 +776,8 @@ class QAPISchemaVisitor(object):
pass
def visit_object_type(self, name, info, base, members, variants):
pass
+ def visit_object_type_flat(self, name, info, members, variants):
+ pass
def visit_alternate_type(self, name, info, variants):
pass
def visit_command(self, name, info, args, rets, gen, success_response):
@@ -892,6 +894,8 @@ class QAPISchemaObjectType(QAPISchemaType):
def visit(self, visitor):
visitor.visit_object_type(self.name, self.info,
self.base, self.local_members, self.variants)
+ visitor.visit_object_type_flat(self.name, self.info,
+ self.members, self.variants)
class QAPISchemaObjectTypeMember(object):
def __init__(self, name, typ, optional):
@@ -1042,6 +1046,9 @@ class QAPISchema(object):
('bool', 'boolean', 'bool', 'false'),
('any', 'value', 'QObject' + pointer_suffix , 'NULL')]:
self._def_builtin_type(*t)
+ self.the_empty_object_type = QAPISchemaObjectType(':empty', None, None,
+ [], None)
+ self._def_entity(self.the_empty_object_type)
def _make_implicit_enum_type(self, name, values):
name = name + 'Kind'
@@ -1180,9 +1187,10 @@ class QAPISchema(object):
ent.check(self)
def visit(self, visitor):
- visitor.visit_begin()
+ ignore = visitor.visit_begin(self)
for name in sorted(self.entity_dict.keys()):
- self.entity_dict[name].visit(visitor)
+ if not ignore or not isinstance(self.entity_dict[name], ignore):
+ self.entity_dict[name].visit(visitor)
visitor.visit_end()
#
@@ -19,6 +19,7 @@ test-opts-visitor
test-qapi-event.[ch]
test-qapi-types.[ch]
test-qapi-visit.[ch]
+test-qapi-introspect.[ch]
test-qdev-global-props
test-qemu-opts
test-qmp-commands
@@ -253,7 +253,8 @@ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
struct-base-clash.json struct-base-clash-deep.json )
GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h \
- tests/test-qmp-commands.h tests/test-qapi-event.h
+ tests/test-qmp-commands.h tests/test-qapi-event.h \
+ tests/test-qmp-introspect.h
test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
tests/check-qlist.o tests/check-qfloat.o tests/check-qjson.o \
@@ -266,7 +267,7 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
tests/rcutorture.o tests/test-rcu-list.o
test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
- tests/test-qapi-event.o
+ tests/test-qapi-event.o tests/test-qmp-introspect.o
$(test-obj-y): QEMU_INCLUDES += -Itests
QEMU_CFLAGS += -I$(SRC_PATH)/tests
@@ -327,6 +328,11 @@ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-eve
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
$(gen-out-type) -o tests -p "test-" $<, \
" GEN $@")
+tests/test-qmp-introspect.c tests/test-qmp-introspect.h :\
+$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-introspect.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-introspect.py \
+ $(gen-out-type) -o tests -p "test-" $<, \
+ " GEN $@")
tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
@@ -1,3 +1,4 @@
+object :empty
alternate Alt
case value: int flat=False
case string: Enum flat=False
@@ -1 +1,2 @@
+object :empty
enum Status ['good', 'bad', 'ugly']
@@ -1,3 +1,4 @@
+object :empty
object :obj-okay-args
member member1: intList optional=False
member member2: defList optional=False
@@ -0,0 +1 @@
+object :empty
@@ -1 +1,2 @@
+object :empty
enum MyEnum []
@@ -1 +1,2 @@
+object :empty
event oops None
@@ -1,3 +1,4 @@
+object :empty
object TestBase
member enum1: TestEnum optional=False
enum TestEnum ['value1', 'value2']
@@ -1,3 +1,4 @@
+object :empty
object :obj-fooA-args
member bar1: str optional=False
command fooA :obj-fooA-args -> None
@@ -1 +1,2 @@
+object :empty
enum Status ['good', 'bad', 'ugly']
@@ -1 +1,2 @@
+object :empty
enum Status ['good', 'bad', 'ugly']
@@ -1 +1,2 @@
+object :empty
enum Status ['good', 'bad', 'ugly']
@@ -1,3 +1,4 @@
+object :empty
command eins None -> None
gen=True success_response=True
command zwei None -> None
@@ -1,3 +1,4 @@
+object :empty
object :obj-EVENT_C-data
member a: int optional=True
member b: UserDefOne optional=True
@@ -1,2 +1,3 @@
+object :empty
command guest-get-time None -> int
gen=True success_response=True
@@ -17,6 +17,9 @@
#include "qapi/qmp-input-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
+#include "test-qmp-introspect.h"
+#include "qmp-introspect.h"
+#include "qapi-visit.h"
#include "qapi/qmp/types.h"
typedef struct TestInputVisitorData {
@@ -660,6 +663,31 @@ static void test_visitor_in_native_list_number(TestInputVisitorData *data,
qapi_free_UserDefNativeListUnion(cvalue);
}
+static void do_test_visitor_in_qmp_introspect(TestInputVisitorData *data,
+ const char *schema_json)
+{
+ SchemaInfoList *schema = NULL;
+ Error *err = NULL;
+ Visitor *v;
+
+ v = visitor_input_test_init_raw(data, schema_json);
+
+ visit_type_SchemaInfoList(v, &schema, NULL, &err);
+ if (err)
+ fprintf(stderr, "%s", error_get_pretty(err));
+ g_assert(!err);
+ g_assert(schema);
+
+ qapi_free_SchemaInfoList(schema);
+}
+
+static void test_visitor_in_qmp_introspect(TestInputVisitorData *data,
+ const void *unused)
+{
+ do_test_visitor_in_qmp_introspect(data, test_qmp_schema_json);
+ do_test_visitor_in_qmp_introspect(data, qmp_schema_json);
+}
+
static void input_visitor_test_add(const char *testpath,
TestInputVisitorData *data,
void (*test_func)(TestInputVisitorData *data, const void *user_data))
@@ -753,6 +781,9 @@ int main(int argc, char **argv)
input_visitor_test_add("/visitor/input/native_list/number",
&in_visitor_data,
test_visitor_in_native_list_number);
+ input_visitor_test_add("/visitor/input/qmp_introspect",
+ &in_visitor_data,
+ test_visitor_in_qmp_introspect);
g_test_run();
Caution, rough edges. qapi/introspect.json defines the introspection schema. It should do for uses other than QMP. FIXME it's almost entirely devoid of comments. The introspection schema does not reflect all the rules and restrictions that apply to QAPI schemata. A valid QAPI schema has an introspection value conforming to the introspection schema, but the converse is not true. Introspection lowers away a number of schema details: * The built-in types are declared with their JSON type. TODO Should we map all the integer types to just int? * Implicit type definitions are made explicit, and given auto-generated names. These names start with ':' so they don't clash with the user's names. Example: a simple union implicitly defines an enumeration type for its discriminator. * All type references are by name. * Base types are flattened. * The top type (named 'any') can hold any value. * The struct and union types are generalized into an object type. * Commands take a single argument and return a single result. Dictionary argument/result or list result is an implicit type definition. The empty object type is used when a command takes no arguments or produces no results. The argument is always of object type, but the introspection schema doesn't reflect that. The 'gen': false and 'success-response': false directives are omitted as implementation detail. * Events carry a single data value. Implicit type definition and empty object type use, just like for commands. The value is of object type, but the introspection schema doesn't reflect that. * Types not used by commands or events are omitted. Indirect use counts as use. * Optional members have a default, which can only be null right now Instead of a mandatory "optional" flag, we have an optional default. No default means mandatory, default null means optional without default value. Non-null is available for optional with default. Alternate members can't have defaults, but the introspection schema doesn't reflect that. * Clients should *not* look up types by name, because type names are not ABI. Look up the command or event you're interested in, then follow the references. TODO Should we hide the type names to eliminate the temptation? * Likewise, the names of alternate members are not ABI, and should not be examined. TODO Should we hide them, too? TODO much of the above should go into docs. New generator scripts/qapi-introspect.py computes an introspection value for its input, and generates a C variable holding it. FIXME it can generate awfully long lines A new test-qmp-input-visitor test case feeds its result for both tests/qapi-schema/qapi-schema-test.json and qapi-schema.json to a QmpInputVisitor to verify it actually conforms to the schema. New QMP command query-schema takes its return value from that variable. Command documentation is incomplete, and marked FIXME. Its reply is some 80KiBytes for me right now. If this turns out to be too much, we have a couple of options: * We can use shorter names in the JSON. Not the QMP style. * Optionally return the sub-schema for commands and events given as arguments. Right now qmp_query_schema() sends the string literal computed by qmp-introspect.py. To compute sub-schema at run time, we'd have to duplicate parts of qapi-introspect.py in C. Unattractive. * Let clients cache the output of query-schema. It changes only on QEMU upgrades, i.e. rarely. Provide a command query-schema-hash. Clients can have a cache indexed by hash, and re-query the schema only when they don't have it cached. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- .gitignore | 1 + Makefile | 9 +- Makefile.objs | 4 +- monitor.c | 15 +++ qapi-schema.json | 3 + qapi/introspect.json | 69 ++++++++++ qmp-commands.hx | 16 +++ scripts/qapi-commands.py | 5 +- scripts/qapi-event.py | 3 +- scripts/qapi-introspect.py | 159 ++++++++++++++++++++++++ scripts/qapi-types.py | 1 - scripts/qapi-visit.py | 2 +- scripts/qapi.py | 14 ++- tests/.gitignore | 1 + tests/Makefile | 10 +- tests/qapi-schema/alternate-good.out | 1 + tests/qapi-schema/comments.out | 1 + tests/qapi-schema/data-member-array.out | 1 + tests/qapi-schema/empty.out | 1 + tests/qapi-schema/enum-empty.out | 1 + tests/qapi-schema/event-case.out | 1 + tests/qapi-schema/flat-union-reverse-define.out | 1 + tests/qapi-schema/ident-with-escape.out | 1 + tests/qapi-schema/include-relpath.out | 1 + tests/qapi-schema/include-repetition.out | 1 + tests/qapi-schema/include-simple.out | 1 + tests/qapi-schema/indented-expr.out | 1 + tests/qapi-schema/qapi-schema-test.out | 1 + tests/qapi-schema/returns-int.out | 1 + tests/test-qmp-input-visitor.c | 31 +++++ 30 files changed, 345 insertions(+), 12 deletions(-) create mode 100644 qapi/introspect.json create mode 100644 scripts/qapi-introspect.py