From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvr98-0003YV-7g for qemu-devel@nongnu.org; Thu, 17 Jan 2013 10:12:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvr97-0003OH-0s for qemu-devel@nongnu.org; Thu, 17 Jan 2013 10:12:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvr96-0003OC-PK for qemu-devel@nongnu.org; Thu, 17 Jan 2013 10:12:48 -0500 From: Luiz Capitulino Date: Thu, 17 Jan 2013 13:12:30 -0200 Message-Id: <1358435550-502-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1358435550-502-1-git-send-email-lcapitulino@redhat.com> References: <1358435550-502-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 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: aliguori@us.ibm.com From: 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. Note that now "info " returns error instead of list of info topics. Signed-off-by: Wenchao Xia Signed-off-by: Luiz Capitulino --- 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 67569ef..0934b9b 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1521,7 +1521,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 ef1b7ac..20bd19b 100644 --- a/monitor.c +++ b/monitor.c @@ -811,28 +811,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.8.1.GIT