Skip to contentSkip to conversation

Monitor: split HMP and QMP dispatch tables

PATCH In review Luiz Capitulino 3 participants 24 messages Sep 30, 2010 – Oct 1, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Monitor: split HMP and QMP dispatch tables

This is a respin with the following small changes:

v1 - v2:
o Renamed qemu-monitor-qmp.hx to qmp-commands.hx
o Added a new patch which renames qemu-monitor.hx to hmp-commands.hx
o Other minor changes

---
 Makefile        |    4 +-
 Makefile.target |    9 +-
 QMP/README      |    2 +-
 hmp-commands.hx | 1216 ++++++++++++++++++++++++++
 monitor.c       |  361 +++++---
 monitor.h       |    1 -
 qemu-monitor.hx | 2575 -------------------------------------------------------
 qmp-commands.hx | 1541 +++++++++++++++++++++++++++++++++
 8 files changed, 2994 insertions(+), 2715 deletions(-)
#1 lore raw

PATCH v2 1/19 Monitor: Introduce search_dispatch_table()

It's a generic version of monitor_find_command() which searches the dispatch table passed as an argument.

Future commits will introduce new dispatch tables, so we need common code to search them.

---
 monitor.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
monitor.c +8 -2
index e602480..5aead4f 100644
@@ -3368,11 +3368,12 @@ static int is_valid_option(const char *c, const char *typestr)
     return (typestr != NULL);
 }
 
-static const mon_cmd_t *monitor_find_command(const char *cmdname)
+static const mon_cmd_t *search_dispatch_table(const mon_cmd_t *disp_table,
+                                              const char *cmdname)
 {
     const mon_cmd_t *cmd;
 
-    for (cmd = mon_cmds; cmd->name != NULL; cmd++) {
+    for (cmd = disp_table; cmd->name != NULL; cmd++) {
         if (compare_cmd(cmdname, cmd->name)) {
             return cmd;
         }
@@ -3381,6 +3382,11 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname)
     return NULL;
 }
 
+static const mon_cmd_t *monitor_find_command(const char *cmdname)
+{
+    return search_dispatch_table(mon_cmds, cmdname);
+}
+
 static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                                               const char *cmdline,
                                               QDict *qdict)
Signature · 1 line
1.7.3.1.45.g9855b
#2 lore raw

PATCH v2 2/19 QMP: handle_qmp_command(): Move 'cmd' sanity check

In reply to Luiz Capitulino

Next commit will change how query commands are handled in a way that the 'cmd' sanity check is also going to be needed for query commands handling.

Let's move it out of the else body then.

---
 monitor.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
monitor.c +5 -5
index 5aead4f..8324e65 100644
@@ -4372,11 +4372,11 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
                       qobject_from_jsonf("{ 'item': %s }", info_item));
     } else {
         cmd = monitor_find_command(cmd_name);
-        if (!cmd || !monitor_handler_ported(cmd)
-            || monitor_cmd_user_only(cmd)) {
-            qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
-            goto err_out;
-        }
+    }
+
+    if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) {
+        qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
+        goto err_out;
     }
 
     obj = qdict_get(input, "arguments");
Signature · 1 line
1.7.3.1.45.g9855b
#3 lore raw

PATCH v2 3/19 QMP: Don't use do_info()

In reply to Luiz Capitulino

Since its inception, QMP has been using HMP's do_info() function to run query commands.

This was a bad choice, as it made do_info() more complex and contributed to couple QMP and HMP.

This commit fixes that by doing the following changes:

1. Introduce qmp_find_query_cmd() and use it to directly lookup the info_cmds table

2. Introduce qmp_call_query_cmd() so that QMP code is able to call query handlers without using do_info()

3. Drop do_info() usage (via monitor_find_command("info"))

We need all the three changes in one shot so that we don't break the calling of query commands in QMP.

---
 monitor.c |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)
monitor.c +31 -8
index 8324e65..af8bdfe 100644
@@ -3387,6 +3387,11 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname)
     return search_dispatch_table(mon_cmds, cmdname);
 }
 
+static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
+{
+    return search_dispatch_table(info_cmds, info_item);
+}
+
 static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                                               const char *cmdline,
                                               QDict *qdict)
@@ -4326,6 +4331,24 @@ static QDict *qmp_check_input_obj(QObject *input_obj)
     return input_dict;
 }
 
+static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd)
+{
+    QObject *ret_data = NULL;
+
+    if (monitor_handler_is_async(cmd)) {
+        qmp_async_info_handler(mon, cmd);
+        if (monitor_has_error(mon)) {
+            monitor_protocol_emitter(mon, NULL);
+        }
+    } else {
+        cmd->mhandler.info_new(mon, &ret_data);
+        if (ret_data) {
+            monitor_protocol_emitter(mon, ret_data);
+            qobject_decref(ret_data);
+        }
+    }
+}
+
 static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
 {
     int err;
@@ -4333,8 +4356,9 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     QDict *input, *args;
     const mon_cmd_t *cmd;
     Monitor *mon = cur_mon;
-    const char *cmd_name, *info_item;
+    const char *cmd_name, *query_cmd;
 
+    query_cmd = NULL;
     args = input = NULL;
 
     obj = json_parser_parse(tokens, NULL);
@@ -4360,16 +4384,13 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     }
 
     /*
-     * XXX: We need this special case until we get info handlers
-     * converted into 'query-' commands
+     * XXX: We need this special case until QMP has its own dispatch table
      */
     if (compare_cmd(cmd_name, "info")) {
         qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
         goto err_out;
-    } else if (strstart(cmd_name, "query-", &info_item)) {
-        cmd = monitor_find_command("info");
-        qdict_put_obj(input, "arguments",
-                      qobject_from_jsonf("{ 'item': %s }", info_item));
+    } else if (strstart(cmd_name, "query-", &query_cmd)) {
+        cmd = qmp_find_query_cmd(query_cmd);
     } else {
         cmd = monitor_find_command(cmd_name);
     }
@@ -4392,7 +4413,9 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
         goto err_out;
     }
 
-    if (monitor_handler_is_async(cmd)) {
+    if (query_cmd) {
+        qmp_call_query_cmd(mon, cmd);
+    } else if (monitor_handler_is_async(cmd)) {
         err = qmp_async_cmd_handler(mon, cmd, args);
         if (err) {
             /* emit the error response */
Signature · 1 line
1.7.3.1.45.g9855b
#4 lore raw

PATCH v2 4/19 Monitor: Drop QMP bits from do_info()

In reply to Luiz Capitulino

As of last commit, QMP doesn't use do_info() anymore. Simplify it.

---
 monitor.c |   39 ++++++++-------------------------------
 1 files changed, 8 insertions(+), 31 deletions(-)
monitor.c +7 -30
index af8bdfe..f638017 100644
@@ -639,7 +639,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
     const char *item = qdict_get_try_str(qdict, "item");
 
     if (!item) {
-        assert(monitor_ctrl_mode(mon) == 0);
         goto help;
     }
 
@@ -649,24 +648,11 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
     }
 
     if (cmd->name == NULL) {
-        if (monitor_ctrl_mode(mon)) {
-            qerror_report(QERR_COMMAND_NOT_FOUND, item);
-            return -1;
-        }
         goto help;
     }
 
-    if (monitor_ctrl_mode(mon) && monitor_cmd_user_only(cmd)) {
-        qerror_report(QERR_COMMAND_NOT_FOUND, item);
-        return -1;
-    }
-
     if (monitor_handler_is_async(cmd)) {
-        if (monitor_ctrl_mode(mon)) {
-            qmp_async_info_handler(mon, cmd);
-        } else {
-            user_async_info_handler(mon, cmd);
-        }
+        user_async_info_handler(mon, cmd);
         /*
          * Indicate that this command is asynchronous and will not return any
          * data (not even empty).  Instead, the data will be returned via a
@@ -674,24 +660,15 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
          */
         *ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }");
     } else if (monitor_handler_ported(cmd)) {
-        cmd->mhandler.info_new(mon, ret_data);
+        QObject *info_data = NULL;
 
-        if (!monitor_ctrl_mode(mon)) {
-            /*
-             * User Protocol function is called here, Monitor Protocol is
-             * handled by monitor_call_handler()
-             */
-            if (*ret_data)
-                cmd->user_print(mon, *ret_data);
+        cmd->mhandler.info_new(mon, &info_data);
+        if (info_data) {
+            cmd->user_print(mon, info_data);
+            qobject_decref(info_data);
         }
     } else {
-        if (monitor_ctrl_mode(mon)) {
-            /* handler not converted yet */
-            qerror_report(QERR_COMMAND_NOT_FOUND, item);
-            return -1;
-        } else {
-            cmd->mhandler.info(mon);
-        }
+        cmd->mhandler.info(mon);
     }
 
     return 0;
Signature · 1 line
1.7.3.1.45.g9855b
#5 lore raw

PATCH v2 5/19 Monitor: Drop is_async_return()

In reply to Luiz Capitulino

If I understood it correcty, the is_async_return() logic was only used to prevent QMP from issuing duplicated success responses for asynchronous handlers.

However, QMP doesn't use do_info() anymore so this is dead logic and (hopefully) can be safely dropped.

---
 monitor.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)
monitor.c +1 -24
index f638017..5b57810 100644
@@ -653,12 +653,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
 
     if (monitor_handler_is_async(cmd)) {
         user_async_info_handler(mon, cmd);
-        /*
-         * Indicate that this command is asynchronous and will not return any
-         * data (not even empty).  Instead, the data will be returned via a
-         * completion callback.
-         */
-        *ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }");
     } else if (monitor_handler_ported(cmd)) {
         QObject *info_data = NULL;
 
@@ -3717,15 +3711,6 @@ void monitor_set_error(Monitor *mon, QError *qerror)
     }
 }
 
-static int is_async_return(const QObject *data)
-{
-    if (data && qobject_type(data) == QTYPE_QDICT) {
-        return qdict_haskey(qobject_to_qdict(data), "__mon_async");
-    }
-
-    return 0;
-}
-
 static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
 {
     if (monitor_ctrl_mode(mon)) {
@@ -3784,15 +3769,7 @@ static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,
     ret = cmd->mhandler.cmd_new(mon, params, &data);
     handler_audit(mon, cmd, ret);
 
-    if (is_async_return(data)) {
-        /*
-         * Asynchronous commands have no initial return data but they can
-         * generate errors.  Data is returned via the async completion handler.
-         */
-        if (monitor_ctrl_mode(mon) && monitor_has_error(mon)) {
-            monitor_protocol_emitter(mon, NULL);
-        }
-    } else if (monitor_ctrl_mode(mon)) {
+    if (monitor_ctrl_mode(mon)) {
         /* Monitor Protocol */
         monitor_protocol_emitter(mon, data);
     } else {
Signature · 1 line
1.7.3.1.45.g9855b
#6 lore raw

PATCH v2 6/19 Monitor: Convert do_info() back to HMP

In reply to Luiz Capitulino

This is a HMP specific handler, it makes no sense to have it under QMP.

---
 monitor.c       |    5 ++---
 qemu-monitor.hx |    3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)
monitor.c +2 -3
index 5b57810..c22f5d6 100644
@@ -633,7 +633,7 @@ static void user_async_info_handler(Monitor *mon, const mon_cmd_t *cmd)
     }
 }
 
-static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static void do_info(Monitor *mon, const QDict *qdict)
 {
     const mon_cmd_t *cmd;
     const char *item = qdict_get_try_str(qdict, "item");
@@ -665,11 +665,10 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
         cmd->mhandler.info(mon);
     }
 
-    return 0;
+    return;
 
 help:
     help_cmd(mon, "info");
-    return 0;
 }
 
 static void do_info_version_print(Monitor *mon, const QObject *data)
qemu-monitor.hx +1 -2
index 49bcd8d..57d28ac 100644
@@ -1654,8 +1654,7 @@ EQMP
         .args_type  = "item:s?",
         .params     = "[subcommand]",
         .help       = "show various information about the system state",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_info,
+        .mhandler.cmd = do_info,
     },
 
 STEXI
Signature · 1 line
1.7.3.1.45.g9855b
#7 lore raw

PATCH v2 7/19 Monitor: Introduce the qmp-commands.hx file

In reply to Luiz Capitulino

This file contains a copy of the following information from the qemu-monitor.hx file:

o QObject handlers entries
o QMP documentation (all SQMP/EQMP sections)

Right now it's only used to generate the QMP docs in QMP/, but next commits will turn this into QMP's command dispatch table.

It's important to note that QObject handlers entries are going to get duplicated: they will exist in both QMP's and HMP's dispatch tables.

This will be fixed in the near future, when we add a proper QMP call interface and HMP is converted to use it. This way we can completely drop QObject handlers entries from HMP's tables.

NOTE: HMP specific constructions, like "q|quit", have been dropped.

---
 Makefile        |    2 +-
 QMP/README      |    2 +-
 qmp-commands.hx | 1541 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1543 insertions(+), 2 deletions(-)
 create mode 100644 qmp-commands.hx
Makefile +1 -1
index fca1e7a..938d88b 100644
@@ -252,7 +252,7 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
-QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
 
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
QMP/README +1 -1
index 948d445..7e2b51a 100644
@@ -82,7 +82,7 @@ doing any code change. This is so because:
   2. Review can improve your interface.  Letting that happen before
      you implement it can save you work.
 
-* The qmp-commands.txt file is generated from the qemu-monitor.hx one, which
+* The qmp-commands.txt file is generated from the qmp-commands.hx one, which
   is the file that should be edited.
 
 Homepage
qmp-commands.hx new file +1541 -0

1,541 lines not on this page · raw message

Signature · 1 line
1.7.3.1.45.g9855b
#8 lore raw

PATCH v2 8/19 QMP: Introduce qmp_find_cmd()

In reply to Luiz Capitulino

Next commit needs this new function: it will introduce the the QMP's command dispatch table and qmp_find_cmd() will be used to search on it.

---
 monitor.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
monitor.c +6 -1
index c22f5d6..64baecb 100644
@@ -3362,6 +3362,11 @@ static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
     return search_dispatch_table(info_cmds, info_item);
 }
 
+static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
+{
+    return search_dispatch_table(mon_cmds, cmdname);
+}
+
 static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                                               const char *cmdline,
                                               QDict *qdict)
@@ -4345,7 +4350,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     } else if (strstart(cmd_name, "query-", &query_cmd)) {
         cmd = qmp_find_query_cmd(query_cmd);
     } else {
-        cmd = monitor_find_command(cmd_name);
+        cmd = qmp_find_cmd(cmd_name);
     }
 
     if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) {
Signature · 1 line
1.7.3.1.45.g9855b
#9 lore raw

PATCH v2 9/19 QMP: Introduce command dispatch table

In reply to Luiz Capitulino

Also update QMP functions to use it. The table is generated from the qmp-commands.hx file.

Quoted 1 line

From now on, QMP and HMP have different command dispatch

tables.

---
 Makefile.target |    7 +++++--
 monitor.c       |   11 +++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
Makefile.target +5 -2
index a4e80b1..f4ae37a 100644
@@ -299,7 +299,7 @@ obj-alpha-y = alpha_palcode.o
 
 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
 
-monitor.o: qemu-monitor.h
+monitor.o: qemu-monitor.h qmp-commands.h
 
 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
 
@@ -323,10 +323,13 @@ gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
 qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
+qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
+	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
+
 clean:
 	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
 	rm -f *.d */*.d tcg/*.o ide/*.o
-	rm -f qemu-monitor.h gdbstub-xml.c
+	rm -f qemu-monitor.h qmp-commands.h gdbstub-xml.c
 
 install: all
 ifneq ($(PROGS),)
monitor.c +9 -2
index 64baecb..8f58e18 100644
@@ -189,6 +189,8 @@ static QLIST_HEAD(mon_list, Monitor) mon_list;
 static const mon_cmd_t mon_cmds[];
 static const mon_cmd_t info_cmds[];
 
+static const mon_cmd_t qmp_cmds[];
+
 Monitor *cur_mon;
 Monitor *default_mon;
 
@@ -742,7 +744,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data)
 
     cmd_list = qlist_new();
 
-    for (cmd = mon_cmds; cmd->name != NULL; cmd++) {
+    for (cmd = qmp_cmds; cmd->name != NULL; cmd++) {
         if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd) &&
             !compare_cmd(cmd->name, "info")) {
             qlist_append_obj(cmd_list, get_cmd_dict(cmd->name));
@@ -2632,6 +2634,11 @@ static const mon_cmd_t info_cmds[] = {
     },
 };
 
+static const mon_cmd_t qmp_cmds[] = {
+#include "qmp-commands.h"
+    { /* NULL */ },
+};
+
 /*******************************************************************/
 
 static const char *pch;
@@ -3364,7 +3371,7 @@ static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
 
 static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
 {
-    return search_dispatch_table(mon_cmds, cmdname);
+    return search_dispatch_table(qmp_cmds, cmdname);
 }
 
 static const mon_cmd_t *monitor_parse_command(Monitor *mon,
Signature · 1 line
1.7.3.1.45.g9855b
#10 lore raw

PATCH v2 10/19 QMP: Introduce query commands dispatch table

In reply to Luiz Capitulino

The new table is a copy of HMP's table, containing only QObject handlers.

In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table.

Quoted 1 line

From now on, QMP and HMP have different query command dispatch

tables.

---
 monitor.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 128 insertions(+), 2 deletions(-)
monitor.c +128 -2
index 8f58e18..7cb66df 100644
@@ -190,6 +190,7 @@ static const mon_cmd_t mon_cmds[];
 static const mon_cmd_t info_cmds[];
 
 static const mon_cmd_t qmp_cmds[];
+static const mon_cmd_t qmp_query_cmds[];
 
 Monitor *cur_mon;
 Monitor *default_mon;
@@ -751,7 +752,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data)
         }
     }
 
-    for (cmd = info_cmds; cmd->name != NULL; cmd++) {
+    for (cmd = qmp_query_cmds; cmd->name != NULL; cmd++) {
         if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd)) {
             char buf[128];
             snprintf(buf, sizeof(buf), "query-%s", cmd->name);
@@ -2639,6 +2640,131 @@ static const mon_cmd_t qmp_cmds[] = {
     { /* NULL */ },
 };
 
+static const mon_cmd_t qmp_query_cmds[] = {
+    {
+        .name       = "version",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the version of QEMU",
+        .user_print = do_info_version_print,
+        .mhandler.info_new = do_info_version,
+    },
+    {
+        .name       = "commands",
+        .args_type  = "",
+        .params     = "",
+        .help       = "list QMP available commands",
+        .user_print = monitor_user_noop,
+        .mhandler.info_new = do_info_commands,
+    },
+    {
+        .name       = "chardev",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the character devices",
+        .user_print = qemu_chr_info_print,
+        .mhandler.info_new = qemu_chr_info,
+    },
+    {
+        .name       = "block",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the block devices",
+        .user_print = bdrv_info_print,
+        .mhandler.info_new = bdrv_info,
+    },
+    {
+        .name       = "blockstats",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show block device statistics",
+        .user_print = bdrv_stats_print,
+        .mhandler.info_new = bdrv_info_stats,
+    },
+    {
+        .name       = "cpus",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show infos for each CPU",
+        .user_print = monitor_print_cpus,
+        .mhandler.info_new = do_info_cpus,
+    },
+    {
+        .name       = "pci",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show PCI info",
+        .user_print = do_pci_info_print,
+        .mhandler.info_new = do_pci_info,
+    },
+    {
+        .name       = "kvm",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show KVM information",
+        .user_print = do_info_kvm_print,
+        .mhandler.info_new = do_info_kvm,
+    },
+    {
+        .name       = "status",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM status (running|paused)",
+        .user_print = do_info_status_print,
+        .mhandler.info_new = do_info_status,
+    },
+    {
+        .name       = "mice",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest mouse is receiving events",
+        .user_print = do_info_mice_print,
+        .mhandler.info_new = do_info_mice,
+    },
+    {
+        .name       = "vnc",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the vnc server status",
+        .user_print = do_info_vnc_print,
+        .mhandler.info_new = do_info_vnc,
+    },
+    {
+        .name       = "name",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM name",
+        .user_print = do_info_name_print,
+        .mhandler.info_new = do_info_name,
+    },
+    {
+        .name       = "uuid",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM UUID",
+        .user_print = do_info_uuid_print,
+        .mhandler.info_new = do_info_uuid,
+    },
+    {
+        .name       = "migrate",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show migration status",
+        .user_print = do_info_migrate_print,
+        .mhandler.info_new = do_info_migrate,
+    },
+    {
+        .name       = "balloon",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show balloon information",
+        .user_print = monitor_print_balloon,
+        .mhandler.info_async = do_info_balloon,
+        .flags      = MONITOR_CMD_ASYNC,
+    },
+    { /* NULL */ },
+};
+
 /*******************************************************************/
 
 static const char *pch;
@@ -3366,7 +3492,7 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname)
 
 static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
 {
-    return search_dispatch_table(info_cmds, info_item);
+    return search_dispatch_table(qmp_query_cmds, info_item);
 }
 
 static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
Signature · 1 line
1.7.3.1.45.g9855b
#11 lore raw

[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table

Quoted 9 lines · Luiz Capitulino

The new table is a copy of HMP's table, containing only QObject handlers.

In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table.

Quoted 1 line

From now on, QMP and HMP have different query command dispatch

tables.

I like this series a lot and I think it's ready to merge.

But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds?

Regards,

Anthony Liguori

Quoted 168 lines
---
  monitor.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 files changed, 128 insertions(+), 2 deletions(-)
monitor.c +128 -2
index 8f58e18..7cb66df 100644
@@ -190,6 +190,7 @@ static const mon_cmd_t mon_cmds[];
  static const mon_cmd_t info_cmds[];
 
  static const mon_cmd_t qmp_cmds[];
+static const mon_cmd_t qmp_query_cmds[];
 
  Monitor *cur_mon;
  Monitor *default_mon;
@@ -751,7 +752,7 @@ static void do_info_commands(Monitor *mon, QObject **ret_data)
          }
      }
 
-    for (cmd = info_cmds; cmd->name != NULL; cmd++) {
+    for (cmd = qmp_query_cmds; cmd->name != NULL; cmd++) {
          if (monitor_handler_ported(cmd)&&  !monitor_cmd_user_only(cmd)) {
              char buf[128];
              snprintf(buf, sizeof(buf), "query-%s", cmd->name);
@@ -2639,6 +2640,131 @@ static const mon_cmd_t qmp_cmds[] = {
      { /* NULL */ },
  };
 
+static const mon_cmd_t qmp_query_cmds[] = {
+    {
+        .name       = "version",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the version of QEMU",
+        .user_print = do_info_version_print,
+        .mhandler.info_new = do_info_version,
+    },
+    {
+        .name       = "commands",
+        .args_type  = "",
+        .params     = "",
+        .help       = "list QMP available commands",
+        .user_print = monitor_user_noop,
+        .mhandler.info_new = do_info_commands,
+    },
+    {
+        .name       = "chardev",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the character devices",
+        .user_print = qemu_chr_info_print,
+        .mhandler.info_new = qemu_chr_info,
+    },
+    {
+        .name       = "block",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the block devices",
+        .user_print = bdrv_info_print,
+        .mhandler.info_new = bdrv_info,
+    },
+    {
+        .name       = "blockstats",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show block device statistics",
+        .user_print = bdrv_stats_print,
+        .mhandler.info_new = bdrv_info_stats,
+    },
+    {
+        .name       = "cpus",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show infos for each CPU",
+        .user_print = monitor_print_cpus,
+        .mhandler.info_new = do_info_cpus,
+    },
+    {
+        .name       = "pci",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show PCI info",
+        .user_print = do_pci_info_print,
+        .mhandler.info_new = do_pci_info,
+    },
+    {
+        .name       = "kvm",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show KVM information",
+        .user_print = do_info_kvm_print,
+        .mhandler.info_new = do_info_kvm,
+    },
+    {
+        .name       = "status",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM status (running|paused)",
+        .user_print = do_info_status_print,
+        .mhandler.info_new = do_info_status,
+    },
+    {
+        .name       = "mice",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest mouse is receiving events",
+        .user_print = do_info_mice_print,
+        .mhandler.info_new = do_info_mice,
+    },
+    {
+        .name       = "vnc",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the vnc server status",
+        .user_print = do_info_vnc_print,
+        .mhandler.info_new = do_info_vnc,
+    },
+    {
+        .name       = "name",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM name",
+        .user_print = do_info_name_print,
+        .mhandler.info_new = do_info_name,
+    },
+    {
+        .name       = "uuid",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current VM UUID",
+        .user_print = do_info_uuid_print,
+        .mhandler.info_new = do_info_uuid,
+    },
+    {
+        .name       = "migrate",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show migration status",
+        .user_print = do_info_migrate_print,
+        .mhandler.info_new = do_info_migrate,
+    },
+    {
+        .name       = "balloon",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show balloon information",
+        .user_print = monitor_print_balloon,
+        .mhandler.info_async = do_info_balloon,
+        .flags      = MONITOR_CMD_ASYNC,
+    },
+    { /* NULL */ },
+};
+
  /*******************************************************************/
 
  static const char *pch;
@@ -3366,7 +3492,7 @@ static const mon_cmd_t *monitor_find_command(const char *cmdname)
 
  static const mon_cmd_t *qmp_find_query_cmd(const char *info_item)
  {
-    return search_dispatch_table(info_cmds, info_item);
+    return search_dispatch_table(qmp_query_cmds, info_item);
  }
 
  static const mon_cmd_t *qmp_find_cmd(const char *cmdname)
#12 lore raw

[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table

Quoted 7 lines · On Fri, 01 Oct 2010 08:31:11 -0500 Anthony Liguori…
Quoted 6 lines · Luiz Capitulino

The new table is a copy of HMP's table, containing only QObject handlers.

In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

From now on, QMP and HMP have different query command dispatch

tables.

I like this series a lot and I think it's ready to merge.

But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds?

Yes, that will be done shortly, but in a different series.

I'm not doing it in this series because it's necessary to change the signature of all those functions which would make this series too large and harder to review.

On a related note: I have more monitor patches in my queue. I'm building and testing them right now. I'm planning to send a pull request of all pending monitor patches later today. So, if you prefer, you can wait for that pull request instead of merging this series alone.

It will generate some noise on the list though, as I think it's good practice to resend patches in a pull request to the list.

Reviewed-by
#13 lore raw

[Qemu-devel] Re: [PATCH 10/19] QMP: Introduce query commands dispatch table

Quoted 18 lines · Luiz Capitulino
Quoted 14 lines · On Fri, 01 Oct 2010 08:31:11 -0500 Anthony…
Quoted 12 lines · Luiz Capitulino

The new table is a copy of HMP's table, containing only QObject handlers.

In the near future HMP will be making QMP calls and then we will be able to drop QObject handlers from HMP's table.

Quoted 2 lines

From now on, QMP and HMP have different query command dispatch

tables.

Quoted 7 lines
Quoted 5 lines

I like this series a lot and I think it's ready to merge.

But I wonder, why have a separate qmp_query_cmds table? Why not just fold the query commands into qmp_cmds?

Yes, that will be done shortly, but in a different series.

Perfect :-)

Quoted 9 lines

I'm not doing it in this series because it's necessary to change the signature of all those functions which would make this series too large and harder to review.

On a related note: I have more monitor patches in my queue. I'm building and testing them right now. I'm planning to send a pull request of all pending monitor patches later today. So, if you prefer, you can wait for that pull request instead of merging this series alone.

Yes, let's do that. This whole series:

Regards,

Anthony Liguori

Quoted 3 lines

It will generate some noise on the list though, as I think it's good practice to resend patches in a pull request to the list.

#14 lore raw

PATCH v2 11/19 QMP: Simplify do_info_commands()

In reply to Luiz Capitulino

We now iterate over QMP's dispatch tables, no need to check for QMP-only handlers anymore.

---
 monitor.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
monitor.c +4 -9
index 7cb66df..dbf6e18 100644
@@ -746,18 +746,13 @@ static void do_info_commands(Monitor *mon, QObject **ret_data)
     cmd_list = qlist_new();
 
     for (cmd = qmp_cmds; cmd->name != NULL; cmd++) {
-        if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd) &&
-            !compare_cmd(cmd->name, "info")) {
-            qlist_append_obj(cmd_list, get_cmd_dict(cmd->name));
-        }
+        qlist_append_obj(cmd_list, get_cmd_dict(cmd->name));
     }
 
     for (cmd = qmp_query_cmds; cmd->name != NULL; cmd++) {
-        if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd)) {
-            char buf[128];
-            snprintf(buf, sizeof(buf), "query-%s", cmd->name);
-            qlist_append_obj(cmd_list, get_cmd_dict(buf));
-        }
+        char buf[128];
+        snprintf(buf, sizeof(buf), "query-%s", cmd->name);
+        qlist_append_obj(cmd_list, get_cmd_dict(buf));
     }
 
     *ret_data = QOBJECT(cmd_list);
Signature · 1 line
1.7.3.1.45.g9855b
#15 lore raw

PATCH v2 12/19 QMP: Small cleanup in handle_qmp_command()

In reply to Luiz Capitulino

QMP has its own dispatch tables, we can now drop the following checks:

o 'info' command: this command doesn't exist in QMP's dispatch table, the right thing will happen when it's issued by a client (ie. command not found error)

o monitor_handler_ported(): all QMP handlers are 'ported', no need to check for that

o monitor_cmd_user_only(): no HMP handler will exist in QMP's dispatch tables, that's why we have split them after all :-)

---
 monitor.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
monitor.c +2 -8
index dbf6e18..bc8d054 100644
@@ -4469,19 +4469,13 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
         goto err_out;
     }
 
-    /*
-     * XXX: We need this special case until QMP has its own dispatch table
-     */
-    if (compare_cmd(cmd_name, "info")) {
-        qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
-        goto err_out;
-    } else if (strstart(cmd_name, "query-", &query_cmd)) {
+    if (strstart(cmd_name, "query-", &query_cmd)) {
         cmd = qmp_find_query_cmd(query_cmd);
     } else {
         cmd = qmp_find_cmd(cmd_name);
     }
 
-    if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) {
+    if (!cmd) {
         qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
         goto err_out;
     }
Signature · 1 line
1.7.3.1.45.g9855b
#16 lore raw

PATCH v2 13/19 Monitor: Drop QMP info from the qemu-monitor.hx file

In reply to Luiz Capitulino

QMP has its own dispatch table and documentation file (qmp-commands.hx), we can now drop the following QMP specific info from qemu-monitor.hx:

o SQMP/EQMP sections
o The qmp_capabilities command
o The query-commands command

However, note that QObject handlers entries are not being removed. This will only happen when we introduce a proper QMP call interface.

---
 monitor.c       |    8 -
 qemu-monitor.hx | 1358 -------------------------------------------------------
 2 files changed, 0 insertions(+), 1366 deletions(-)
monitor.c +0 -8
index bc8d054..572752d 100644
@@ -2349,14 +2349,6 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_version,
     },
     {
-        .name       = "commands",
-        .args_type  = "",
-        .params     = "",
-        .help       = "list QMP available commands",
-        .user_print = monitor_user_noop,
-        .mhandler.info_new = do_info_commands,
-    },
-    {
         .name       = "network",
         .args_type  = "",
         .params     = "",
qemu-monitor.hx +0 -1358

1,582 lines not on this page · raw message

Signature · 1 line
1.7.3.1.45.g9855b
#17 lore raw

PATCH v2 14/19 Monitor: Drop monitor_cmd_user_only()

In reply to Luiz Capitulino

This function was only needed when QMP and HMP were sharing dispatch tables, this is no longer true so just drop it.

---
 monitor.c |    5 -----
 monitor.h |    1 -
 2 files changed, 0 insertions(+), 6 deletions(-)
monitor.c +0 -5
index 572752d..5913c73 100644
@@ -340,11 +340,6 @@ static inline bool monitor_handler_is_async(const mon_cmd_t *cmd)
     return cmd->flags & MONITOR_CMD_ASYNC;
 }
 
-static inline bool monitor_cmd_user_only(const mon_cmd_t *cmd)
-{
-    return (cmd->flags & MONITOR_CMD_USER_ONLY);
-}
-
 static inline int monitor_has_error(const Monitor *mon)
 {
     return mon->error != NULL;
monitor.h +0 -1
index 38b22a4..9582b9c 100644
@@ -17,7 +17,6 @@ extern Monitor *default_mon;
 
 /* flags for monitor commands */
 #define MONITOR_CMD_ASYNC       0x0001
-#define MONITOR_CMD_USER_ONLY   0x0002
 
 /* QMP events */
 typedef enum MonitorEvent {
Signature · 1 line
1.7.3.1.45.g9855b
#18 lore raw

PATCH v2 15/19 Monitor: Rename monitor_handler_ported()

In reply to Luiz Capitulino

That name makes no sense anymore, as dispatch tables have been split, a better name is handler_is_qobject(), which really communicates the handler's type.

---
 monitor.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
monitor.c +3 -3
index 5913c73..91473f4 100644
@@ -330,7 +330,7 @@ static int monitor_fprintf(FILE *stream, const char *fmt, ...)
 
 static void monitor_user_noop(Monitor *mon, const QObject *data) { }
 
-static inline int monitor_handler_ported(const mon_cmd_t *cmd)
+static inline int handler_is_qobject(const mon_cmd_t *cmd)
 {
     return cmd->user_print != NULL;
 }
@@ -651,7 +651,7 @@ static void do_info(Monitor *mon, const QDict *qdict)
 
     if (monitor_handler_is_async(cmd)) {
         user_async_info_handler(mon, cmd);
-    } else if (monitor_handler_ported(cmd)) {
+    } else if (handler_is_qobject(cmd)) {
         QObject *info_data = NULL;
 
         cmd->mhandler.info_new(mon, &info_data);
@@ -3913,7 +3913,7 @@ static void handle_user_command(Monitor *mon, const char *cmdline)
 
     if (monitor_handler_is_async(cmd)) {
         user_async_cmd_handler(mon, cmd, qdict);
-    } else if (monitor_handler_ported(cmd)) {
+    } else if (handler_is_qobject(cmd)) {
         monitor_call_handler(mon, cmd, qdict);
     } else {
         cmd->mhandler.cmd(mon, qdict);
Signature · 1 line
1.7.3.1.45.g9855b
#19 lore raw

PATCH v2 16/19 Monitor: Rename monitor_handler_is_async()

In reply to Luiz Capitulino

Let's follow the convention introduced by the previous commit and call it handler_is_async().

---
 monitor.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
monitor.c +5 -5
index 91473f4..a48f919 100644
@@ -335,7 +335,7 @@ static inline int handler_is_qobject(const mon_cmd_t *cmd)
     return cmd->user_print != NULL;
 }
 
-static inline bool monitor_handler_is_async(const mon_cmd_t *cmd)
+static inline bool handler_is_async(const mon_cmd_t *cmd)
 {
     return cmd->flags & MONITOR_CMD_ASYNC;
 }
@@ -649,7 +649,7 @@ static void do_info(Monitor *mon, const QDict *qdict)
         goto help;
     }
 
-    if (monitor_handler_is_async(cmd)) {
+    if (handler_is_async(cmd)) {
         user_async_info_handler(mon, cmd);
     } else if (handler_is_qobject(cmd)) {
         QObject *info_data = NULL;
@@ -3911,7 +3911,7 @@ static void handle_user_command(Monitor *mon, const char *cmdline)
     if (!cmd)
         goto out;
 
-    if (monitor_handler_is_async(cmd)) {
+    if (handler_is_async(cmd)) {
         user_async_cmd_handler(mon, cmd, qdict);
     } else if (handler_is_qobject(cmd)) {
         monitor_call_handler(mon, cmd, qdict);
@@ -4408,7 +4408,7 @@ static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd)
 {
     QObject *ret_data = NULL;
 
-    if (monitor_handler_is_async(cmd)) {
+    if (handler_is_async(cmd)) {
         qmp_async_info_handler(mon, cmd);
         if (monitor_has_error(mon)) {
             monitor_protocol_emitter(mon, NULL);
@@ -4482,7 +4482,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
 
     if (query_cmd) {
         qmp_call_query_cmd(mon, cmd);
-    } else if (monitor_handler_is_async(cmd)) {
+    } else if (handler_is_async(cmd)) {
         err = qmp_async_cmd_handler(mon, cmd, args);
         if (err) {
             /* emit the error response */
Signature · 1 line
1.7.3.1.45.g9855b
#20 lore raw

PATCH v2 17/19 Monitor: Directly call QObject handlers

In reply to Luiz Capitulino

This avoids handle_user_command() calling monitor_call_handler(), which is currently shared with QMP.

---
 monitor.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
monitor.c +9 -1
index a48f919..adc5bbd 100644
@@ -3914,7 +3914,15 @@ static void handle_user_command(Monitor *mon, const char *cmdline)
     if (handler_is_async(cmd)) {
         user_async_cmd_handler(mon, cmd, qdict);
     } else if (handler_is_qobject(cmd)) {
-        monitor_call_handler(mon, cmd, qdict);
+        QObject *data = NULL;
+
+        /* XXX: ignores the error code */
+        cmd->mhandler.cmd_new(mon, qdict, &data);
+        assert(!monitor_has_error(mon));
+        if (data) {
+            cmd->user_print(mon, data);
+            qobject_decref(data);
+        }
     } else {
         cmd->mhandler.cmd(mon, qdict);
     }
Signature · 1 line
1.7.3.1.45.g9855b
#21 lore raw

PATCH v2 18/19 QMP: Introduce qmp_call_cmd()

In reply to Luiz Capitulino

Calls a QObject handler and emits the QMP response, also drops monitor_call_handler() which is now unused.

---
 monitor.c |   39 +++++++++++++++------------------------
 1 files changed, 15 insertions(+), 24 deletions(-)
monitor.c +15 -24
index adc5bbd..d4ac81a 100644
@@ -3877,29 +3877,6 @@ static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
     }
 }
 
-static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,
-                                 const QDict *params)
-{
-    int ret;
-    QObject *data = NULL;
-
-    mon_print_count_init(mon);
-
-    ret = cmd->mhandler.cmd_new(mon, params, &data);
-    handler_audit(mon, cmd, ret);
-
-    if (monitor_ctrl_mode(mon)) {
-        /* Monitor Protocol */
-        monitor_protocol_emitter(mon, data);
-    } else {
-        /* User Protocol */
-         if (data)
-            cmd->user_print(mon, data);
-    }
-
-    qobject_decref(data);
-}
-
 static void handle_user_command(Monitor *mon, const char *cmdline)
 {
     QDict *qdict;
@@ -4430,6 +4407,20 @@ static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd)
     }
 }
 
+static void qmp_call_cmd(Monitor *mon, const mon_cmd_t *cmd,
+                         const QDict *params)
+{
+    int ret;
+    QObject *data = NULL;
+
+    mon_print_count_init(mon);
+
+    ret = cmd->mhandler.cmd_new(mon, params, &data);
+    handler_audit(mon, cmd, ret);
+    monitor_protocol_emitter(mon, data);
+    qobject_decref(data);
+}
+
 static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
 {
     int err;
@@ -4497,7 +4488,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
             goto err_out;
         }
     } else {
-        monitor_call_handler(mon, cmd, args);
+        qmp_call_cmd(mon, cmd, args);
     }
 
     goto out;
Signature · 1 line
1.7.3.1.45.g9855b
#22 lore raw

PATCH v2 19/19 Monitor: Rename the qemu-monitor.hx file

In reply to Luiz Capitulino

Let's be consistent and call it hmp-commands.hx, so that we have qmp-commands.hx for QMP and hmp-commands.hx for HMP.

Please, note that this commit doesn't touch qemu-monitor.texi. All texi files have the qemu- prefix and I don't think it's worth changing that.

---
 Makefile        |    2 +-
 Makefile.target |    6 +-
 hmp-commands.hx | 1216 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c       |    4 +-
 qemu-monitor.hx | 1216 -------------------------------------------------------
 5 files changed, 1222 insertions(+), 1222 deletions(-)
 create mode 100644 hmp-commands.hx
 delete mode 100644 qemu-monitor.hx
Makefile +1 -1
index 938d88b..3f42fe2 100644
@@ -249,7 +249,7 @@ TEXIFLAG=$(if $(V),,--quiet)
 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
+qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
 QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
Makefile.target +3 -3
index f4ae37a..d68ec3a 100644
@@ -299,7 +299,7 @@ obj-alpha-y = alpha_palcode.o
 
 main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
 
-monitor.o: qemu-monitor.h qmp-commands.h
+monitor.o: hmp-commands.h qmp-commands.h
 
 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
 
@@ -320,7 +320,7 @@ $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
 	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
 
-qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
+hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
 qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
@@ -329,7 +329,7 @@ qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
 clean:
 	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
 	rm -f *.d */*.d tcg/*.o ide/*.o
-	rm -f qemu-monitor.h qmp-commands.h gdbstub-xml.c
+	rm -f hmp-commands.h qmp-commands.h gdbstub-xml.c
 
 install: all
 ifneq ($(PROGS),)
hmp-commands.hx new file +1216 -0

1,216 lines not on this page · raw message

monitor.c +2 -2
index d4ac81a..1819b67 100644
@@ -2329,11 +2329,11 @@ int monitor_get_fd(Monitor *mon, const char *fdname)
 }
 
 static const mon_cmd_t mon_cmds[] = {
-#include "qemu-monitor.h"
+#include "hmp-commands.h"
     { NULL, NULL, },
 };
 
-/* Please update qemu-monitor.hx when adding or changing commands */
+/* Please update hmp-commands.hx when adding or changing commands */
 static const mon_cmd_t info_cmds[] = {
     {
         .name       = "version",
qemu-monitor.hx deleted +0 -1216

1,216 lines not on this page · raw message

Signature · 1 line
1.7.3.1.45.g9855b
#23 lore raw
In reply to Luiz Capitulino
Quoted 6 lines · Luiz Capitulino

This is a respin with the following small changes:

v1 - v2:
o Renamed qemu-monitor-qmp.hx to qmp-commands.hx
o Added a new patch which renames qemu-monitor.hx to hmp-commands.hx
o Other minor changes

ACK