qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/6] Allow multiple monitor devices (v2)
@ 2009-04-08 18:34 Anthony Liguori
  2009-04-08 18:34 ` [Qemu-devel] [PATCH 2/6] Introduce monitor 'wait' command (v2) Anthony Liguori
                   ` (2 more replies)
  0 siblings, 3 replies; 63+ messages in thread
From: Anthony Liguori @ 2009-04-08 18:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Anthony Liguori, Jan Kiszka, Hollis Blanchard

Right now only one monitor device can be enabled at a time.  In order to support
asynchronous notification of events, I would like to introduce a 'wait' command
that waits for an event to occur.  This implies that we need an additional
monitor session to allow commands to still be executed while waiting for an
asynchronous notification.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/vl.c b/vl.c
index 4bd173f..f78cabb 100644
--- a/vl.c
+++ b/vl.c
@@ -184,6 +184,9 @@ int main(int argc, char **argv)
 /* Max number of bluetooth switches on the commandline.  */
 #define MAX_BT_CMDLINE 10
 
+/* Maximum number of monitor devices */
+#define MAX_MONITOR_DEVICES 10
+
 /* XXX: use a two level table to limit memory usage */
 #define MAX_IOPORTS 65536
 
@@ -4252,8 +4255,9 @@ int main(int argc, char **argv, char **envp)
     int hda_index;
     int optind;
     const char *r, *optarg;
-    CharDriverState *monitor_hd = NULL;
-    const char *monitor_device;
+    CharDriverState *monitor_hds[MAX_MONITOR_DEVICES];
+    const char *monitor_devices[MAX_MONITOR_DEVICES];
+    int monitor_device_index;
     const char *serial_devices[MAX_SERIAL_PORTS];
     int serial_device_index;
     const char *parallel_devices[MAX_PARALLEL_PORTS];
@@ -4324,7 +4328,6 @@ int main(int argc, char **argv, char **envp)
     kernel_cmdline = "";
     cyls = heads = secs = 0;
     translation = BIOS_ATA_TRANSLATION_AUTO;
-    monitor_device = "vc:80Cx24C";
 
     serial_devices[0] = "vc:80Cx24C";
     for(i = 1; i < MAX_SERIAL_PORTS; i++)
@@ -4340,6 +4343,11 @@ int main(int argc, char **argv, char **envp)
         virtio_consoles[i] = NULL;
     virtio_console_index = 0;
 
+    monitor_devices[0] = "vc:80Cx24C";
+    for (i = 1; i < MAX_MONITOR_DEVICES; i++)
+        monitor_devices[i] = NULL;
+    monitor_device_index = 0;
+
     usb_devices_index = 0;
 
     nb_net_clients = 0;
@@ -4723,7 +4731,12 @@ int main(int argc, char **argv, char **envp)
                     break;
                 }
             case QEMU_OPTION_monitor:
-                monitor_device = optarg;
+                if (monitor_device_index >= MAX_MONITOR_DEVICES) {
+                    fprintf(stderr, "qemu: too many monitor devices\n");
+                    exit(1);
+                }
+                monitor_devices[monitor_device_index] = optarg;
+                monitor_device_index++;
                 break;
             case QEMU_OPTION_serial:
                 if (serial_device_index >= MAX_SERIAL_PORTS) {
@@ -4974,8 +4987,8 @@ int main(int argc, char **argv, char **envp)
            serial_devices[0] = "stdio";
        if (parallel_device_index == 0)
            parallel_devices[0] = "null";
-       if (strncmp(monitor_device, "vc", 2) == 0)
-           monitor_device = "stdio";
+       if (strncmp(monitor_devices[0], "vc", 2) == 0)
+           monitor_devices[0] = "stdio";
     }
 
 #ifndef _WIN32
@@ -5184,14 +5197,14 @@ int main(int argc, char **argv, char **envp)
 #endif
 
     /* Maintain compatibility with multiple stdio monitors */
-    if (!strcmp(monitor_device,"stdio")) {
+    if (!strcmp(monitor_devices[0],"stdio")) {
         for (i = 0; i < MAX_SERIAL_PORTS; i++) {
             const char *devname = serial_devices[i];
             if (devname && !strcmp(devname,"mon:stdio")) {
-                monitor_device = NULL;
+                monitor_devices[0] = NULL;
                 break;
             } else if (devname && !strcmp(devname,"stdio")) {
-                monitor_device = NULL;
+                monitor_devices[0] = NULL;
                 serial_devices[i] = "mon:stdio";
                 break;
             }
@@ -5208,11 +5221,20 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
-    if (monitor_device) {
-        monitor_hd = qemu_chr_open("monitor", monitor_device, NULL);
-        if (!monitor_hd) {
-            fprintf(stderr, "qemu: could not open monitor device '%s'\n", monitor_device);
-            exit(1);
+    for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
+        const char *devname = monitor_devices[i];
+        if (devname && strcmp(devname, "none")) {
+            char label[32];
+            if (i == 0)
+                snprintf(label, sizeof(label), "monitor");
+            else
+                snprintf(label, sizeof(label), "monitor%d", i);
+            monitor_hds[i] = qemu_chr_open(label, devname, NULL);
+            if (!monitor_hds[i]) {
+                fprintf(stderr, "qemu: could not open monitor device '%s'\n",
+                        devname);
+                exit(1);
+            }
         }
     }
 
@@ -5335,8 +5357,13 @@ int main(int argc, char **argv, char **envp)
     text_consoles_set_display(display_state);
     qemu_chr_initial_reset();
 
-    if (monitor_device && monitor_hd)
-        monitor_init(monitor_hd, MONITOR_USE_READLINE | MONITOR_IS_DEFAULT);
+    for (i = 0; i < MAX_MONITOR_DEVICES; i++) {
+        if (monitor_devices[i] && monitor_hds[i]) {
+            monitor_init(monitor_hds[i],
+                         MONITOR_USE_READLINE |
+                         ((i == 0) ? MONITOR_IS_DEFAULT : 0));
+        }
+    }
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         const char *devname = serial_devices[i];

^ permalink raw reply related	[flat|nested] 63+ messages in thread

end of thread, other threads:[~2009-05-12  8:49 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 18:34 [Qemu-devel] [PATCH 1/6] Allow multiple monitor devices (v2) Anthony Liguori
2009-04-08 18:34 ` [Qemu-devel] [PATCH 2/6] Introduce monitor 'wait' command (v2) Anthony Liguori
2009-04-08 18:34   ` [Qemu-devel] [PATCH 3/6] Introduce wait filtering (v2) Anthony Liguori
2009-04-08 18:35     ` [Qemu-devel] [PATCH 4/6] Document new events (v2) Anthony Liguori
2009-04-08 18:35       ` [Qemu-devel] [PATCH 5/6] Implement vm-state notifications (v2) Anthony Liguori
2009-04-08 18:35         ` [Qemu-devel] [PATCH 6/6] Implement vnc-event " Anthony Liguori
2009-04-08 18:43   ` [Qemu-devel] Re: [PATCH 2/6] Introduce monitor 'wait' command (v2) Anthony Liguori
2009-04-08 19:01   ` [Qemu-devel] " Blue Swirl
2009-04-08 19:02     ` Anthony Liguori
2009-04-09 11:01   ` Avi Kivity
2009-04-09 13:40     ` Anthony Liguori
2009-04-09 13:58       ` Avi Kivity
2009-04-09 14:19         ` Jan Kiszka
2009-04-09  8:19 ` [Qemu-devel] [PATCH 1/6] Allow multiple monitor devices (v2) Avi Kivity
2009-04-09 13:28   ` Anthony Liguori
2009-04-09 13:40     ` Avi Kivity
2009-04-09 13:47       ` Anthony Liguori
2009-04-09 14:03         ` Avi Kivity
2009-04-09 14:13           ` Anthony Liguori
2009-04-09 14:28             ` Avi Kivity
2009-04-09 14:30               ` Anthony Liguori
2009-04-09 14:37                 ` Avi Kivity
2009-04-09 14:57                   ` Anthony Liguori
2009-04-09 15:11                     ` Avi Kivity
2009-04-09 15:40                       ` Anthony Liguori
2009-04-09 15:57                         ` Avi Kivity
2009-04-09 16:09                           ` Anthony Liguori
2009-04-09 16:30                             ` Avi Kivity
2009-04-09 16:42                               ` Anthony Liguori
2009-04-09 17:00                                 ` Avi Kivity
2009-04-09 17:40                                   ` Anthony Liguori
2009-04-11 16:25                                     ` Avi Kivity
2009-04-11 20:18                                       ` Anthony Liguori
2009-04-11 21:14                                         ` Avi Kivity
2009-04-12 18:42                                           ` Jamie Lokier
2009-04-14  8:30                                             ` [libvirt] " Daniel P. Berrange
2009-04-14  9:15                                               ` Avi Kivity
2009-04-14  9:17                                                 ` Daniel P. Berrange
2009-04-14  9:29                                                   ` Jan Kiszka
2009-04-14  9:36                                                     ` Avi Kivity
2009-04-14  9:38                                                   ` Avi Kivity
2009-04-14 18:21                                                     ` Jamie Lokier
2009-04-14 18:19                                                 ` Jamie Lokier
2009-04-16  9:03                                                   ` Avi Kivity
2009-04-11 23:16                                       ` Zachary Amsden
2009-04-12  8:23                                         ` Zachary Amsden
2009-04-14  8:28                                           ` Gerd Hoffmann
2009-04-14 18:20                                             ` Jamie Lokier
2009-04-11 19:11                                 ` Avi Kivity
2009-04-11 21:47                                   ` Andreas Färber
2009-04-12 18:44                                     ` Jamie Lokier
2009-04-09 16:01                       ` Jamie Lokier
2009-04-09 14:15           ` [libvirt] " Gerd Hoffmann
2009-04-09 14:19             ` Avi Kivity
2009-04-09 14:56               ` Jan Kiszka
2009-04-09 15:15                 ` François Revol
2009-04-09 15:15                 ` Avi Kivity
2009-04-09 15:49                   ` Jan Kiszka
2009-04-09 16:01                     ` Avi Kivity
2009-04-09 16:07                   ` Jamie Lokier
2009-05-11 20:54 ` Hollis Blanchard
2009-05-11 21:51   ` Anthony Liguori
2009-05-12  8:48     ` Avi Kivity

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).