qapi/char: Make backend types properly conditional

Character backends are actually QOM types.  When a backend's
compile-time conditional QOM type is not compiled in, creation fails
with "'FOO' is not a valid char driver name".  Okay, except
introspecting chardev-add with query-qmp-schema doesn't work then: the
backend type is there even though the QOM type isn't.

A management application can work around this issue by using
qom-list-types instead.

Fix the issue anyway: add the conditionals to the QAPI schema.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240203080228.2766159-4-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Markus Armbruster 2024-02-03 09:02:27 +01:00
parent f396da77ca
commit 563799f6c0
1 changed files with 12 additions and 8 deletions

View File

@ -472,8 +472,8 @@
## ##
{ 'enum': 'ChardevBackendKind', { 'enum': 'ChardevBackendKind',
'data': [ 'file', 'data': [ 'file',
'serial', { 'name': 'serial', 'if': 'HAVE_CHARDEV_SERIAL' },
'parallel', { 'name': 'parallel', 'if': 'HAVE_CHARDEV_PARALLEL' },
'pipe', 'pipe',
'socket', 'socket',
'udp', 'udp',
@ -482,10 +482,10 @@
'mux', 'mux',
'msmouse', 'msmouse',
'wctablet', 'wctablet',
'braille', { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
'testdev', 'testdev',
'stdio', 'stdio',
'console', { 'name': 'console', 'if': 'CONFIG_WIN32' },
{ 'name': 'spicevmc', 'if': 'CONFIG_SPICE' }, { 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
{ 'name': 'spiceport', 'if': 'CONFIG_SPICE' }, { 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
{ 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' }, { 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
@ -614,8 +614,10 @@
'base': { 'type': 'ChardevBackendKind' }, 'base': { 'type': 'ChardevBackendKind' },
'discriminator': 'type', 'discriminator': 'type',
'data': { 'file': 'ChardevFileWrapper', 'data': { 'file': 'ChardevFileWrapper',
'serial': 'ChardevHostdevWrapper', 'serial': { 'type': 'ChardevHostdevWrapper',
'parallel': 'ChardevHostdevWrapper', 'if': 'HAVE_CHARDEV_SERIAL' },
'parallel': { 'type': 'ChardevHostdevWrapper',
'if': 'HAVE_CHARDEV_PARALLEL' },
'pipe': 'ChardevHostdevWrapper', 'pipe': 'ChardevHostdevWrapper',
'socket': 'ChardevSocketWrapper', 'socket': 'ChardevSocketWrapper',
'udp': 'ChardevUdpWrapper', 'udp': 'ChardevUdpWrapper',
@ -624,10 +626,12 @@
'mux': 'ChardevMuxWrapper', 'mux': 'ChardevMuxWrapper',
'msmouse': 'ChardevCommonWrapper', 'msmouse': 'ChardevCommonWrapper',
'wctablet': 'ChardevCommonWrapper', 'wctablet': 'ChardevCommonWrapper',
'braille': 'ChardevCommonWrapper', 'braille': { 'type': 'ChardevCommonWrapper',
'if': 'CONFIG_BRLAPI' },
'testdev': 'ChardevCommonWrapper', 'testdev': 'ChardevCommonWrapper',
'stdio': 'ChardevStdioWrapper', 'stdio': 'ChardevStdioWrapper',
'console': 'ChardevCommonWrapper', 'console': { 'type': 'ChardevCommonWrapper',
'if': 'CONFIG_WIN32' },
'spicevmc': { 'type': 'ChardevSpiceChannelWrapper', 'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
'if': 'CONFIG_SPICE' }, 'if': 'CONFIG_SPICE' },
'spiceport': { 'type': 'ChardevSpicePortWrapper', 'spiceport': { 'type': 'ChardevSpicePortWrapper',