Received: from eggs.gnu.org ([2001:4830:134:3::10]:37640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1budyd-00055e-My for qemu-devel@nongnu.org; Thu, 13 Oct 2016 07:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1budya-0006I9-Ft for qemu-devel@nongnu.org; Thu, 13 Oct 2016 07:15:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1budya-0006Hh-AL for qemu-devel@nongnu.org; Thu, 13 Oct 2016 07:15:04 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 13 Oct 2016 15:14:43 +0400 Message-Id: <20161013111449.29387-4-marcandre.lureau@redhat.com> In-Reply-To: <20161013111449.29387-1-marcandre.lureau@redhat.com> References: <20161013111449.29387-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 3/9] char: add qemu_chr_remove_handlers() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, berrange@redhat.com, imbrenda@linux.vnet.ibm.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Remove the handlers associated with a frontend tag. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qemu-char.c | 9 +++++++++ include/sysemu/char.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index 168af69..a7fec6a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -526,6 +526,15 @@ int qemu_chr_add_handlers(CharDriverState *s, fd_event, opaque, NULL); } =20 +void qemu_chr_remove_handlers(CharDriverState *s, int tag) +{ + if (tag < 0) { + return; + } + /* FIXME: recycle mux tag */ + qemu_chr_set_handlers(s, NULL, NULL, NULL, NULL, NULL, tag); +} + static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int = len) { return len; diff --git a/include/sysemu/char.h b/include/sysemu/char.h index bdd61ea..36d82b1 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -453,6 +453,15 @@ int qemu_chr_add_handlers_full(CharDriverState *s, void *opaque, GMainContext *context); =20 +/** + * @qemu_chr_remove_handlers: + * + * @tag: the tag returned from qemu_chr_add_handlers() + * + * Remove the frontend callbacks. + */ +void qemu_chr_remove_handlers(CharDriverState *s, int tag); + void qemu_chr_be_generic_open(CharDriverState *s); void qemu_chr_accept_input(CharDriverState *s); int qemu_chr_add_client(CharDriverState *s, int fd); --=20 2.10.0