xemu/audio
Claudio Fontana c551fb0b53 module: add Error arguments to module_load and module_load_qom
improve error handling during module load, by changing:

bool module_load(const char *prefix, const char *lib_name);
void module_load_qom(const char *type);

to:

int module_load(const char *prefix, const char *name, Error **errp);
int module_load_qom(const char *type, Error **errp);

where the return value is:

 -1 on module load error, and errp is set with the error
  0 on module or one of its dependencies are not installed
  1 on module load success
  2 on module load success (module already loaded or built-in)

module_load_qom_one has been introduced in:

commit 28457744c3 ("module: qom module support"), which built on top of
module_load_one, but discarded the bool return value. Restore it.

Adapt all callers to emit errors, or ignore them, or fail hard,
as appropriate in each context.

Replace the previous emission of errors via fprintf in _some_ error
conditions with Error and error_report, so as to emit to the appropriate
target.

A memory leak is also fixed as part of the module_load changes.

audio: when attempting to load an audio module, report module load errors.
Note that still for some callers, a single issue may generate multiple
error reports, and this could be improved further.
Regarding the audio code itself, audio_add() seems to ignore errors,
and this should probably be improved.

block: when attempting to load a block module, report module load errors.
For the code paths that already use the Error API, take advantage of those
to report module load errors into the Error parameter.
For the other code paths, we currently emit the error, but this could be
improved further by adding Error parameters to all possible code paths.

console: when attempting to load a display module, report module load errors.

qdev: when creating a new qdev Device object (DeviceState), report load errors.
      If a module cannot be loaded to create that device, now abort execution
      (if no CONFIG_MODULE) or exit (if CONFIG_MODULE).

qom/object.c: when initializing a QOM object, or looking up class_by_name,
              report module load errors.

qtest: when processing the "module_load" qtest command, report errors
       in the load of the module.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220929093035.4231-4-cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-11-06 09:48:50 +01:00
..
alsaaudio.c alsaaudio: reduce playback latency 2022-10-11 10:17:08 +02:00
audio.c module: add Error arguments to module_load and module_load_qom 2022-11-06 09:48:50 +01:00
audio.h audio: add help option for -audio and -audiodev 2022-09-19 15:15:59 +02:00
audio_int.h audio: swap audio_rate_get_bytes() function parameters 2022-10-11 10:17:08 +02:00
audio_legacy.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
audio_template.h audio: fix sw->buf size for audio recording 2022-10-11 10:17:08 +02:00
audio_win_int.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
audio_win_int.h Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
coreaudio.m Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
dbusaudio.c audio: swap audio_rate_get_bytes() function parameters 2022-10-11 10:17:08 +02:00
dsound_template.h dsoundaudio: replace GetForegroundWindow() 2021-01-15 11:25:22 +01:00
dsoundaudio.c Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
jackaudio.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
meson.build audio: Add sndio backend 2022-09-27 07:32:31 +02:00
mixeng.c audio/mixeng: Do not declare unused variables 2022-03-18 09:32:48 +01:00
mixeng.h audio: proper support for float samples in mixeng 2020-02-06 14:35:57 +01:00
mixeng_template.h audio: fix saturation nonlinearity in clip_* functions 2020-03-16 10:18:07 +01:00
noaudio.c audio: swap audio_rate_get_bytes() function parameters 2022-10-11 10:17:08 +02:00
ossaudio.c Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
paaudio.c Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
rate_template.h audio: prevent an integer overflow in resampling code 2022-10-11 10:17:08 +02:00
sdlaudio.c Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
sndioaudio.c audio: Add sndio backend 2022-09-27 07:32:31 +02:00
spiceaudio.c audio: swap audio_rate_get_bytes() function parameters 2022-10-11 10:17:08 +02:00
trace-events audio: add "dbus" audio backend 2021-12-21 10:50:22 +04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
wavaudio.c audio: swap audio_rate_get_bytes() function parameters 2022-10-11 10:17:08 +02:00
wavcapture.c monitor: Use getter/setter functions for cur_mon 2020-10-09 07:08:19 +02:00