]> git.proxmox.com Git - qemu.git/commitdiff
HMP: add sub command table to info
authorWenchao Xia <xiawenc@linux.vnet.ibm.com>
Mon, 14 Jan 2013 06:06:29 +0000 (14:06 +0800)
committerLuiz Capitulino <lcapitulino@redhat.com>
Thu, 17 Jan 2013 12:24:52 +0000 (10:24 -0200)
  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>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
hmp-commands.hx
monitor.c

index 67569eff4a8d32f4a5ce4026729f6a3a89d1e634..0934b9b915f7b5d5a6930786d3d3da94bec81716 100644 (file)
@@ -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
index ef1b7ac062339b4b6103c86a059aef564223d799..20bd19b05fdc03300bb215ace1ae97ae2d5df585 100644 (file)
--- 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");
 }