From e7489c372a16082de6600dcd4c09054f7420c918 Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Tue, 20 Mar 2012 14:07:34 -0300
Subject: [RHEL6 qemu-kvm PATCH 14/21] QMP: Introduce qmp_find_cmd()

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <98d508fd9565b985ae73dd2d3688cc546fbb4b3a.1332249823.git.jcody@redhat.com>
Patchwork-id: 38640
O-Subject: [RHEL6.3 qemu-kvm PATCH v3 14/21] QMP: Introduce qmp_find_cmd()
Bugzilla: 784153
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

From: Luiz Capitulino <lcapitulino@redhat.com>

Next commit needs this new function: it will introduce the
the QMP's command dispatch table and qmp_find_cmd() will be
used to search on it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit bead3ce139025797a7e970f7d2c43e61a60a7c48)

RHEL6 Note: The upstream commit message references a commit
            immediately proceeding it; the 'next commit' referenced
            is not backported.
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 monitor.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 monitor.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index 1d56e0c..7672c2b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3729,6 +3729,11 @@ static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
     return search_dispatch_table(info_cmds, info_item);
 }
 
+static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
+{
+    return search_dispatch_table(mon_cmds, cmdname);
+}
+
 static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                                               const char *cmdline,
                                               QDict *qdict)
@@ -4747,7 +4752,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     } else if (strstart(cmd_name, "query-", &query_cmd)) {
         cmd = qmp_find_query_cmd(query_cmd);
     } else {
-        cmd = monitor_find_command(cmd_name);
+        cmd = qmp_find_cmd(cmd_name);
     }
 
     if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) {
-- 
1.7.3.2

