qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 09/15] vl: add a new -qmp2 option to expose experime


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 09/15] vl: add a new -qmp2 option to expose experimental QMP server
Date: Fri, 11 Mar 2011 17:05:39 -0600

This is temporary until we implement all QMP commands.

Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/qemu-options.hx b/qemu-options.hx
index badb730..957d935 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1881,6 +1881,9 @@ serial port).
 The default device is @code{vc} in graphical mode and @code{stdio} in
 non graphical mode.
 ETEXI
+DEF("qmp2", HAS_ARG, QEMU_OPTION_qmp2, \
+    "-qmp2 chardev   experimental QMP server\n",
+    QEMU_ARCH_ALL)
 DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
     "-qmp dev        like -monitor but opens in 'control' mode\n",
     QEMU_ARCH_ALL)
diff --git a/vl.c b/vl.c
index d27e750..1d1d536 100644
--- a/vl.c
+++ b/vl.c
@@ -160,6 +160,7 @@ int main(int argc, char **argv)
 #include "qemu-queue.h"
 #include "cpus.h"
 #include "arch_init.h"
+#include "qmp-core.h"
 
 #include "ui/qemu-spice.h"
 
@@ -1915,6 +1916,8 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
     return popt;
 }
 
+#define MAX_QMP_CHARDEVS 16
+
 int main(int argc, char **argv, char **envp)
 {
     const char *gdbstub_dev = NULL;
@@ -1940,6 +1943,8 @@ int main(int argc, char **argv, char **envp)
     int show_vnc_port = 0;
     int defconfig = 1;
     const char *trace_file = NULL;
+    int nb_qmp_chardevs = 0;
+    const char *qmp_chardevs[MAX_QMP_CHARDEVS];
 
     atexit(qemu_run_exit_notifiers);
     error_set_progname(argv[0]);
@@ -2387,6 +2392,13 @@ int main(int argc, char **argv, char **envp)
                 monitor_parse(optarg, "control");
                 default_monitor = 0;
                 break;
+            case QEMU_OPTION_qmp2:
+                if (nb_qmp_chardevs == MAX_QMP_CHARDEVS) {
+                    fprintf(stderr, "-qmp: too many QMP chardevs\n");
+                    exit(1);
+                }
+                qmp_chardevs[nb_qmp_chardevs++] = optarg;
+                break;
             case QEMU_OPTION_mon:
                 opts = qemu_opts_parse(qemu_find_opts("mon"), optarg, 1);
                 if (!opts) {
@@ -3084,6 +3096,15 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 
+    for (i = 0; i < nb_qmp_chardevs; i++) {
+        CharDriverState *chr = qemu_chr_find(qmp_chardevs[i]);
+        if (chr == NULL) {
+            fprintf(stderr, "-qmp: unknown chardev `%s'\n", qmp_chardevs[i]);
+            exit(1);
+        }
+        qmp_init_chardev(chr);
+    }
+
     /* display setup */
     dpy_resize(ds);
     dcl = ds->listeners;
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]