qemu-e2k/include/qemu
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
..
accel.h gdbstub: move sstep flags probing into AccelClass 2022-10-06 11:53:41 +01:00
async-teardown.h os-posix: asynchronous teardown for shutdown on Linux 2022-10-31 09:46:34 +01:00
atomic128.h
atomic.h include/qemu/atomic: Use qemu_build_assert 2022-10-26 11:11:28 +10:00
base64.h
bcd.h
bitmap.h
bitops.h
bswap.h Move CPU softfloat unions to cpu-float.h 2022-04-06 14:31:43 +02:00
buffer.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
cacheflush.h
cacheinfo.h include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h 2022-02-21 13:30:20 +00:00
co-shared-resource.h
compiler.h compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD} 2022-04-21 17:08:52 +04:00
config-file.h remove -writeconfig 2022-04-28 08:51:56 +02:00
coroutine_int.h
coroutine-tls.h tls: add macros for coroutine-safe TLS variables 2022-03-04 18:14:40 +01:00
coroutine.h Block layer patches 2022-10-30 15:15:12 -04:00
cpu-float.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
cpuid.h tcg/i386: Detect AVX512 2022-03-04 08:50:41 -10:00
crc32c.h
crc-ccitt.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
ctype.h
cutils.h cutils: Introduce bundle mechanism 2022-07-13 16:58:57 +02:00
datadir.h
dbus.h
drm.h
envlist.h
error-report.h Move error_printf_unless_qmp() with monitor unit 2022-04-21 17:09:09 +04:00
event_notifier.h event_notifier: add event_notifier_get_wfd() 2022-03-06 06:19:47 -05:00
fifo8.h
fifo32.h
filemonitor.h
futex.h
guest-random.h
hbitmap.h block: simplify handling of try to merge different sized bitmaps 2022-06-24 17:07:06 +02:00
help_option.h
help-texts.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
host-utils.h include/qemu/host-utils.h: Simplify the compiler check in mulu128() 2022-08-04 13:49:47 +02:00
hw-version.h include: Move hardware version declarations to new qemu/hw-version.h 2022-02-21 13:30:20 +00:00
id.h
int128.h host-utils: Implemented unsigned 256-by-128 division 2022-06-20 08:38:58 -03:00
iov.h
iova-tree.h util: accept iova_tree_remove_parameter by value 2022-09-02 10:22:39 +08:00
jhash.h
job.h job: remove unused functions 2022-10-07 12:11:41 +02:00
keyval.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
lockable.h
log-for-trace.h util/log: Drop return value from qemu_log 2022-04-20 10:51:11 -07:00
log.h util/log: Support per-thread log files 2022-04-20 10:51:11 -07:00
madvise.h include: Move qemu_madvise() and related #defines to new qemu/madvise.h 2022-02-21 13:30:20 +00:00
main-loop.h util/main-loop: Avoid adding the same HANDLE twice 2022-11-06 09:48:26 +01:00
memalign.h osdep: Move memalign-related functions to their own header 2022-03-07 13:16:49 +00:00
memfd.h
mmap-alloc.h util/mmap-alloc: Remove qemu_mempath_getpagesize() 2022-08-26 13:34:21 +02:00
module.h module: add Error arguments to module_load and module_load_qom 2022-11-06 09:48:50 +01:00
mprotect.h include: Move qemu_mprotect_*() to new qemu/mprotect.h 2022-02-21 13:30:20 +00:00
notify.h
nvdimm-utils.h
option_int.h
option.h include: add qemu/keyval.h 2022-04-21 17:03:51 +04:00
osdep.h Hi, 2022-10-30 18:31:59 -04:00
path.h
plugin-memory.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
plugin.h plugins: add [pre|post]fork helpers to linux-user 2022-10-06 11:53:41 +01:00
pmem.h
processor.h
progress_meter.h
qdist.h
qemu-options.h
qemu-plugin.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
qemu-print.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
qemu-progress.h include: move progress API to qemu-progress.h 2022-04-06 14:31:43 +02:00
qht.h
qsp.h
queue.h
range.h compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT 2022-03-22 14:40:51 +04:00
ratelimit.h
rcu_queue.h
rcu.h rcu: use coroutine TLS macros 2022-03-04 18:14:40 +01:00
readline.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
selfmap.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
seqlock.h
sockets.h * Fix and test the VISTR instruction on s390x 2022-10-31 06:19:54 -04:00
stats64.h
sys_membarrier.h
systemd.h
thread-context.h util: Introduce ThreadContext user-creatable object 2022-10-27 11:00:43 +02:00
thread-posix.h thread-posix: implement Semaphore with QemuCond and QemuMutex 2022-04-06 14:31:56 +02:00
thread-win32.h
thread.h Hi, 2022-10-30 18:31:59 -04:00
throttle-options.h
throttle.h
timed-average.h
timer.h Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
transactions.h
tsan.h
typedefs.h dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
unicode.h
units.h
uri.h
userfaultfd.h
uuid.h
vfio-helpers.h
vhost-user-server.h
win_dump_defs.h include/qemu: add 32-bit Windows dump structures 2022-04-22 13:36:04 +04:00
xattr.h 9p: linux: Fix a couple Linux assumptions 2022-03-07 11:49:30 +01:00
xxhash.h
yank.h