[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/36] monitor: remove usage of generated marshal fu
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH 14/36] monitor: remove usage of generated marshal functions |
Date: |
Fri, 25 Sep 2015 16:03:42 +0200 |
From: Marc-André Lureau <address@hidden>
Once the middle mode is removed, the generated marshal functions will no
longer be exported.
Signed-off-by: Marc-André Lureau <address@hidden>
---
monitor.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/monitor.c b/monitor.c
index 7e8ad0c..410c3a5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -76,6 +76,7 @@
#include "qapi-event.h"
#include "qmp-introspect.h"
#include "sysemu/block-backend.h"
+#include "qapi/qmp/dispatch.h"
/* for hmp_info_irq/pic */
#if defined(TARGET_SPARC)
@@ -3536,21 +3537,21 @@ static int monitor_can_read(void *opaque)
return (mon->suspend_cnt == 0) ? 1 : 0;
}
-static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
+static bool invalid_qmp_mode(const Monitor *mon, const gchar *cmd,
Error **errp)
{
- bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;
+ bool is_cap = !g_strcmp0(cmd, "qmp_capabilities");
if (is_cap && mon->qmp.in_command_mode) {
error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
"Capabilities negotiation is already complete, command "
- "'%s' ignored", cmd->name);
+ "'%s' ignored", cmd);
return true;
}
if (!is_cap && !mon->qmp.in_command_mode) {
error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
"Expecting capabilities negotiation with "
- "'qmp_capabilities' before command '%s'", cmd->name);
+ "'qmp_capabilities' before command '%s'", cmd);
return true;
}
return false;
@@ -3841,7 +3842,7 @@ static void handle_qmp_command(JSONMessageParser *parser,
QList *tokens)
"The command %s has not been found", cmd_name);
goto err_out;
}
- if (invalid_qmp_mode(mon, cmd, &local_err)) {
+ if (invalid_qmp_mode(mon, cmd_name, &local_err)) {
goto err_out;
}
@@ -3926,9 +3927,13 @@ void monitor_resume(Monitor *mon)
static QObject *get_qmp_greeting(void)
{
+ QmpCommand *cmd;
QObject *ver = NULL;
- qmp_marshal_query_version(NULL, &ver, NULL);
+ cmd = qmp_find_command("query-version");
+ assert(cmd && cmd->fn);
+ cmd->fn(NULL, &ver, NULL);
+
return qobject_from_jsonf("{'QMP':{'version': %p,'capabilities':
[]}}",ver);
}
--
2.4.3
- Re: [Qemu-devel] [PATCH 07/36] qapi: add some headings in docs, (continued)
- [Qemu-devel] [PATCH 10/36] texi2pod: learn quotation, deftp and deftypefn, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 08/36] qapi: add qapi2texi script, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 11/36] build-sys: generate QAPI doc based on json, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 12/36] build-sys: generate qmp-commands.txt, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 09/36] qapi: remove qmp-events.txt, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 14/36] monitor: remove usage of generated marshal functions,
marcandre . lureau <=
- [Qemu-devel] [PATCH 13/36] build-sys: do not generate qmp-commands-old.h, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 15/36] monitor: register gen:false commands manually, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 18/36] qapi: remove "middle" mode, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 16/36] qmp: register qapi commands (no middle mode), marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 21/36] misc: spelling, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 19/36] qmp: implement qmp_query_commands without qmp_cmds, marcandre . lureau, 2015/09/25