mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
module: silence errors for module_load_qom_all().
Add mayfail bool parameter to module loading functions. Set it to true for module_load_qom_all() because device modules might not load into all system emulation variants. qemu-system-s390x for example will not load qxl because it lacks vga support. Makes "make check" less chatty. Drop module_loaded_qom_all check in module_load_qom_one to make sure we see errors for explicit load requests, i.e. module_load_qom_one("qxl") failing will log an error no matter whenever module_load_qom_all() was called before or not. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20200923091217.22662-1-kraxel@redhat.com
This commit is contained in:
parent
57c98ea9ac
commit
501093207e
3 changed files with 15 additions and 15 deletions
|
@ -110,7 +110,7 @@ void module_call_init(module_init_type type)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
static int module_load_file(const char *fname)
|
||||
static int module_load_file(const char *fname, bool mayfail)
|
||||
{
|
||||
GModule *g_module;
|
||||
void (*sym)(void);
|
||||
|
@ -134,8 +134,10 @@ static int module_load_file(const char *fname)
|
|||
|
||||
g_module = g_module_open(fname, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
|
||||
if (!g_module) {
|
||||
fprintf(stderr, "Failed to open module: %s\n",
|
||||
g_module_error());
|
||||
if (!mayfail) {
|
||||
fprintf(stderr, "Failed to open module: %s\n",
|
||||
g_module_error());
|
||||
}
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
@ -167,7 +169,7 @@ out:
|
|||
}
|
||||
#endif
|
||||
|
||||
bool module_load_one(const char *prefix, const char *lib_name)
|
||||
bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
@ -218,7 +220,7 @@ bool module_load_one(const char *prefix, const char *lib_name)
|
|||
for (i = 0; i < n_dirs; i++) {
|
||||
fname = g_strdup_printf("%s/%s%s",
|
||||
dirs[i], module_name, CONFIG_HOST_DSOSUF);
|
||||
ret = module_load_file(fname);
|
||||
ret = module_load_file(fname, mayfail);
|
||||
g_free(fname);
|
||||
fname = NULL;
|
||||
/* Try loading until loaded a module file */
|
||||
|
@ -275,13 +277,11 @@ void module_load_qom_one(const char *type)
|
|||
if (!type) {
|
||||
return;
|
||||
}
|
||||
if (module_loaded_qom_all) {
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(qom_modules); i++) {
|
||||
if (strcmp(qom_modules[i].type, type) == 0) {
|
||||
module_load_one(qom_modules[i].prefix,
|
||||
qom_modules[i].module);
|
||||
qom_modules[i].module,
|
||||
false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void module_load_qom_all(void)
|
|||
/* one module implementing multiple types -> load only once */
|
||||
continue;
|
||||
}
|
||||
module_load_one(qom_modules[i].prefix, qom_modules[i].module);
|
||||
module_load_one(qom_modules[i].prefix, qom_modules[i].module, true);
|
||||
}
|
||||
module_loaded_qom_all = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue