On 12/11/20 18:59, Kevin Wolf wrote:
The final missing piece to achieve compatibility between
qemu_chr_parse_cli_str()/qemu_chr_new_cli() and the legacy command line
is support for the 'mux' option. Implement it.
Signed-off-by: Kevin Wolf<kw...@redhat.com>
---
qapi/char.json | 4 +++-
chardev/char.c | 41 +++++++++++++++++++++++++++++++++++------
2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/qapi/char.json b/qapi/char.json
index e1f9347044..d6733a5473 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -453,12 +453,14 @@
#
# @id: the chardev's ID, must be unique
# @backend: backend type and parameters
+# @mux: enable multiplexing mode (default: false)
#
# Since: 6.0
##
{ 'struct': 'ChardevOptions',
'data': { 'id': 'str',
- 'backend': 'ChardevBackend' },
+ 'backend': 'ChardevBackend',
+ '*mux': 'bool' },
'aliases': [ { 'source': ['backend'] } ] }
I think this shows that -chardev and chardev-add are both kind of
unrepairable. The right way to do a mux with a serial and monitor on
top should be explicit:
stdio
↑
mux-controller
↑ ↑
mux mux
↑ ↑
serial monitor
-object chardev-stdio,id=stdio
-object chardev-mux-controller,id=mux,backend=stdio
-object chardev-mux,id=serial-chardev,controller=mux
-object chardev-mux,id=mon-chardev,controller=mux
-serial chardev:serial-chardev
-monitor chardev:mon-chardev
Adding automagic "mux" creation to -chardev is wrong. I don't entirely
object to the series since it's quite nice, but I see it as more of a
cleanup than the final stage. It hinges on what Markus thinks of
aliases, I guess.
Paolo