From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Wenchao Xia <xiawenc@linux.vnet.ibm.com>,
aliguori@us.ibm.com, armbru@redhat.com, chenwj@iis.sinica.edu.tw,
lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH V6 5/5] HMP: add sub command table to info
Date: Mon, 14 Jan 2013 14:06:29 +0800 [thread overview]
Message-ID: <1358143589-5913-6-git-send-email-xiawenc@linux.vnet.ibm.com> (raw)
In-Reply-To: <1358143589-5913-1-git-send-email-xiawenc@linux.vnet.ibm.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 <unknown-topic>" returns error instead
of list of info topics.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
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
next prev parent reply other threads:[~2013-01-14 6:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-14 6:06 [Qemu-devel] [PATCH V6 0/5] HMP: allow parsing for sub command Wenchao Xia
2013-01-14 6:06 ` [Qemu-devel] [PATCH V6 1/5] HMP: add QDict to info callback handler Wenchao Xia
2013-01-14 6:06 ` [Qemu-devel] [PATCH V6 2/5] HMP: delete info handler Wenchao Xia
2013-01-14 6:06 ` [Qemu-devel] [PATCH V6 3/5] HMP: add infrastructure for sub command Wenchao Xia
2013-01-14 6:06 ` [Qemu-devel] [PATCH V6 4/5] HMP: move define of mon_cmds Wenchao Xia
2013-01-14 6:06 ` Wenchao Xia [this message]
2013-01-14 16:44 ` [Qemu-devel] [PATCH V6 0/5] HMP: allow parsing for sub command Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358143589-5913-6-git-send-email-xiawenc@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=chenwj@iis.sinica.edu.tw \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).