From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TudEP-0001iL-QS for qemu-devel@nongnu.org; Mon, 14 Jan 2013 01:09:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TudEL-00016E-Bm for qemu-devel@nongnu.org; Mon, 14 Jan 2013 01:09:13 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:60918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TudEK-00015l-O1 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 01:09:09 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Jan 2013 16:03:01 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id F0AA53578023 for ; Mon, 14 Jan 2013 17:08:57 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0E68vZv49217744 for ; Mon, 14 Jan 2013 17:08:57 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0E68vRd022060 for ; Mon, 14 Jan 2013 17:08:57 +1100 From: Wenchao Xia Date: Mon, 14 Jan 2013 14:06:29 +0800 Message-Id: <1358143589-5913-6-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1358143589-5913-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1358143589-5913-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V6 5/5] 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: Wenchao Xia , aliguori@us.ibm.com, armbru@redhat.com, chenwj@iis.sinica.edu.tw, lcapitulino@redhat.com Now info command takes a table of sub info commands, and changed do_info() to do_info_help() to do help funtion only. Note that now "info " returns error instead of list of info topics. 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 d3225c2..99e5ba1 100644 --- a/monitor.c +++ b/monitor.c @@ -810,28 +810,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.cmd(mon, NULL); - return; - -help: help_cmd(mon, "info"); } -- 1.7.1