Skip to content

Commit

Permalink
module: removed unused function argument "mayfail"
Browse files Browse the repository at this point in the history
mayfail is always passed as false for every invocation throughout the program.
It controls whether to printf or not to printf an error on
g_module_open failure.

Remove this unused argument.

Signed-off-by: Claudio Fontana <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Claudio Fontana authored and bonzini committed Nov 6, 2022
1 parent efa3901 commit 2106106
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions include/qemu/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ typedef enum {
#define fuzz_target_init(function) module_init(function, \
MODULE_INIT_FUZZ_TARGET)
#define migration_init(function) module_init(function, MODULE_INIT_MIGRATION)
#define block_module_load_one(lib) module_load_one("block-", lib, false)
#define ui_module_load_one(lib) module_load_one("ui-", lib, false)
#define audio_module_load_one(lib) module_load_one("audio-", lib, false)
#define block_module_load_one(lib) module_load_one("block-", lib)
#define ui_module_load_one(lib) module_load_one("ui-", lib)
#define audio_module_load_one(lib) module_load_one("audio-", lib)

void register_module_init(void (*fn)(void), module_init_type type);
void register_dso_module_init(void (*fn)(void), module_init_type type);

void module_call_init(module_init_type type);
bool module_load_one(const char *prefix, const char *lib_name, bool mayfail);
bool module_load_one(const char *prefix, const char *lib_name);
void module_load_qom_one(const char *type);
void module_load_qom_all(void);
void module_allow_arch(const char *arch);
Expand Down
2 changes: 1 addition & 1 deletion softmmu/qtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
g_assert(words[1] && words[2]);

qtest_send_prefix(chr);
if (module_load_one(words[1], words[2], false)) {
if (module_load_one(words[1], words[2])) {
qtest_sendf(chr, "OK\n");
} else {
qtest_sendf(chr, "FAIL\n");
Expand Down
20 changes: 9 additions & 11 deletions util/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static bool module_check_arch(const QemuModinfo *modinfo)
return true;
}

static int module_load_file(const char *fname, bool mayfail, bool export_symbols)
static int module_load_file(const char *fname, bool export_symbols)
{
GModule *g_module;
void (*sym)(void);
Expand Down Expand Up @@ -172,10 +172,8 @@ static int module_load_file(const char *fname, bool mayfail, bool export_symbols
}
g_module = g_module_open(fname, flags);
if (!g_module) {
if (!mayfail) {
fprintf(stderr, "Failed to open module: %s\n",
g_module_error());
}
fprintf(stderr, "Failed to open module: %s\n",
g_module_error());
ret = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -208,7 +206,7 @@ static int module_load_file(const char *fname, bool mayfail, bool export_symbols
}
#endif

bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
bool module_load_one(const char *prefix, const char *lib_name)
{
bool success = false;

Expand Down Expand Up @@ -256,7 +254,7 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
if (strcmp(modinfo->name, module_name) == 0) {
/* we depend on other module(s) */
for (sl = modinfo->deps; *sl != NULL; sl++) {
module_load_one("", *sl, false);
module_load_one("", *sl);
}
} else {
for (sl = modinfo->deps; *sl != NULL; sl++) {
Expand Down Expand Up @@ -287,7 +285,7 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
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, mayfail, export_symbols);
ret = module_load_file(fname, export_symbols);
g_free(fname);
fname = NULL;
/* Try loading until loaded a module file */
Expand Down Expand Up @@ -333,7 +331,7 @@ void module_load_qom_one(const char *type)
}
for (sl = modinfo->objs; *sl != NULL; sl++) {
if (strcmp(type, *sl) == 0) {
module_load_one("", modinfo->name, false);
module_load_one("", modinfo->name);
}
}
}
Expand All @@ -354,7 +352,7 @@ void module_load_qom_all(void)
if (!module_check_arch(modinfo)) {
continue;
}
module_load_one("", modinfo->name, false);
module_load_one("", modinfo->name);
}
module_loaded_qom_all = true;
}
Expand All @@ -370,7 +368,7 @@ void qemu_load_module_for_opts(const char *group)
}
for (sl = modinfo->opts; *sl != NULL; sl++) {
if (strcmp(group, *sl) == 0) {
module_load_one("", modinfo->name, false);
module_load_one("", modinfo->name);
}
}
}
Expand Down

0 comments on commit 2106106

Please sign in to comment.