diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
commit | fc53809803cd2bc2434e312b19a18fa36776da12 (patch) | |
tree | b4b43bd6538f51965ce32856e9c053d0f90919c8 /src/modules-load/modules-load.c | |
parent | Adding upstream version 255.5. (diff) | |
download | systemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip |
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/modules-load/modules-load.c')
-rw-r--r-- | src/modules-load/modules-load.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index efca237..c1f8183 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -23,14 +23,6 @@ static const char conf_file_dirs[] = CONF_PATHS_NULSTR("modules-load.d"); STATIC_DESTRUCTOR_REGISTER(arg_proc_cmdline_modules, strv_freep); -static void systemd_kmod_log(void *data, int priority, const char *file, int line, - const char *fn, const char *format, va_list args) { - - DISABLE_WARNING_FORMAT_NONLITERAL; - log_internalv(priority, 0, file, line, fn, format, args); - REENABLE_WARNING; -} - static int add_modules(const char *p) { _cleanup_strv_free_ char **k = NULL; @@ -156,7 +148,7 @@ static int parse_argv(int argc, char *argv[]) { } static int run(int argc, char *argv[]) { - _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL; + _cleanup_(sym_kmod_unrefp) struct kmod_ctx *ctx = NULL; int r, k; r = parse_argv(argc, argv); @@ -171,14 +163,9 @@ static int run(int argc, char *argv[]) { if (r < 0) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); - ctx = kmod_new(NULL, NULL); - if (!ctx) { - log_error("Failed to allocate memory for kmod."); - return -ENOMEM; - } - - kmod_load_resources(ctx); - kmod_set_log_fn(ctx, systemd_kmod_log, NULL); + r = module_setup_context(&ctx); + if (r < 0) + return log_error_errno(r, "Failed to initialize libkmod context: %m"); r = 0; |