[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands |
Date: |
Wed, 10 Aug 2016 22:02:24 +0400 |
From: Marc-André Lureau <address@hidden>
The current monitor dispatch codes doesn't know commands that have been
filtered out during qmp-commands.hx preprocessing. query-commands
doesn't list them either. However, qapi generator doesn't filter them
out, and they are listed in the command list.
For now, disable the commands that aren't avaible to avoid introducing a
regression there when switching to qmp_dispatch() or listing commands
from the generated qapi code.
Signed-off-by: Marc-André Lureau <address@hidden>
---
monitor.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/monitor.c b/monitor.c
index b7ae552..ef946ad 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1008,6 +1008,26 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject
**ret_data,
*ret_data = qobject_from_json(qmp_schema_json);
}
+/*
+ * Those commands are registered unconditionnally by generated
+ * qmp files. FIXME: Educate the QAPI schema on #ifdef commands.
+ */
+static void qmp_disable_marshal(void)
+{
+#ifndef CONFIG_SPICE
+ qmp_disable_command("query-spice");
+#endif
+#ifndef TARGET_I386
+ qmp_disable_command("rtc-reset-reinjection");
+#endif
+#ifndef TARGET_S390X
+ qmp_disable_command("dump-skeys");
+#endif
+#ifndef TARGET_ARM
+ qmp_disable_command("query-gic-capabilities");
+#endif
+}
+
static void qmp_init_marshal(void)
{
qmp_register_command("query-qmp-schema", qmp_query_qmp_schema,
@@ -1016,6 +1036,9 @@ static void qmp_init_marshal(void)
QCO_NO_OPTIONS);
qmp_register_command("netdev_add", qmp_netdev_add,
QCO_NO_OPTIONS);
+
+ /* call it after the rest of qapi_init() */
+ register_module_init(qmp_disable_marshal, MODULE_INIT_QAPI);
}
qapi_init(qmp_init_marshal);
--
2.9.0
- [Qemu-devel] [PATCH v4 00/17] qapi: remove the 'middle' mode, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 01/17] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 02/17] qapi-schema: use generated marshaller for 'qmp_capabilities', marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 03/17] qapi-schema: add 'device_add', marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 04/17] monitor: simplify invalid_qmp_mode(), marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 05/17] monitor: register gen:false commands manually, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands,
marcandre . lureau <=
- Re: [Qemu-devel] [PATCH v4 06/17] monitor: unregister conditional commands, Markus Armbruster, 2016/08/17
- [Qemu-devel] [PATCH v4 07/17] qapi: export the marshallers, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 08/17] monitor: use qmp_find_command() (using generated qapi code), marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 09/17] monitor: implement 'qmp_query_commands' without qmp_cmds, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 11/17] qapi: remove the "middle" mode, marcandre . lureau, 2016/08/10
- [Qemu-devel] [PATCH v4 10/17] monitor: remove mhandler.cmd_new, marcandre . lureau, 2016/08/10