[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 25/32] qapi-introspect: Include command line opt
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [RFC PATCH 25/32] qapi-introspect: Include command line options information |
Date: |
Mon, 2 Oct 2017 17:25:45 +0200 |
Make query-qmp-schema describe command line options in addition to QMP
commands and events. Simple, but it pushes query-qmp-schema beyond
QMP. Perhaps options introspection should be separate. Perhaps not
for the same reason QMP and command line are defined in the same
schema: they share many types.
Signed-off-by: Markus Armbruster <address@hidden>
---
qapi/introspect.json | 22 ++++++++++++++++++++--
scripts/qapi-introspect.py | 10 +++++++++-
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/qapi/introspect.json b/qapi/introspect.json
index 5b3e6e9d78..0b6be5b19c 100644
--- a/qapi/introspect.json
+++ b/qapi/introspect.json
@@ -70,11 +70,13 @@
#
# @event: a QMP event
#
+# @option: a command line option (since 2.11)
+#
# Since: 2.5
##
{ 'enum': 'SchemaMetaType',
'data': [ 'builtin', 'enum', 'array', 'object', 'alternate',
- 'command', 'event' ] }
+ 'command', 'event', 'option' ] }
##
# @SchemaInfo:
@@ -103,7 +105,8 @@
'object': 'SchemaInfoObject',
'alternate': 'SchemaInfoAlternate',
'command': 'SchemaInfoCommand',
- 'event': 'SchemaInfoEvent' } }
+ 'event': 'SchemaInfoEvent',
+ 'option': 'SchemaInfoOption' } }
##
# @SchemaInfoBuiltin:
@@ -278,3 +281,18 @@
##
{ 'struct': 'SchemaInfoEvent',
'data': { 'arg-type': 'str' } }
+
+##
+# @SchemaInfoOption:
+#
+# Additional SchemaInfo members for meta-type 'option'.
+#
+# @arg-type: the name of the object type that provides the option's
+# parameters.
+#
+# @short: the option character, if any.
+#
+# Since: 2.11
+##
+{ 'struct': 'SchemaInfoOption',
+ 'data': { 'arg-type': 'str', '*short': 'str' } }
diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py
index 52404b07ab..650e5597b0 100644
--- a/scripts/qapi-introspect.py
+++ b/scripts/qapi-introspect.py
@@ -108,7 +108,7 @@ const char %(c_name)s[] = %(c_string)s;
return self._name(typ.name)
def _gen_json(self, name, mtype, obj):
- if mtype not in ('command', 'event', 'builtin', 'array'):
+ if mtype not in ('command', 'event', 'option', 'builtin', 'array'):
name = self._name(name)
obj['name'] = name
obj['meta-type'] = mtype
@@ -161,6 +161,14 @@ const char %(c_name)s[] = %(c_string)s;
arg_type = arg_type or self._schema.the_empty_object_type
self._gen_json(name, 'event', {'arg-type': self._use_type(arg_type)})
+ def visit_option(self, name, info, arg_type, short, implied_key,
+ boxed, help_):
+ arg_type = arg_type or self._schema.the_empty_object_type
+ obj = {'arg-type': self._use_type(arg_type)}
+ if short:
+ obj['short'] = short
+ self._gen_json(name, 'option', obj)
+
parser = common_argument_parser()
# Debugging aid: unmask QAPI schema's type names
# We normally mask them, because they're not QMP wire ABI
--
2.13.6
- [Qemu-devel] [RFC PATCH 30/32] qapi/options: QAPIfy --watchdog-action argument type, (continued)
- [Qemu-devel] [RFC PATCH 30/32] qapi/options: QAPIfy --watchdog-action argument type, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 08/32] qapi: Simplify check_name() parameters, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 10/32] qapi: Don't run generators twice, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 31/32] qapi/options: QAPIfy --blockdev argument type, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 05/32] qapi2texi: Provide access to Texinfo markup, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 21/32] qapi: Define QAPIOptionKind and QAPIOption automatically, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 23/32] qapi-options: Command line option backend, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 25/32] qapi-introspect: Include command line options information,
Markus Armbruster <=
- [Qemu-devel] [RFC PATCH 20/32] qapi: Frontend for defining command line options, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 19/32] qapi: Accept double-quoted strings, Markus Armbruster, 2017/10/02
[Qemu-devel] [RFC PATCH 12/32] qapi: Use argparse to parse command line arguments, Markus Armbruster, 2017/10/02