[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] qapi, audio: respect build time conditions in audio sche
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 2/3] qapi, audio: respect build time conditions in audio schema |
Date: |
Fri, 05 Mar 2021 13:12:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Daniel P. Berrangé <berrange@redhat.com> writes:
> Currently the -audiodev accepts any audiodev type regardless of what is
> built in to QEMU. An error only occurs later at runtime when a sound
> device tries to use the audio backend.
>
> With this change QEMU will immediately reject -audiodev args that are
> not compiled into the binary. The QMP schema will also be introspectable
> to identify what is compiled in.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Subject "qapi, audio: respect build time conditions in audio schema"
feels too narrow. The patch goes beyond the schema, because it has to:
guarding QAPI schema parts with 'if' requires guarding use of C code
generated for it with #if.
An easy way out is perhaps stating just the aim:
audio: Make introspection reflect build configuration
This assumes the patch does a complete job. If there's more audio build
configuration to reflect, add a suitable qualifier like "more closely".
Fun: before the patch, the CONFIG_AUDIO_ conditionals are effectively
applied just to output of -help.
[...]
> diff --git a/qapi/audio.json b/qapi/audio.json
> index d7b91230d7..9af1b8140c 100644
> --- a/qapi/audio.json
> +++ b/qapi/audio.json
> @@ -386,8 +386,24 @@
> # Since: 4.0
> ##
> { 'enum': 'AudiodevDriver',
> - 'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'jack', 'oss', 'pa',
> - 'sdl', 'spice', 'wav' ] }
> + 'data': [ 'none',
> + { 'name': 'alsa',
> + 'if': 'defined(CONFIG_AUDIO_ALSA)' },
> + { 'name': 'coreaudio',
> + 'if': 'defined(CONFIG_AUDIO_COREAUDIO)' },
> + { 'name': 'dsound',
> + 'if': 'defined(CONFIG_AUDIO_DSOUND)' },
> + { 'name': 'jack',
> + 'if': 'defined(CONFIG_AUDIO_JACK)' },
> + { 'name': 'oss',
> + 'if': 'defined(CONFIG_AUDIO_OSS)' },
> + { 'name': 'pa',
> + 'if': 'defined(CONFIG_AUDIO_PA)' },
> + { 'name': 'sdl',
> + 'if': 'defined(CONFIG_AUDIO_SDL)' },
> + { 'name': 'spice',
> + 'if': 'defined(CONFIG_SPICE)' },
> + 'wav' ] }
>
> ##
> # @Audiodev:
> @@ -410,14 +426,22 @@
> 'discriminator': 'driver',
> 'data': {
> 'none': 'AudiodevGenericOptions',
> - 'alsa': 'AudiodevAlsaOptions',
> - 'coreaudio': 'AudiodevCoreaudioOptions',
> - 'dsound': 'AudiodevDsoundOptions',
> - 'jack': 'AudiodevJackOptions',
> - 'oss': 'AudiodevOssOptions',
> - 'pa': 'AudiodevPaOptions',
> - 'sdl': 'AudiodevSdlOptions',
> - 'spice': 'AudiodevGenericOptions',
> + 'alsa': { 'type': 'AudiodevAlsaOptions',
> + 'if': 'defined(CONFIG_AUDIO_ALSA)' },
> + 'coreaudio': { 'type': 'AudiodevCoreaudioOptions',
> + 'if': 'defined(CONFIG_AUDIO_COREAUDIO)' },
> + 'dsound': { 'type': 'AudiodevDsoundOptions',
> + 'if': 'defined(CONFIG_AUDIO_DSOUND)' },
> + 'jack': { 'type': 'AudiodevJackOptions',
> + 'if': 'defined(CONFIG_AUDIO_JACK)' },
> + 'oss': { 'type': 'AudiodevOssOptions',
> + 'if': 'defined(CONFIG_AUDIO_OSS)' },
> + 'pa': { 'type': 'AudiodevPaOptions',
> + 'if': 'defined(CONFIG_AUDIO_PA)' },
> + 'sdl': { 'type': 'AudiodevSdlOptions',
> + 'if': 'defined(CONFIG_AUDIO_SDL)' },
> + 'spice': { 'type': 'AudiodevGenericOptions',
> + 'if': 'defined(CONFIG_SPICE)' },
> 'wav': 'AudiodevWavOptions' } }
>
> ##
For the QAPI schema part:
Acked-by: Markus Armbruster <armbru@redhat.com>
[PATCH 3/3] qapi: provide a friendly string representation of QAPI classes, Daniel P . Berrangé, 2021/03/02
[PATCH 1/3] qapi, audio: add query-audiodev command, Daniel P . Berrangé, 2021/03/02