aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorOctavian Purdila <tavip@google.com>2024-08-05 18:07:35 -0700
committerMarc-André Lureau <marcandre.lureau@redhat.com>2024-10-09 12:13:05 +0400
commitb74cb8761c68275240af0826086590a03a1f419d (patch)
tree53584e9b6ea344e182437ac054009acb98fea33f /qapi
parentc8e2b6b4d7e2abaf34afd120eb065227ce240106 (diff)
downloadqemu-b74cb8761c68275240af0826086590a03a1f419d.zip
qemu-b74cb8761c68275240af0826086590a03a1f419d.tar.gz
qemu-b74cb8761c68275240af0826086590a03a1f419d.tar.bz2
chardev: add path option for pty backend
Add path option to the pty char backend which will create a symbolic link to the given path that points to the allocated PTY. This avoids having to make QMP or HMP monitor queries to find out what the new PTY device path is. Based on patch from Paulo Neves: https://patchew.org/QEMU/1548509635-15776-1-git-send-email-ptsneves@gmail.com/ Tested with the following invocations that the link is created and removed when qemu stops: qemu-system-x86_64 -nodefaults -mon chardev=compat_monitor \ -chardev pty,path=test,id=compat_monitor0 qemu-system-x86_64 -nodefaults -monitor pty:test # check QMP invocation with path set qemu-system-x86_64 -nodefaults -qmp tcp:localhost:4444,server=on,wait=off nc localhost 4444 > {"execute": "qmp_capabilities"} > {"execute": "chardev-add", "arguments": {"id": "bar", "backend": { "type": "pty", "data": {"path": "test" }}}} # check QMP invocation with path not set qemu-system-x86_64 -nodefaults -qmp tcp:localhost:4444,server=on,wait=off nc localhost 4444 > {"execute": "qmp_capabilities"} > {"execute": "chardev-add", "arguments": {"id": "bar", "backend": { "type": "pty", "data": {}}}} Also tested that when a link path is not passed invocations still work, e.g.: qemu-system-x86_64 -monitor pty Co-authored-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Paulo Neves <ptsneves@gmail.com> [OP: rebase and address original patch review comments] Signed-off-by: Octavian Purdila <tavip@google.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20240806010735.2450555-1-tavip@google.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/char.json27
1 files changed, 26 insertions, 1 deletions
diff --git a/qapi/char.json b/qapi/char.json
index 42eda4f..e045354 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -445,6 +445,20 @@
'if': 'CONFIG_SPICE_PROTOCOL' }
##
+# @ChardevPty:
+#
+# Configuration info for pty implementation.
+#
+# @path: optional path to create a symbolic link that points to the
+# allocated PTY
+#
+# Since: 9.2
+##
+{ 'struct': 'ChardevPty',
+ 'data': { '*path': 'str' },
+ 'base': 'ChardevCommon' }
+
+##
# @ChardevBackendKind:
#
# @file: regular files
@@ -655,6 +669,17 @@
{ 'struct': 'ChardevRingbufWrapper',
'data': { 'data': 'ChardevRingbuf' } }
+
+##
+# @ChardevPtyWrapper:
+#
+# @data: Configuration info for pty chardevs
+#
+# Since: 9.2
+##
+{ 'struct': 'ChardevPtyWrapper',
+ 'data': { 'data': 'ChardevPty' } }
+
##
# @ChardevBackend:
#
@@ -675,7 +700,7 @@
'pipe': 'ChardevHostdevWrapper',
'socket': 'ChardevSocketWrapper',
'udp': 'ChardevUdpWrapper',
- 'pty': 'ChardevCommonWrapper',
+ 'pty': 'ChardevPtyWrapper',
'null': 'ChardevCommonWrapper',
'mux': 'ChardevMuxWrapper',
'msmouse': 'ChardevCommonWrapper',