From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjNOn-0001mq-LO for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjNOl-0002mm-FE for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjNOl-0002mg-9I for qemu-devel@nongnu.org; Mon, 12 Sep 2016 05:19:31 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5D0D83F46 for ; Mon, 12 Sep 2016 09:19:30 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 12 Sep 2016 13:18:59 +0400 Message-Id: <20160912091913.15831-5-marcandre.lureau@redhat.com> In-Reply-To: <20160912091913.15831-1-marcandre.lureau@redhat.com> References: <20160912091913.15831-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v6 04/18] monitor: simplify invalid_qmp_mode() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= 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=C3=A9 Lureau Reviewed-by: Eric Blake --- monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 991eaf7..e156026 100644 --- a/monitor.c +++ b/monitor.c @@ -3653,21 +3653,21 @@ static int monitor_can_read(void *opaque) return (mon->suspend_cnt =3D=3D 0) ? 1 : 0; } =20 -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 =3D cmd->mhandler.cmd_new =3D=3D qmp_marshal_qmp_capabil= ities; + bool is_cap =3D g_str_equal(cmd, "qmp_capabilities"); =20 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 *p= arser, 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; } =20 --=20 2.10.0