[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/48] modules: use modinfo for qemu opts load
From: |
Paolo Bonzini |
Subject: |
[PULL 20/48] modules: use modinfo for qemu opts load |
Date: |
Thu, 8 Jul 2021 17:17:20 +0200 |
From: Gerd Hoffmann <kraxel@redhat.com>
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>
---
softmmu/vl.c | 17 -----------------
stubs/module-opts.c | 4 ----
util/module.c | 19 +++++++++++++++++++
3 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 7cef3423a7..190b71a0f2 100644
--- a/softmmu/vl.c
+++ b/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)
{
QemuOpts *opts;
diff --git a/stubs/module-opts.c b/stubs/module-opts.c
index a7d0e4ad6e..5412429ea8 100644
--- a/stubs/module-opts.c
+++ b/stubs/module-opts.c
@@ -1,6 +1,2 @@
#include "qemu/osdep.h"
#include "qemu/config-file.h"
-
-void qemu_load_module_for_opts(const char *group)
-{
-}
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) {}
--
2.31.1
- [PULL 13/48] modules: add usb-redir module annotations, (continued)
- [PULL 13/48] modules: add usb-redir module annotations, Paolo Bonzini, 2021/07/08
- [PULL 14/48] modules: add ccid module annotations, Paolo Bonzini, 2021/07/08
- [PULL 08/48] modules: check if all dependencies can be satisfied, Paolo Bonzini, 2021/07/08
- [PULL 11/48] modules: add chardev module annotations, Paolo Bonzini, 2021/07/08
- [PULL 15/48] modules: add ui module annotations, Paolo Bonzini, 2021/07/08
- [PULL 16/48] modules: add s390x module annotations, Paolo Bonzini, 2021/07/08
- [PULL 17/48] modules: add block module annotations, Paolo Bonzini, 2021/07/08
- [PULL 18/48] modules: use modinfo for dependencies, Paolo Bonzini, 2021/07/08
- [PULL 23/48] modules: check arch on qom lookup, Paolo Bonzini, 2021/07/08
- [PULL 19/48] modules: use modinfo for qom load, Paolo Bonzini, 2021/07/08
- [PULL 20/48] modules: use modinfo for qemu opts load,
Paolo Bonzini <=
- [PULL 27/48] modules: module.h kerneldoc annotations, Paolo Bonzini, 2021/07/08
- [PULL 24/48] modules: target-specific module build infrastructure, Paolo Bonzini, 2021/07/08
- [PULL 25/48] modules: add documentation for module sourcesets, Paolo Bonzini, 2021/07/08
- [PULL 21/48] modules: add tracepoints, Paolo Bonzini, 2021/07/08
- [PULL 22/48] modules: check arch and block load on mismatch, Paolo Bonzini, 2021/07/08
- [PULL 29/48] accel: autoload modules, Paolo Bonzini, 2021/07/08
- [PULL 28/48] modules: hook up modules.h to docs build, Paolo Bonzini, 2021/07/08
- [PULL 30/48] accel: add qtest module annotations, Paolo Bonzini, 2021/07/08
- [PULL 32/48] accel: add tcg module annotations, Paolo Bonzini, 2021/07/08
- [PULL 35/48] usb: drop usb_host_dev_is_scsi_storage hook, Paolo Bonzini, 2021/07/08