qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/9] char: add qemu_chr_remove_handlers()


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH 3/9] char: add qemu_chr_remove_handlers()
Date: Thu, 13 Oct 2016 15:14:43 +0400

Remove the handlers associated with a frontend tag.

Signed-off-by: Marc-André Lureau <address@hidden>
---
 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);
 }
 
+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);
 
+/**
+ * @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);
-- 
2.10.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]