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
atomic.h include/qemu/atomic: Use qemu_build_assert 2022-10-26 11:11:28 +10:00
atomic128.h docs: fix references to docs/devel/atomics.rst 2021-06-02 06:51:09 +02:00
base64.h nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
bcd.h
bitmap.h bitmap: Add bitmap_copy_with_{src|dst}_offset() 2019-07-15 15:39:02 +02:00
bitops.h bitops.h: revert db1ffc32dd ("qemu/bitops.h: add bitrev8 implementation") 2021-07-26 06:56:41 -10:00
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 util: Enhance flush_icache_range with separate data pointer 2021-01-07 05:09:41 -10:00
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 co-shared-resource: protect with a mutex 2021-06-25 14:24:24 +03:00
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-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
coroutine_int.h coroutine: support SafeStack in ucontext backend 2020-06-23 15:46:05 +01: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
crc-ccitt.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
crc32c.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ctype.h qemu-common: Move qemu_isalnum() etc. to qemu/ctype.h 2019-06-11 20:22:09 +02:00
cutils.h cutils: Introduce bundle mechanism 2022-07-13 16:58:57 +02:00
datadir.h vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
dbus.h ui/dbus: add chardev backend & interface 2021-12-21 10:50:22 +04:00
drm.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
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 utils/fifo8: add VMSTATE_FIFO8_TEST macro 2021-02-07 20:38:34 +00:00
fifo32.h
filemonitor.h nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
futex.h futex: add missing header guards 2017-10-16 20:57:13 +03:00
guest-random.h util: Add qemu_guest_getrandom and associated routines 2019-05-22 12:38:54 -04:00
hbitmap.h block: simplify handling of try to merge different sized bitmaps 2022-06-24 17:07:06 +02:00
help-texts.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
help_option.h keyval: Parse help options 2020-10-15 16:06:27 +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 net: Use id_generate() in the network subsystem, too 2021-03-09 21:47:45 +01:00
int128.h host-utils: Implemented unsigned 256-by-128 division 2022-06-20 08:38:58 -03:00
iov.h util/iov: make qemu_iovec_init_extended() honest 2021-02-03 08:00:33 -06:00
iova-tree.h util: accept iova_tree_remove_parameter by value 2022-09-02 10:22:39 +08:00
jhash.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
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 include/qemu/lockable: Use _Generic instead of QEMU_GENERIC 2021-06-16 15:03:26 +02:00
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 linux-user: add memfd_create 2019-09-11 08:46:17 +02:00
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 xen / notify: introduce a new XenWatchList abstraction 2019-09-24 12:18:47 +01:00
nvdimm-utils.h Clean up includes 2020-12-10 17:16:44 +01:00
option.h include: add qemu/keyval.h 2022-04-21 17:03:51 +04:00
option_int.h qemu/queue.h: simplify reverse access to QTAILQ 2019-01-11 15:46:55 +01: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 Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00
processor.h Drop remaining bits of ia64 host support 2018-02-05 18:09:45 +01:00
progress_meter.h progressmeter: protect with a mutex 2021-06-25 14:24:24 +03:00
qdist.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-options.h remove qemu-options* from root directory 2021-05-26 14:49:46 +02:00
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 qht: constify qht_statistics_init 2018-09-26 08:55:54 -07:00
qsp.h qsp: Simplify how qsp_report() prints 2019-04-18 22:18:59 +02:00
queue.h qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
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 ratelimit: treat zero speed as unlimited 2021-06-25 14:22:21 +03:00
rcu.h rcu: use coroutine TLS macros 2022-03-04 18:14:40 +01:00
rcu_queue.h qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +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 qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
sockets.h * Fix and test the VISTR instruction on s390x 2022-10-31 06:19:54 -04:00
stats64.h qemu/atomic: Add aligned_{int64,uint64}_t types 2021-07-21 07:45:38 -10:00
sys_membarrier.h Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
systemd.h Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
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 util: Use real functions for thread-posix QemuRecMutex 2021-06-16 15:03:26 +02:00
thread.h Hi, 2022-10-30 18:31:59 -04:00
throttle-options.h block: add throttle block filter driver 2017-09-06 10:12:02 +02:00
throttle.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
timed-average.h
timer.h Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
transactions.h transactions: Invoke clean() after everything else 2021-11-16 09:43:44 +01:00
tsan.h include/qemu: Added tsan.h for annotations. 2020-06-16 14:49:05 +01:00
typedefs.h dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
unicode.h json: Reject invalid UTF-8 sequences 2018-08-24 20:26:37 +02:00
units.h block: Eliminate the S_1KiB, S_2KiB, ... macros 2019-02-01 13:46:45 +01:00
uri.h Remove unused function declarations 2016-09-15 15:32:22 +03:00
userfaultfd.h migration: introduce UFFD-WP low-level interface helpers 2021-02-08 11:19:51 +00:00
uuid.h acpi: nvdimm: change NVDIMM_UUID_LE to a common macro 2020-05-14 15:03:08 +01:00
vfio-helpers.h util/vfio-helpers: Pass Error handle to qemu_vfio_dma_map() 2021-09-07 09:08:24 +01:00
vhost-user-server.h block/export: Fix vhost-user-blk shutdown with requests in flight 2022-02-01 13:49:15 +01:00
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 target/arm: Implement an IMPDEF pauth algorithm 2021-01-19 14:38:51 +00:00
yank.h yank: Remove dependency on qiochannel 2021-04-01 15:27:44 +04:00