summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-12-05 16:15:35 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-12-17 14:01:41 +0100
commit7a5448ce6ef140a20b1a090d50aeb4248d0a9ffd (patch)
tree3c241df957d09e9a293a8d550bf7bcc46b75f20e
parent5a49d3e9a799b7e1bf87da7ae7f2a719e01da319 (diff)
downloadfocaccia-qemu-7a5448ce6ef140a20b1a090d50aeb4248d0a9ffd.tar.gz
focaccia-qemu-7a5448ce6ef140a20b1a090d50aeb4248d0a9ffd.zip
spice-qemu-char: keep a list of spice chardev
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--spice-qemu-char.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 4be75ba353..4eb85ae798 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -24,8 +24,12 @@ typedef struct SpiceCharDriver {
     uint8_t               *datapos;
     ssize_t               bufsize, datalen;
     uint32_t              debug;
+    QLIST_ENTRY(SpiceCharDriver) next;
 } SpiceCharDriver;
 
+static QLIST_HEAD(, SpiceCharDriver) spice_chars =
+    QLIST_HEAD_INITIALIZER(spice_chars);
+
 static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
 {
     SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin);
@@ -179,6 +183,7 @@ static void spice_chr_close(struct CharDriverState *chr)
 
     printf("%s\n", __func__);
     vmc_unregister_interface(s);
+    QLIST_REMOVE(s, next);
     g_free(s);
 }
 
@@ -229,6 +234,8 @@ static CharDriverState *chr_open(QemuOpts *opts, const char *subtype)
     chr->chr_guest_open = spice_chr_guest_open;
     chr->chr_guest_close = spice_chr_guest_close;
 
+    QLIST_INSERT_HEAD(&spice_chars, s, next);
+
     return chr;
 }