From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkaND-0004v8-Pq for qemu-devel@nongnu.org; Mon, 17 Dec 2012 08:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkaN9-0004Ei-Sm for qemu-devel@nongnu.org; Mon, 17 Dec 2012 08:04:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkaN9-0004EN-Kc for qemu-devel@nongnu.org; Mon, 17 Dec 2012 08:04:43 -0500 From: Gerd Hoffmann Date: Mon, 17 Dec 2012 14:04:37 +0100 Message-Id: <1355749479-25470-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1355749479-25470-1-git-send-email-kraxel@redhat.com> References: <1355749479-25470-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 6/8] spice-qemu-char: keep a list of spice chardev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann From: Marc-Andr=C3=A9 Lureau Signed-off-by: Gerd Hoffmann --- spice-qemu-char.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 4be75ba..4eb85ae 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; =20 +static QLIST_HEAD(, SpiceCharDriver) spice_chars =3D + QLIST_HEAD_INITIALIZER(spice_chars); + static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, i= nt len) { SpiceCharDriver *scd =3D container_of(sin, SpiceCharDriver, sin); @@ -179,6 +183,7 @@ static void spice_chr_close(struct CharDriverState *c= hr) =20 printf("%s\n", __func__); vmc_unregister_interface(s); + QLIST_REMOVE(s, next); g_free(s); } =20 @@ -229,6 +234,8 @@ static CharDriverState *chr_open(QemuOpts *opts, cons= t char *subtype) chr->chr_guest_open =3D spice_chr_guest_open; chr->chr_guest_close =3D spice_chr_guest_close; =20 + QLIST_INSERT_HEAD(&spice_chars, s, next); + return chr; } =20 --=20 1.7.1