aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-06-24 12:38:18 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-07-09 18:20:27 +0200
commit5111edaf9e9ffac1a1b46d5942200af13b413ea8 (patch)
tree3a2dc06da80f1f2d0ed93e2b2dd02fd2499373a5 /util
parent9f4a0f0978cde9d8e27453b3f2d3679b53623c47 (diff)
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>
Diffstat (limited to 'util')
-rw-r--r--util/module.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/module.c b/util/module.c
index 745ae0fb20..a9ec2da997 100644
--- a/util/module.c
+++ b/util/module.c
@@ -20,6 +20,7 @@
#include "qemu/queue.h"
#include "qemu/module.h"
#include "qemu/cutils.h"
+#include "qemu/config-file.h"
#ifdef CONFIG_MODULE_UPGRADES
#include "qemu-version.h"
#endif
@@ -322,8 +323,26 @@ void module_load_qom_all(void)
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
+void qemu_load_module_for_opts(const char *group) {}
void module_load_qom_one(const char *type) {}
void module_load_qom_all(void) {}