From patchwork Fri Jan 11 09:14:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 211249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8DFC92C01C8 for ; Fri, 11 Jan 2013 20:17:17 +1100 (EST) Received: from localhost ([::1]:43520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtajD-0007FR-M0 for incoming@patchwork.ozlabs.org; Fri, 11 Jan 2013 04:16:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttaiq-00070t-Lz for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:16:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttaim-0005J9-D8 for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:16:20 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:37578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttail-0005IO-NK for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:16:16 -0500 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jan 2013 19:11:38 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 11 Jan 2013 19:11:36 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id CA5BC2CE804A for ; Fri, 11 Jan 2013 20:16:11 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0B94UtN59899914 for ; Fri, 11 Jan 2013 20:04:30 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0B9GAMa014988 for ; Fri, 11 Jan 2013 20:16:10 +1100 Received: from RH63Wenchao (wenchaox.cn.ibm.com [9.115.122.237]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0B9ECoR011810; Fri, 11 Jan 2013 20:16:08 +1100 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Fri, 11 Jan 2013 17:14:05 +0800 Message-Id: <1357895645-30359-7-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1357895645-30359-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1357895645-30359-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13011109-1618-0000-0000-0000032A4955 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.143 Cc: Wenchao Xia , aliguori@us.ibm.com, armbru@redhat.com, chenwj@iis.sinica.edu.tw, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH V5 6/6] HMP: add sub command table to info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 f6cb659..d186532 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"); }