qemu/qapi
Octavian Purdila b74cb8761c 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>
2024-10-09 12:13:05 +04:00
..
acpi.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00
audio.json
authz.json
block-core.json docs: Mark "gluster" support in QEMU as deprecated 2024-10-07 10:54:10 +02:00
block-export.json nbd/server: CVE-2024-7409: Cap default max-connections to 100 2024-08-08 16:02:23 -05:00
block.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
char.json chardev: add path option for pty backend 2024-10-09 12:13:05 +04:00
common.json qapi/common: Supply missing member documentation 2024-10-02 09:10:01 +02:00
compat.json
control.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
crypto.json qapi/crypto: Supply missing member documentation 2024-10-02 09:10:01 +02:00
cryptodev.json qapi: Document QCryptodevBackendServiceType 2024-10-02 09:10:01 +02:00
cxl.json qapi/cxl: Supply missing member documentation 2024-10-02 09:10:01 +02:00
dump.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
ebpf.json qapi/ebpf: Drop temporary 'prefix' 2024-09-10 13:22:47 +02:00
error.json
introspect.json qapi/introspect: Supply missing member documentation 2024-10-02 09:10:01 +02:00
job.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
machine-common.json qapi/machine: Rename CpuS390* to S390Cpu*, and drop 'prefix' 2024-09-10 13:22:47 +02:00
machine-target.json qapi/machine: Rename CpuS390* to S390Cpu*, and drop 'prefix' 2024-09-10 13:22:47 +02:00
machine.json Remove the unused sh4eb target 2024-10-02 10:21:39 +02:00
meson.build qapi/vfio: Add VFIO migration QAPI event 2024-05-16 16:59:19 +02:00
migration.json QAPI patches patches for 2024-09-10 2024-09-10 17:48:54 +01:00
misc-target.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00
misc.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
net.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
opts-visitor.c qapi: Inline and remove QERR_INVALID_PARAMETER definition 2024-04-24 09:50:58 +02:00
pci.json qapi/pci: Supply missing member documentation 2024-10-02 09:10:01 +02:00
pragma.json qapi: Document QCryptodevBackendServiceType 2024-10-02 09:10:01 +02:00
qapi-clone-visitor.c qapi: Do not cast function pointers 2024-05-29 12:41:56 +02:00
qapi-dealloc-visitor.c
qapi-forward-visitor.c
qapi-schema.json qapi/vfio: Add VFIO migration QAPI event 2024-05-16 16:59:19 +02:00
qapi-type-helpers.c qapi: New strv_from_str_list() 2024-03-04 07:12:40 +01:00
qapi-util.c qapi: Fix dangling references to docs/devel/qapi-code-gen.txt 2024-01-26 07:04:53 +01:00
qapi-visit-core.c
qdev.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
qmp-dispatch.c Revert "monitor: use aio_co_reschedule_self()" 2024-06-10 11:05:43 +02:00
qmp-event.c
qmp-registry.c
qobject-input-visitor.c qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) 2024-04-24 09:50:58 +02:00
qobject-output-visitor.c
qom.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
replay.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00
rocker.json qapi/rocker: Supply missing member documentation 2024-10-02 09:10:01 +02:00
run-state.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
sockets.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
stats.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
string-input-visitor.c qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) 2024-04-24 09:50:58 +02:00
string-output-visitor.c string-output-visitor: Fix (pseudo) struct handling 2024-01-26 11:16:58 +01:00
tpm.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00
trace-events
trace.h
trace.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00
transaction.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
ui.json qapi/ui: Drop temporary 'prefix' 2024-09-10 13:22:47 +02:00
vfio.json qapi/vfio: Rename VfioMigrationState to Qapi*, and drop prefix 2024-09-10 14:03:45 +02:00
virtio.json qapi: Refill doc comments to conform to conventions 2024-08-05 09:31:51 +02:00
yank.json qapi: convert "Example" sections without titles 2024-07-17 10:20:53 +02:00