Patchwork [1/3] monitor: Cleanup ID assignment for compat switch

login
register
mail settings
Submitter Jan Kiszka
Date April 6, 2010, 2:55 p.m.
Message ID <9324f15598b24165903557c9fc6f04336cd92877.1270565748.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/49521/
State New
Headers show

Comments

Jan Kiszka - April 6, 2010, 2:55 p.m.
Canonicalize the ID assignment when creating monitor devices via the
legacy switch and use less easily colliding names.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 vl.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/vl.c b/vl.c
index 6768cf1..bda5f1e 100644
--- a/vl.c
+++ b/vl.c
@@ -2418,11 +2418,9 @@  static void monitor_parse(const char *optarg, const char *mode)
     if (strstart(optarg, "chardev:", &p)) {
         snprintf(label, sizeof(label), "%s", p);
     } else {
-        if (monitor_device_index) {
-            snprintf(label, sizeof(label), "monitor%d",
-                     monitor_device_index);
-        } else {
-            snprintf(label, sizeof(label), "monitor");
+        snprintf(label, sizeof(label), "compat_monitor%d",
+                 monitor_device_index);
+        if (monitor_device_index == 0) {
             def = 1;
         }
         opts = qemu_chr_parse_compat(label, optarg);