]> git.proxmox.com Git - qemu.git/commitdiff
spice-qemu-char: keep a list of spice chardev
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Wed, 5 Dec 2012 15:15:35 +0000 (16:15 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 17 Dec 2012 13:01:41 +0000 (14:01 +0100)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
spice-qemu-char.c

index 4be75ba353853ca1546cd9fcaf1ed8c08c79a5e7..4eb85ae7984ed02c0371ebe1f89cc203b657891d 100644 (file)
@@ -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;
 }