diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-09-12 13:18:59 +0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-09-19 17:32:21 +0200 |
commit | d79bedfa404a02a4652cc8d964fa6dc9b7ec62f7 (patch) | |
tree | 30ca96c386f6df802c319cd5ece9e5355157a847 | |
parent | 94cfd07f26ef240499f3a4a7a14a4bcc17b8f003 (diff) |
monitor: simplify invalid_qmp_mode()
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 <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20160912091913.15831-5-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | monitor.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; } |