Received: from eggs.gnu.org ([2001:4830:134:3::10]:47100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byfcF-0004dt-Az for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byfcE-0006fe-HS for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:39 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35444) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byfcE-0006f9-Bv for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:38 -0400 Received: by mail-wm0-x242.google.com with SMTP id o81so9899561wma.2 for ; Mon, 24 Oct 2016 06:48:38 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 24 Oct 2016 15:47:28 +0200 Message-Id: <1477316855-42218-44-git-send-email-pbonzini@redhat.com> In-Reply-To: <1477316855-42218-1-git-send-email-pbonzini@redhat.com> References: <1477316855-42218-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 43/50] char: move fe_open in CharBackend 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?= From: Marc-André Lureau The fe_open state belongs to front end. Signed-off-by: Marc-André Lureau Message-Id: <20161022100951.19562-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/sysemu/char.h | 2 +- qemu-char.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/sysemu/char.h b/include/sysemu/char.h index ae32e1c..2c3060c 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -81,6 +81,7 @@ typedef struct CharBackend { IOReadHandler *chr_read; void *opaque; int tag; + int fe_open; } CharBackend; struct CharDriverState { @@ -108,7 +109,6 @@ struct CharDriverState { char *filename; int logfd; int be_open; - int fe_open; int explicit_be_open; int avail_connections; int is_mux; diff --git a/qemu-char.c b/qemu-char.c index a1517a4..3b98acf 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -910,6 +910,7 @@ bool qemu_chr_fe_init(CharBackend *b, CharDriverState *s, Error **errp) s->be = b; } + b->fe_open = false; b->tag = tag; b->chr = s; @@ -4216,10 +4217,10 @@ void qemu_chr_fe_set_open(CharBackend *be, int fe_open) return; } - if (chr->fe_open == fe_open) { + if (be->fe_open == fe_open) { return; } - chr->fe_open = fe_open; + be->fe_open = fe_open; if (chr->chr_set_fe_open) { chr->chr_set_fe_open(chr, fe_open); } @@ -4304,7 +4305,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp) info->value = g_malloc0(sizeof(*info->value)); info->value->label = g_strdup(chr->label); info->value->filename = g_strdup(chr->filename); - info->value->frontend_open = chr->fe_open; + info->value->frontend_open = chr->be && chr->be->fe_open; info->next = chr_list; chr_list = info; -- 1.8.3.1