diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-10-15 22:20:46 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-10-15 22:20:46 +0100 |
commit | 6214addcc6b6bf6b444934833144bab10cbe6a1a (patch) | |
tree | d3a67d95fcede1ef6c14ba6cb0f0624ad258ecc9 /util | |
parent | 3e40748834923798aa57e3751db13a069e2c617b (diff) | |
parent | 23ebeaae4eb09a0d92dc7f22b41e5dd08485c390 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/modules-20201015-pull-request' into staging
modules: misc fixes & tweaks.
modules: build spice chardevs as module.
# gpg: Signature made Thu 15 Oct 2020 13:53:03 BST
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/modules-20201015-pull-request:
chardev/spice: build spice chardevs as module
meson: add spice dependency to core spice source files.
meson: add spice_headers dependency.
chardev/spice: simplify chardev setup
chardev/spice: make qemu_chr_open_spice_port static
ui/spice-app: don't use qemu_chr_open_spice_port directly
modules: update qom object module comment
module: silence errors for module_load_qom_all().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/module.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/util/module.c b/util/module.c index a44ec38d93..f0ed05fbd0 100644 --- a/util/module.c +++ b/util/module.c @@ -110,7 +110,7 @@ void module_call_init(module_init_type type) } #ifdef CONFIG_MODULES -static int module_load_file(const char *fname) +static int module_load_file(const char *fname, bool mayfail) { GModule *g_module; void (*sym)(void); @@ -134,8 +134,10 @@ static int module_load_file(const char *fname) g_module = g_module_open(fname, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); if (!g_module) { - fprintf(stderr, "Failed to open module: %s\n", - g_module_error()); + if (!mayfail) { + fprintf(stderr, "Failed to open module: %s\n", + g_module_error()); + } ret = -EINVAL; goto out; } @@ -167,7 +169,7 @@ out: } #endif -bool module_load_one(const char *prefix, const char *lib_name) +bool module_load_one(const char *prefix, const char *lib_name, bool mayfail) { bool success = false; @@ -218,7 +220,7 @@ bool module_load_one(const char *prefix, const char *lib_name) 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); + ret = module_load_file(fname, mayfail); g_free(fname); fname = NULL; /* Try loading until loaded a module file */ @@ -248,8 +250,10 @@ bool module_load_one(const char *prefix, const char *lib_name) * only a very few devices & objects. * * So with the expectation that this will be rather the exception than - * to rule and the list will not gain that many entries go with a + * the rule and the list will not gain that many entries, go with a * simple manually maintained list for now. + * + * The list must be sorted by module (module_load_qom_all() needs this). */ static struct { const char *type; @@ -264,6 +268,8 @@ static struct { { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "chardev-braille", "chardev-", "baum" }, + { "chardev-spicevmc", "chardev-", "spice" }, + { "chardev-spiceport", "chardev-", "spice" }, }; static bool module_loaded_qom_all; @@ -275,13 +281,11 @@ void module_load_qom_one(const char *type) if (!type) { return; } - if (module_loaded_qom_all) { - return; - } for (i = 0; i < ARRAY_SIZE(qom_modules); i++) { if (strcmp(qom_modules[i].type, type) == 0) { module_load_one(qom_modules[i].prefix, - qom_modules[i].module); + qom_modules[i].module, + false); return; } } @@ -302,7 +306,7 @@ void module_load_qom_all(void) /* one module implementing multiple types -> load only once */ continue; } - module_load_one(qom_modules[i].prefix, qom_modules[i].module); + module_load_one(qom_modules[i].prefix, qom_modules[i].module, true); } module_loaded_qom_all = true; } |