From patchwork Wed Dec 5 15:15:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 203887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5AA942C0092 for ; Thu, 6 Dec 2012 02:16:35 +1100 (EST) Received: from localhost ([::1]:42035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgGi6-0001nv-8J for incoming@patchwork.ozlabs.org; Wed, 05 Dec 2012 10:16:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgGhr-0001QF-T6 for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:16:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgGha-0007mg-Ob for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:16:10 -0500 Received: from mail-ea0-f173.google.com ([209.85.215.173]:52749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgGha-0007kY-HB for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:15:58 -0500 Received: by mail-ea0-f173.google.com with SMTP id i13so2196644eaa.4 for ; Wed, 05 Dec 2012 07:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=1z/EJmgcIsYeOefh3Mjy7DmdM6t3Y7JgaPtf5OxLTtA=; b=ofRILerThiB8R28bVsL4XpoUEXu5qIQ8SOMJtRnCDbVuZBw0eaxJmXl9mWLxDxJHKI giFxtABBd4N0O5B5leUYWCNYvw8B0ghhJmAqoME7yiCvNT8KLhOUHgqPrLVgiPHmdfw3 /gOEfFweaAI0DBZunZzkyezhKmcn2Du2q3hDBf4Ia3INI4y1m850/T0gb7aB2hld5ND0 KQ8TSWzTHLM2ujTPtrSZJ3h7gL5kvNP1gG1MU649DuuErcJlwbrSCuo9oaxqmxN1r69x gSeBE2jz5QKN+zsryzNjuNlWU/w6uBAAS1FQVmhbfo9jycNLwnxWOhNxXHxuFALYMsto MlLw== Received: by 10.14.225.194 with SMTP id z42mr54990191eep.22.1354720558209; Wed, 05 Dec 2012 07:15:58 -0800 (PST) Received: from localhost (nat-pool-cdg-t.redhat.com. [209.132.186.20]) by mx.google.com with ESMTPS id 43sm9717688eed.10.2012.12.05.07.15.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Dec 2012 07:15:57 -0800 (PST) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Wed, 5 Dec 2012 16:15:35 +0100 Message-Id: <1354720537-12097-4-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1354720537-12097-1-git-send-email-marcandre.lureau@redhat.com> References: <1354720537-12097-1-git-send-email-marcandre.lureau@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.173 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , alevy@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH 4/6] spice-qemu-char: keep a list of spice chardev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- spice-qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; +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; }