[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 09/20] monitor: simplify invalid_qmp_mode()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v5 09/20] monitor: simplify invalid_qmp_mode() |
Date: |
Wed, 17 Aug 2016 20:57:46 +0400 |
handle_qmp_command() will switch to use qmp_dispatch(). It won't have a
pointer to the marshaller function anymore, but only the name of the
command to invoke. Simplify invalid_qmp_mode() so it can just be called
with the command name.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
monitor.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/monitor.c b/monitor.c
index 4a6f97d..aad44c7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3653,21 +3653,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 char *cmd,
Error **errp)
{
- bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;
+ bool is_cap = g_str_equal(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;
@@ -3958,7 +3958,7 @@ static void handle_qmp_command(JSONMessageParser *parser,
GQueue *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;
}
--
2.9.0
- [Qemu-devel] [PATCH v5 00/20] qapi: remove the 'middle' mode, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 02/20] qapi.py: add a simple #ifdef conditional, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 01/20] tests: do qmp introspect validation per target, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 03/20] build-sys: make qemu qapi per-target, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 05/20] qapi: configure the schema, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 04/20] build-sys: use config headers to generate qapi, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 06/20] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 08/20] qapi-schema: add 'device_add', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 07/20] qapi-schema: use generated marshaller for 'qmp_capabilities', Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 09/20] monitor: simplify invalid_qmp_mode(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH v5 11/20] qapi: export the marshallers, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 10/20] monitor: register gen:false commands manually, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 13/20] monitor: implement 'qmp_query_commands' without qmp_cmds, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 12/20] monitor: use qmp_find_command() (using generated qapi code), Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 15/20] qapi: remove the "middle" mode, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 14/20] monitor: remove mhandler.cmd_new, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 16/20] qapi: check invalid arguments on no-args commands, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 18/20] build-sys: remove qmp-commands-old.h, Marc-André Lureau, 2016/08/17
- [Qemu-devel] [PATCH v5 17/20] monitor: use qmp_dispatch(), Marc-André Lureau, 2016/08/17