[PATCH v2 1/5] chardev/char: introduce `mux-be-id=ID` option and _MUX_BE type

Roman Penyaev posted 5 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v2 1/5] chardev/char: introduce `mux-be-id=ID` option and _MUX_BE type
Posted by Roman Penyaev 1 month, 2 weeks ago
Patch introduces `mux-be-id=ID` option for all chardev devices
and TYPE_CHARDEV_MUX_BE type for distinction different types
of multiplexers: frontend (current "mux" type) and backend
(new "mux-be" type). Actual attach of the chardev to the
multiplexer and mux-be implementation will follow.

Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org
---
 chardev/char.c         | 3 +++
 include/chardev/char.h | 1 +
 qapi/char.json         | 9 ++++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/chardev/char.c b/chardev/char.c
index ba847b6e9eff..4b3e45b2a128 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -918,6 +918,9 @@ QemuOptsList qemu_chardev_opts = {
         },{
             .name = "mux",
             .type = QEMU_OPT_BOOL,
+        },{
+            .name = "mux-be-id",
+            .type = QEMU_OPT_STRING,
         },{
             .name = "signal",
             .type = QEMU_OPT_BOOL,
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 01df55f9e8c8..f68f949f6ebc 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -232,6 +232,7 @@ OBJECT_DECLARE_TYPE(Chardev, ChardevClass, CHARDEV)
 
 #define TYPE_CHARDEV_NULL "chardev-null"
 #define TYPE_CHARDEV_MUX "chardev-mux"
+#define TYPE_CHARDEV_MUX_BE "chardev-mux-be"
 #define TYPE_CHARDEV_RINGBUF "chardev-ringbuf"
 #define TYPE_CHARDEV_PTY "chardev-pty"
 #define TYPE_CHARDEV_CONSOLE "chardev-console"
diff --git a/qapi/char.json b/qapi/char.json
index ef58445ceec9..30748784513b 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -199,11 +199,15 @@
 # @logappend: true to append instead of truncate (default to false to
 #     truncate)
 #
+# @mux-be-id: id of the mux-be device for backend multiplexing
+#     (since: 9.2)
+#
 # Since: 2.6
 ##
 { 'struct': 'ChardevCommon',
   'data': { '*logfile': 'str',
-            '*logappend': 'bool' } }
+            '*logappend': 'bool',
+            '*mux-be-id': 'str' } }
 
 ##
 # @ChardevFile:
@@ -440,6 +444,8 @@
 #
 # @mux: Since 1.5
 #
+# @mux-be: Since 9.2
+#
 # @msmouse: Since 1.5
 #
 # @wctablet: Since 2.9
@@ -482,6 +488,7 @@
             'pty',
             'null',
             'mux',
+            'mux-be',
             'msmouse',
             'wctablet',
             { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
-- 
2.43.0