[Spice-devel] [PATCH 6/6] spice-qemu-char: register spicevmc ports during qemu_spice_init()

Marc-André Lureau marcandre.lureau at gmail.com
Fri Nov 30 05:25:47 PST 2012


Do the delayed registration of spicevmc ports after Spice server is
initialized.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 spice-qemu-char.c | 13 +++++++++++++
 ui/qemu-spice.h   |  1 +
 ui/spice-core.c   |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 13de037..8577664 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -275,6 +275,7 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
 
     return chr;
 }
+
 static int port_can_read(void *opaque)
 {
     CharDriverState *chr = opaque;
@@ -388,3 +389,15 @@ CharDriverState *qemu_chr_open_spice_port(QemuOpts *opts)
 
     return chr;
 }
+
+void qemu_spice_register_ports(void)
+{
+    SpiceCharDriver *s;
+
+    QLIST_FOREACH(s, &spice_chars, next) {
+        if (s->sin.portname == NULL) {
+            continue;
+        }
+        vmc_register_interface(s);
+    }
+}
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index ab1943a..5d60e99 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -47,6 +47,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data);
 
 CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
 CharDriverState *qemu_chr_open_spice_port(QemuOpts *opts);
+void qemu_spice_register_ports(void);
 
 #else  /* CONFIG_SPICE */
 #include "monitor.h"
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 261c6f2..979c689 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -714,6 +714,8 @@ void qemu_spice_init(void)
     g_free(x509_key_file);
     g_free(x509_cert_file);
     g_free(x509_cacert_file);
+
+    qemu_spice_register_ports();
 }
 
 int qemu_spice_add_interface(SpiceBaseInstance *sin)
-- 
1.7.11.7



More information about the Spice-devel mailing list