modules: use modinfo for qemu opts load
Use module database to figure which module adds given QemuOpts group. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-17-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9f4a0f0978
commit
5111edaf9e
17
softmmu/vl.c
17
softmmu/vl.c
|
@ -2691,23 +2691,6 @@ void qmp_x_exit_preconfig(Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MODULES
|
|
||||||
void qemu_load_module_for_opts(const char *group)
|
|
||||||
{
|
|
||||||
static bool spice_tried;
|
|
||||||
if (g_str_equal(group, "spice") && !spice_tried) {
|
|
||||||
ui_module_load_one("spice-core");
|
|
||||||
spice_tried = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool iscsi_tried;
|
|
||||||
if (g_str_equal(group, "iscsi") && !iscsi_tried) {
|
|
||||||
block_module_load_one("iscsi");
|
|
||||||
iscsi_tried = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void qemu_init(int argc, char **argv, char **envp)
|
void qemu_init(int argc, char **argv, char **envp)
|
||||||
{
|
{
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
|
|
@ -1,6 +1,2 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
|
||||||
void qemu_load_module_for_opts(const char *group)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
|
#include "qemu/config-file.h"
|
||||||
#ifdef CONFIG_MODULE_UPGRADES
|
#ifdef CONFIG_MODULE_UPGRADES
|
||||||
#include "qemu-version.h"
|
#include "qemu-version.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -322,8 +323,26 @@ void module_load_qom_all(void)
|
||||||
module_loaded_qom_all = true;
|
module_loaded_qom_all = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
void qemu_load_module_for_opts(const char *group) {}
|
||||||
void module_load_qom_one(const char *type) {}
|
void module_load_qom_one(const char *type) {}
|
||||||
void module_load_qom_all(void) {}
|
void module_load_qom_all(void) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue