2009-05-14 22:29:53 +04:00
|
|
|
/*
|
|
|
|
* QEMU Module Infrastructure
|
|
|
|
*
|
|
|
|
* Copyright IBM, Corp. 2009
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*
|
2012-01-13 20:44:23 +04:00
|
|
|
* Contributions after 2012-01-13 are licensed under the terms of the
|
|
|
|
* GNU GPL, version 2 or (at your option) any later version.
|
2009-05-14 22:29:53 +04:00
|
|
|
*/
|
|
|
|
|
2016-01-29 20:49:55 +03:00
|
|
|
#include "qemu/osdep.h"
|
2014-02-25 20:36:55 +04:00
|
|
|
#ifdef CONFIG_MODULES
|
2014-02-10 10:48:57 +04:00
|
|
|
#include <gmodule.h>
|
2014-02-25 20:36:55 +04:00
|
|
|
#endif
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/queue.h"
|
|
|
|
#include "qemu/module.h"
|
2020-08-18 13:00:18 +03:00
|
|
|
#include "qemu/cutils.h"
|
2021-06-24 13:38:18 +03:00
|
|
|
#include "qemu/config-file.h"
|
2020-03-10 17:58:06 +03:00
|
|
|
#ifdef CONFIG_MODULE_UPGRADES
|
|
|
|
#include "qemu-version.h"
|
|
|
|
#endif
|
2021-06-24 13:38:19 +03:00
|
|
|
#include "trace.h"
|
2009-05-14 22:29:53 +04:00
|
|
|
|
|
|
|
typedef struct ModuleEntry
|
|
|
|
{
|
|
|
|
void (*init)(void);
|
2009-09-12 11:36:22 +04:00
|
|
|
QTAILQ_ENTRY(ModuleEntry) node;
|
2014-02-10 10:48:57 +04:00
|
|
|
module_init_type type;
|
2009-05-14 22:29:53 +04:00
|
|
|
} ModuleEntry;
|
|
|
|
|
2009-09-12 11:36:22 +04:00
|
|
|
typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList;
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
static ModuleTypeList init_type_list[MODULE_INIT_MAX];
|
2020-02-20 07:10:59 +03:00
|
|
|
static bool modules_init_done[MODULE_INIT_MAX];
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2014-02-10 10:48:57 +04:00
|
|
|
static ModuleTypeList dso_init_list;
|
|
|
|
|
|
|
|
static void init_lists(void)
|
2009-05-14 22:29:53 +04:00
|
|
|
{
|
2009-05-15 02:57:31 +04:00
|
|
|
static int inited;
|
|
|
|
int i;
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
if (inited) {
|
|
|
|
return;
|
2009-05-14 22:29:53 +04:00
|
|
|
}
|
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
for (i = 0; i < MODULE_INIT_MAX; i++) {
|
2009-09-12 11:36:22 +04:00
|
|
|
QTAILQ_INIT(&init_type_list[i]);
|
2009-05-15 02:57:31 +04:00
|
|
|
}
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2014-02-10 10:48:57 +04:00
|
|
|
QTAILQ_INIT(&dso_init_list);
|
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
inited = 1;
|
|
|
|
}
|
2009-05-14 22:29:53 +04:00
|
|
|
|
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
static ModuleTypeList *find_type(module_init_type type)
|
|
|
|
{
|
2014-02-10 10:48:57 +04:00
|
|
|
init_lists();
|
2009-05-15 02:57:31 +04:00
|
|
|
|
2016-06-14 00:57:58 +03:00
|
|
|
return &init_type_list[type];
|
2009-05-14 22:29:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void register_module_init(void (*fn)(void), module_init_type type)
|
|
|
|
{
|
|
|
|
ModuleEntry *e;
|
|
|
|
ModuleTypeList *l;
|
|
|
|
|
2011-08-21 07:09:37 +04:00
|
|
|
e = g_malloc0(sizeof(*e));
|
2009-05-14 22:29:53 +04:00
|
|
|
e->init = fn;
|
2014-02-10 10:48:57 +04:00
|
|
|
e->type = type;
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
l = find_type(type);
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2009-09-12 11:36:22 +04:00
|
|
|
QTAILQ_INSERT_TAIL(l, e, node);
|
2009-05-14 22:29:53 +04:00
|
|
|
}
|
|
|
|
|
2014-02-10 10:48:57 +04:00
|
|
|
void register_dso_module_init(void (*fn)(void), module_init_type type)
|
|
|
|
{
|
|
|
|
ModuleEntry *e;
|
|
|
|
|
|
|
|
init_lists();
|
|
|
|
|
|
|
|
e = g_malloc0(sizeof(*e));
|
|
|
|
e->init = fn;
|
|
|
|
e->type = type;
|
|
|
|
|
|
|
|
QTAILQ_INSERT_TAIL(&dso_init_list, e, node);
|
|
|
|
}
|
|
|
|
|
2009-05-14 22:29:53 +04:00
|
|
|
void module_call_init(module_init_type type)
|
|
|
|
{
|
|
|
|
ModuleTypeList *l;
|
|
|
|
ModuleEntry *e;
|
|
|
|
|
2020-02-20 07:10:59 +03:00
|
|
|
if (modules_init_done[type]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-05-15 02:57:31 +04:00
|
|
|
l = find_type(type);
|
2009-05-14 22:29:53 +04:00
|
|
|
|
2009-09-12 11:36:22 +04:00
|
|
|
QTAILQ_FOREACH(e, l, node) {
|
2009-05-14 22:29:53 +04:00
|
|
|
e->init();
|
|
|
|
}
|
2020-02-20 07:10:59 +03:00
|
|
|
|
|
|
|
modules_init_done[type] = true;
|
2009-05-14 22:29:53 +04:00
|
|
|
}
|
2014-02-10 10:48:57 +04:00
|
|
|
|
|
|
|
#ifdef CONFIG_MODULES
|
2021-06-24 13:38:05 +03:00
|
|
|
|
|
|
|
static const QemuModinfo module_info_stub[] = { {
|
|
|
|
/* end of list */
|
|
|
|
} };
|
|
|
|
static const QemuModinfo *module_info = module_info_stub;
|
2021-06-24 13:38:20 +03:00
|
|
|
static const char *module_arch;
|
2021-06-24 13:38:05 +03:00
|
|
|
|
|
|
|
void module_init_info(const QemuModinfo *info)
|
|
|
|
{
|
|
|
|
module_info = info;
|
|
|
|
}
|
|
|
|
|
2021-06-24 13:38:20 +03:00
|
|
|
void module_allow_arch(const char *arch)
|
|
|
|
{
|
|
|
|
module_arch = arch;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool module_check_arch(const QemuModinfo *modinfo)
|
|
|
|
{
|
|
|
|
if (modinfo->arch) {
|
|
|
|
if (!module_arch) {
|
|
|
|
/* no arch set -> ignore all */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (strcmp(module_arch, modinfo->arch) != 0) {
|
|
|
|
/* mismatch */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-10-19 10:52:20 +03:00
|
|
|
static int module_load_file(const char *fname, bool mayfail, bool export_symbols)
|
2014-02-10 10:48:57 +04:00
|
|
|
{
|
|
|
|
GModule *g_module;
|
|
|
|
void (*sym)(void);
|
2020-08-04 19:14:26 +03:00
|
|
|
const char *dsosuf = CONFIG_HOST_DSOSUF;
|
2014-02-10 10:48:57 +04:00
|
|
|
int len = strlen(fname);
|
|
|
|
int suf_len = strlen(dsosuf);
|
|
|
|
ModuleEntry *e, *next;
|
2020-10-19 10:52:20 +03:00
|
|
|
int ret, flags;
|
2014-02-10 10:48:57 +04:00
|
|
|
|
|
|
|
if (len <= suf_len || strcmp(&fname[len - suf_len], dsosuf)) {
|
|
|
|
/* wrong suffix */
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (access(fname, F_OK)) {
|
|
|
|
ret = -ENOENT;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(QTAILQ_EMPTY(&dso_init_list));
|
|
|
|
|
2020-10-28 08:49:44 +03:00
|
|
|
flags = 0;
|
2020-10-19 10:52:20 +03:00
|
|
|
if (!export_symbols) {
|
|
|
|
flags |= G_MODULE_BIND_LOCAL;
|
|
|
|
}
|
|
|
|
g_module = g_module_open(fname, flags);
|
2014-02-10 10:48:57 +04:00
|
|
|
if (!g_module) {
|
2020-09-23 12:12:17 +03:00
|
|
|
if (!mayfail) {
|
|
|
|
fprintf(stderr, "Failed to open module: %s\n",
|
|
|
|
g_module_error());
|
|
|
|
}
|
2014-02-10 10:48:57 +04:00
|
|
|
ret = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (!g_module_symbol(g_module, DSO_STAMP_FUN_STR, (gpointer *)&sym)) {
|
|
|
|
fprintf(stderr, "Failed to initialize module: %s\n",
|
|
|
|
fname);
|
|
|
|
/* Print some info if this is a QEMU module (but from different build),
|
|
|
|
* this will make debugging user problems easier. */
|
|
|
|
if (g_module_symbol(g_module, "qemu_module_dummy", (gpointer *)&sym)) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"Note: only modules from the same build can be loaded.\n");
|
|
|
|
}
|
|
|
|
g_module_close(g_module);
|
|
|
|
ret = -EINVAL;
|
|
|
|
} else {
|
|
|
|
QTAILQ_FOREACH(e, &dso_init_list, node) {
|
blockdev: Add dynamic module loading for block drivers
Extend the current module interface to allow for block drivers to be
loaded dynamically on request. The only block drivers that can be
converted into modules are the drivers that don't perform any init
operation except for registering themselves.
In addition, only the protocol drivers are being modularized, as they
are the only ones which see significant performance benefits. The format
drivers do not generally link to external libraries, so modularizing
them is of no benefit from a performance perspective.
All the necessary module information is located in a new structure found
in module_block.h
This spoils the purpose of 5505e8b76f (block/dmg: make it modular).
Before this patch, if module build is enabled, block-dmg.so is linked to
libbz2, whereas the main binary is not. In downstream, theoretically, it
means only the qemu-block-extra package depends on libbz2, while the
main QEMU package needn't to. With this patch, we (temporarily) change
the case so that the main QEMU depends on libbz2 again.
Signed-off-by: Marc Marí <markmb@redhat.com>
Signed-off-by: Colin Lord <clord@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1471008424-16465-4-git-send-email-clord@redhat.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
[mreitz: Do a signed comparison against the length of
block_driver_modules[], so it will not cause a compile error when
empty]
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-08-12 16:27:03 +03:00
|
|
|
e->init();
|
2014-02-10 10:48:57 +04:00
|
|
|
register_module_init(e->init, e->type);
|
|
|
|
}
|
|
|
|
ret = 0;
|
|
|
|
}
|
|
|
|
|
2021-06-24 13:38:19 +03:00
|
|
|
trace_module_load_module(fname);
|
2014-02-10 10:48:57 +04:00
|
|
|
QTAILQ_FOREACH_SAFE(e, &dso_init_list, node, next) {
|
|
|
|
QTAILQ_REMOVE(&dso_init_list, e, node);
|
|
|
|
g_free(e);
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-09-23 12:12:17 +03:00
|
|
|
bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
|
2014-02-10 10:48:57 +04:00
|
|
|
{
|
2019-07-22 16:13:23 +03:00
|
|
|
bool success = false;
|
|
|
|
|
2014-02-10 10:48:57 +04:00
|
|
|
#ifdef CONFIG_MODULES
|
|
|
|
char *fname = NULL;
|
2020-03-10 17:58:06 +03:00
|
|
|
#ifdef CONFIG_MODULE_UPGRADES
|
|
|
|
char *version_dir;
|
|
|
|
#endif
|
2018-07-04 21:10:10 +03:00
|
|
|
const char *search_dir;
|
2020-04-11 04:07:46 +03:00
|
|
|
char *dirs[5];
|
2016-09-05 05:50:44 +03:00
|
|
|
char *module_name;
|
2018-07-04 21:10:10 +03:00
|
|
|
int i = 0, n_dirs = 0;
|
2021-06-24 13:38:16 +03:00
|
|
|
int ret;
|
2020-10-19 10:52:20 +03:00
|
|
|
bool export_symbols = false;
|
2016-09-05 05:50:44 +03:00
|
|
|
static GHashTable *loaded_modules;
|
2021-06-24 13:38:16 +03:00
|
|
|
const QemuModinfo *modinfo;
|
|
|
|
const char **sl;
|
2014-02-10 10:48:57 +04:00
|
|
|
|
|
|
|
if (!g_module_supported()) {
|
|
|
|
fprintf(stderr, "Module is not supported by system.\n");
|
2019-07-22 16:13:23 +03:00
|
|
|
return false;
|
2014-02-10 10:48:57 +04:00
|
|
|
}
|
|
|
|
|
2016-09-05 05:50:44 +03:00
|
|
|
if (!loaded_modules) {
|
|
|
|
loaded_modules = g_hash_table_new(g_str_hash, g_str_equal);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_name = g_strdup_printf("%s%s", prefix, lib_name);
|
|
|
|
|
2021-03-16 16:44:56 +03:00
|
|
|
if (g_hash_table_contains(loaded_modules, module_name)) {
|
2016-09-05 05:50:44 +03:00
|
|
|
g_free(module_name);
|
2019-07-22 16:13:23 +03:00
|
|
|
return true;
|
2016-09-05 05:50:44 +03:00
|
|
|
}
|
2021-03-16 16:44:56 +03:00
|
|
|
g_hash_table_add(loaded_modules, module_name);
|
2016-09-05 05:50:44 +03:00
|
|
|
|
2021-06-24 13:38:16 +03:00
|
|
|
for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
|
2021-06-24 13:38:20 +03:00
|
|
|
if (modinfo->arch) {
|
|
|
|
if (strcmp(modinfo->name, module_name) == 0) {
|
|
|
|
if (!module_check_arch(modinfo)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-24 13:38:16 +03:00
|
|
|
if (modinfo->deps) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (sl = modinfo->deps; *sl != NULL; sl++) {
|
|
|
|
if (strcmp(module_name, *sl) == 0) {
|
|
|
|
/* another module depends on us */
|
|
|
|
export_symbols = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-04 21:10:10 +03:00
|
|
|
search_dir = getenv("QEMU_MODULE_DIR");
|
|
|
|
if (search_dir != NULL) {
|
|
|
|
dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
|
|
|
|
}
|
2020-08-18 13:00:18 +03:00
|
|
|
dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);
|
2020-03-10 17:58:06 +03:00
|
|
|
|
|
|
|
#ifdef CONFIG_MODULE_UPGRADES
|
|
|
|
version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
|
|
|
|
G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
|
|
|
|
'_');
|
|
|
|
dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
|
|
|
|
#endif
|
|
|
|
|
2018-07-04 21:10:10 +03:00
|
|
|
assert(n_dirs <= ARRAY_SIZE(dirs));
|
|
|
|
|
|
|
|
for (i = 0; i < n_dirs; i++) {
|
2016-09-05 05:50:44 +03:00
|
|
|
fname = g_strdup_printf("%s/%s%s",
|
2020-08-04 19:14:26 +03:00
|
|
|
dirs[i], module_name, CONFIG_HOST_DSOSUF);
|
2020-10-19 10:52:20 +03:00
|
|
|
ret = module_load_file(fname, mayfail, export_symbols);
|
blockdev: Add dynamic module loading for block drivers
Extend the current module interface to allow for block drivers to be
loaded dynamically on request. The only block drivers that can be
converted into modules are the drivers that don't perform any init
operation except for registering themselves.
In addition, only the protocol drivers are being modularized, as they
are the only ones which see significant performance benefits. The format
drivers do not generally link to external libraries, so modularizing
them is of no benefit from a performance perspective.
All the necessary module information is located in a new structure found
in module_block.h
This spoils the purpose of 5505e8b76f (block/dmg: make it modular).
Before this patch, if module build is enabled, block-dmg.so is linked to
libbz2, whereas the main binary is not. In downstream, theoretically, it
means only the qemu-block-extra package depends on libbz2, while the
main QEMU package needn't to. With this patch, we (temporarily) change
the case so that the main QEMU depends on libbz2 again.
Signed-off-by: Marc Marí <markmb@redhat.com>
Signed-off-by: Colin Lord <clord@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1471008424-16465-4-git-send-email-clord@redhat.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
[mreitz: Do a signed comparison against the length of
block_driver_modules[], so it will not cause a compile error when
empty]
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-08-12 16:27:03 +03:00
|
|
|
g_free(fname);
|
|
|
|
fname = NULL;
|
|
|
|
/* Try loading until loaded a module file */
|
|
|
|
if (!ret) {
|
2019-07-22 16:13:23 +03:00
|
|
|
success = true;
|
blockdev: Add dynamic module loading for block drivers
Extend the current module interface to allow for block drivers to be
loaded dynamically on request. The only block drivers that can be
converted into modules are the drivers that don't perform any init
operation except for registering themselves.
In addition, only the protocol drivers are being modularized, as they
are the only ones which see significant performance benefits. The format
drivers do not generally link to external libraries, so modularizing
them is of no benefit from a performance perspective.
All the necessary module information is located in a new structure found
in module_block.h
This spoils the purpose of 5505e8b76f (block/dmg: make it modular).
Before this patch, if module build is enabled, block-dmg.so is linked to
libbz2, whereas the main binary is not. In downstream, theoretically, it
means only the qemu-block-extra package depends on libbz2, while the
main QEMU package needn't to. With this patch, we (temporarily) change
the case so that the main QEMU depends on libbz2 again.
Signed-off-by: Marc Marí <markmb@redhat.com>
Signed-off-by: Colin Lord <clord@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1471008424-16465-4-git-send-email-clord@redhat.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
[mreitz: Do a signed comparison against the length of
block_driver_modules[], so it will not cause a compile error when
empty]
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-08-12 16:27:03 +03:00
|
|
|
break;
|
2014-02-10 10:48:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-22 16:13:23 +03:00
|
|
|
if (!success) {
|
|
|
|
g_hash_table_remove(loaded_modules, module_name);
|
2019-12-20 04:34:10 +03:00
|
|
|
g_free(module_name);
|
2019-07-22 16:13:23 +03:00
|
|
|
}
|
|
|
|
|
2018-07-04 21:10:10 +03:00
|
|
|
for (i = 0; i < n_dirs; i++) {
|
2014-02-10 10:48:57 +04:00
|
|
|
g_free(dirs[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2019-07-22 16:13:23 +03:00
|
|
|
return success;
|
2014-02-10 10:48:57 +04:00
|
|
|
}
|
2020-06-24 16:10:36 +03:00
|
|
|
|
2021-06-24 13:38:17 +03:00
|
|
|
#ifdef CONFIG_MODULES
|
2020-06-24 16:10:36 +03:00
|
|
|
|
|
|
|
static bool module_loaded_qom_all;
|
|
|
|
|
|
|
|
void module_load_qom_one(const char *type)
|
|
|
|
{
|
2021-06-24 13:38:17 +03:00
|
|
|
const QemuModinfo *modinfo;
|
|
|
|
const char **sl;
|
2020-06-24 16:10:36 +03:00
|
|
|
|
2020-07-20 13:03:51 +03:00
|
|
|
if (!type) {
|
|
|
|
return;
|
|
|
|
}
|
2021-06-24 13:38:17 +03:00
|
|
|
|
2021-06-24 13:38:19 +03:00
|
|
|
trace_module_lookup_object_type(type);
|
2021-06-24 13:38:17 +03:00
|
|
|
for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
|
|
|
|
if (!modinfo->objs) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-06-24 13:38:21 +03:00
|
|
|
if (!module_check_arch(modinfo)) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-06-24 13:38:17 +03:00
|
|
|
for (sl = modinfo->objs; *sl != NULL; sl++) {
|
|
|
|
if (strcmp(type, *sl) == 0) {
|
|
|
|
module_load_one("", modinfo->name, false);
|
|
|
|
}
|
2020-06-24 16:10:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void module_load_qom_all(void)
|
|
|
|
{
|
2021-06-24 13:38:17 +03:00
|
|
|
const QemuModinfo *modinfo;
|
2020-06-24 16:10:36 +03:00
|
|
|
|
|
|
|
if (module_loaded_qom_all) {
|
|
|
|
return;
|
|
|
|
}
|
2021-06-24 13:38:17 +03:00
|
|
|
|
|
|
|
for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
|
|
|
|
if (!modinfo->objs) {
|
2020-06-24 16:10:36 +03:00
|
|
|
continue;
|
|
|
|
}
|
2021-06-24 13:38:21 +03:00
|
|
|
if (!module_check_arch(modinfo)) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-06-24 13:38:17 +03:00
|
|
|
module_load_one("", modinfo->name, false);
|
2020-06-24 16:10:36 +03:00
|
|
|
}
|
|
|
|
module_loaded_qom_all = true;
|
|
|
|
}
|
2021-06-24 13:38:17 +03:00
|
|
|
|
2021-06-24 13:38:18 +03:00
|
|
|
void qemu_load_module_for_opts(const char *group)
|
|
|
|
{
|
|
|
|
const QemuModinfo *modinfo;
|
|
|
|
const char **sl;
|
|
|
|
|
|
|
|
for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
|
|
|
|
if (!modinfo->opts) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for (sl = modinfo->opts; *sl != NULL; sl++) {
|
|
|
|
if (strcmp(group, *sl) == 0) {
|
|
|
|
module_load_one("", modinfo->name, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-24 13:38:17 +03:00
|
|
|
#else
|
|
|
|
|
2021-06-24 13:38:20 +03:00
|
|
|
void module_allow_arch(const char *arch) {}
|
2021-06-24 13:38:18 +03:00
|
|
|
void qemu_load_module_for_opts(const char *group) {}
|
2021-06-24 13:38:17 +03:00
|
|
|
void module_load_qom_one(const char *type) {}
|
|
|
|
void module_load_qom_all(void) {}
|
|
|
|
|
|
|
|
#endif
|