From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1To9xY-0007XR-Qy for qemu-devel@nongnu.org; Thu, 27 Dec 2012 04:41:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1To9xU-0006wJ-P2 for qemu-devel@nongnu.org; Thu, 27 Dec 2012 04:41:04 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:47886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1To9xU-0006vw-2j for qemu-devel@nongnu.org; Thu, 27 Dec 2012 04:41:00 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 27 Dec 2012 19:37:30 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id A9F8C2CE804A for ; Thu, 27 Dec 2012 20:40:54 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qBR9TVep46792784 for ; Thu, 27 Dec 2012 20:29:31 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qBR9erL0026322 for ; Thu, 27 Dec 2012 20:40:54 +1100 From: Wenchao Xia Date: Thu, 27 Dec 2012 17:40:27 +0800 Message-Id: <1356601227-8707-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1356601227-8707-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1356601227-8707-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V3 4/4] HMP: add sub command table to info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, chenwj@iis.sinica.edu.tw, armbru@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, Wenchao Xia Now info command takes a table of sub info commands, and changed do_info() to do_info_help() to do help funtion only. Signed-off-by: Wenchao Xia --- hmp-commands.hx | 3 ++- monitor.c | 22 +--------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 010b8c9..87a411a 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1489,7 +1489,8 @@ ETEXI .args_type = "item:s?", .params = "[subcommand]", .help = "show various information about the system state", - .mhandler.cmd = do_info, + .mhandler.cmd = do_info_help, + .sub_table = info_cmds, }, STEXI diff --git a/monitor.c b/monitor.c index a392df4..e1bcaa2 100644 --- a/monitor.c +++ b/monitor.c @@ -807,28 +807,8 @@ static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd, } } -static void do_info(Monitor *mon, const QDict *qdict) +static void do_info_help(Monitor *mon, const QDict *qdict) { - const mon_cmd_t *cmd; - const char *item = qdict_get_try_str(qdict, "item"); - - if (!item) { - goto help; - } - - for (cmd = info_cmds; cmd->name != NULL; cmd++) { - if (compare_cmd(item, cmd->name)) - break; - } - - if (cmd->name == NULL) { - goto help; - } - - cmd->mhandler.info(mon, NULL); - return; - -help: help_cmd(mon, "info"); } -- 1.7.1