[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/5] monitor: Move qmp_query_qmp_schema to qmp-cmds-control.c
From: |
Markus Armbruster |
Subject: |
[PULL 4/5] monitor: Move qmp_query_qmp_schema to qmp-cmds-control.c |
Date: |
Sat, 15 Feb 2020 14:05:26 +0100 |
From: Kevin Wolf <address@hidden>
monitor/misc.c contains code that works only in the system emulator, so
it can't be linked to tools like a storage daemon. In order to make
schema introspection available for tools, move the function to
monitor/qmp-cmds-control.c, which can be linked into the storage daemon.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
monitor/monitor-internal.h | 3 +++
monitor/misc.c | 16 ----------------
monitor/qmp-cmds-control.c | 16 ++++++++++++++++
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index 4d402ded85..3e6baba88f 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -180,4 +180,7 @@ void help_cmd(Monitor *mon, const char *name);
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
int hmp_compare_cmd(const char *name, const char *list);
+void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
+ Error **errp);
+
#endif
diff --git a/monitor/misc.c b/monitor/misc.c
index 4c4e47fdc4..6c41293102 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -75,7 +75,6 @@
#include "qapi/qapi-init-commands.h"
#include "qapi/error.h"
#include "qapi/qmp-event.h"
-#include "qapi/qapi-introspect.h"
#include "sysemu/cpus.h"
#include "qemu/cutils.h"
#include "tcg/tcg.h"
@@ -232,21 +231,6 @@ static void hmp_info_help(Monitor *mon, const QDict *qdict)
help_cmd(mon, "info");
}
-/*
- * Minor hack: generated marshalling suppressed for this command
- * ('gen': false in the schema) so we can parse the JSON string
- * directly into QObject instead of first parsing it with
- * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it
- * to QObject with generated output marshallers, every time. Instead,
- * we do it in test-qobject-input-visitor.c, just to make sure
- * qapi-gen.py's output actually conforms to the schema.
- */
-static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
- Error **errp)
-{
- *ret_data = qobject_from_qlit(&qmp_schema_qlit);
-}
-
static void monitor_init_qmp_commands(void)
{
/*
diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c
index d5f21f90e6..5cd9bb817c 100644
--- a/monitor/qmp-cmds-control.c
+++ b/monitor/qmp-cmds-control.c
@@ -29,6 +29,7 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-emit-events.h"
+#include "qapi/qapi-introspect.h"
/*
* Accept QMP capabilities in @list for @mon.
@@ -151,3 +152,18 @@ 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 parse the JSON string
+ * directly into QObject instead of first parsing it with
+ * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it
+ * to QObject with generated output marshallers, every time. Instead,
+ * we do it in test-qobject-input-visitor.c, just to make sure
+ * qapi-gen.py's output actually conforms to the schema.
+ */
+void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
+ Error **errp)
+{
+ *ret_data = qobject_from_qlit(&qmp_schema_qlit);
+}
--
2.21.1
- [PULL 0/5] Monitor patches for 2020-02-15, Markus Armbruster, 2020/02/15
- [PULL 5/5] qemu-doc: Clarify extent of build platform support, Markus Armbruster, 2020/02/15
- [PULL 1/5] monitor: Move monitor option parsing to monitor/monitor.c, Markus Armbruster, 2020/02/15
- [PULL 3/5] monitor: Collect "control" command handlers in qmp-cmds.control.c, Markus Armbruster, 2020/02/15
- [PULL 4/5] monitor: Move qmp_query_qmp_schema to qmp-cmds-control.c,
Markus Armbruster <=
- [PULL 2/5] qapi: Split control.json off misc.json, Markus Armbruster, 2020/02/15
- Re: [PULL 0/5] Monitor patches for 2020-02-15, Peter Maydell, 2020/02/17