From patchwork Thu Feb 21 11:06:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 1046080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 444sd5094bz9s7h for ; Thu, 21 Feb 2019 22:27:05 +1100 (AEDT) Received: from localhost ([127.0.0.1]:58579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwmVK-0001vz-VU for incoming@patchwork.ozlabs.org; Thu, 21 Feb 2019 06:27:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwmCV-00028O-Ag for qemu-devel@nongnu.org; Thu, 21 Feb 2019 06:07:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwmCS-0006wV-5X for qemu-devel@nongnu.org; Thu, 21 Feb 2019 06:07:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45700) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwmCO-0006sp-H6 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 06:07:30 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15B898665D for ; Thu, 21 Feb 2019 11:07:26 +0000 (UTC) Received: from localhost (ovpn-112-68.ams2.redhat.com [10.36.112.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC33560851; Thu, 21 Feb 2019 11:07:23 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 12:06:58 +0100 Message-Id: <20190221110703.5775-7-marcandre.lureau@redhat.com> In-Reply-To: <20190221110703.5775-1-marcandre.lureau@redhat.com> References: <20190221110703.5775-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 21 Feb 2019 11:07:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 06/11] char: move SpiceChardev and open_spice_port() to spice.h header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will allow easier subclassing of SpiceChardev, in upcoming "display: add -display spice-app launching external application" patch. Signed-off-by: Marc-André Lureau Tested-by: Victor Toso --- include/chardev/spice.h | 27 +++++++++++++++++++++++++++ chardev/spice.c | 28 +++++----------------------- 2 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 include/chardev/spice.h diff --git a/include/chardev/spice.h b/include/chardev/spice.h new file mode 100644 index 0000000000..6431da3205 --- /dev/null +++ b/include/chardev/spice.h @@ -0,0 +1,27 @@ +#ifndef CHARDEV_SPICE_H_ +#define CHARDEV_SPICE_H_ + +#include +#include "chardev/char-fe.h" + +typedef struct SpiceChardev { + Chardev parent; + + SpiceCharDeviceInstance sin; + bool active; + bool blocked; + const uint8_t *datapos; + int datalen; + QLIST_ENTRY(SpiceChardev) next; +} SpiceChardev; + +#define TYPE_CHARDEV_SPICE "chardev-spice" +#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc" +#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport" + +#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_SPICE) + +void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend, + bool *be_opened, Error **errp); + +#endif diff --git a/chardev/spice.c b/chardev/spice.c index c68e60115b..2202d50eee 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -2,30 +2,12 @@ #include "trace.h" #include "ui/qemu-spice.h" #include "chardev/char.h" +#include "chardev/spice.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/option.h" -#include #include - -typedef struct SpiceChardev { - Chardev parent; - - SpiceCharDeviceInstance sin; - bool active; - bool blocked; - const uint8_t *datapos; - int datalen; - QLIST_ENTRY(SpiceChardev) next; -} SpiceChardev; - -#define TYPE_CHARDEV_SPICE "chardev-spice" -#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc" -#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport" - -#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_SPICE) - typedef struct SpiceCharSource { GSource source; SpiceChardev *scd; @@ -315,10 +297,10 @@ static void qemu_chr_open_spice_vmc(Chardev *chr, chr_open(chr, type); } -static void qemu_chr_open_spice_port(Chardev *chr, - ChardevBackend *backend, - bool *be_opened, - Error **errp) +void qemu_chr_open_spice_port(Chardev *chr, + ChardevBackend *backend, + bool *be_opened, + Error **errp) { ChardevSpicePort *spiceport = backend->u.spiceport.data; const char *name = spiceport->fqdn;