[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V5 6/6] HMP: add sub command table to info
From: |
Wenchao Xia |
Subject: |
[Qemu-devel] [PATCH V5 6/6] HMP: add sub command table to info |
Date: |
Fri, 11 Jan 2013 17:14:05 +0800 |
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 <address@hidden>
---
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");
}
--
1.7.1
- [Qemu-devel] [PATCH V5 0/6] HMP: allow parsing for sub command, Wenchao Xia, 2013/01/11
- [Qemu-devel] [PATCH V5 2/6] HMP: delete info handler, Wenchao Xia, 2013/01/11
- [Qemu-devel] [PATCH V5 5/6] HMP: move define of mon_cmds, Wenchao Xia, 2013/01/11
- [Qemu-devel] [PATCH V5 4/6] HMP: filter out space before check of sub-command, Wenchao Xia, 2013/01/11
- [Qemu-devel] [PATCH V5 3/6] HMP: add infrastructure for sub command, Wenchao Xia, 2013/01/11
- [Qemu-devel] [PATCH V5 6/6] HMP: add sub command table to info,
Wenchao Xia <=
- [Qemu-devel] [PATCH V5 1/6] HMP: add QDict to info callback handler, Wenchao Xia, 2013/01/11