# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/udev/direct-link-kmod.patch # Copyright (C) 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- systemd-257/src/shared/module-util.c.vanilla 2025-01-10 14:47:49.546666662 +0100 +++ systemd-257/src/shared/module-util.c 2025-01-10 14:54:48.743333320 +0100 @@ -9,7 +9,7 @@ #if HAVE_KMOD static void *libkmod_dl = NULL; - +#if 0 DLSYM_PROTOTYPE(kmod_list_next) = NULL; DLSYM_PROTOTYPE(kmod_load_resources) = NULL; DLSYM_PROTOTYPE(kmod_module_get_initstate) = NULL; @@ -48,6 +48,7 @@ DLSYM_ARG(kmod_unref), DLSYM_ARG(kmod_validate_resources)); } +#endif static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { char ***denylist = ASSERT_PTR(data); @@ -67,7 +68,7 @@ } int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose) { - _cleanup_(sym_kmod_module_unref_listp) struct kmod_list *modlist = NULL; + _cleanup_(kmod_module_unref_listp) struct kmod_list *modlist = NULL; _cleanup_strv_free_ char **denylist = NULL; bool denylist_parsed = false; struct kmod_list *itr; @@ -81,7 +82,7 @@ log_debug("Loading module: %s", module); - r = sym_kmod_module_new_from_lookup(ctx, module, &modlist); + r = kmod_module_new_from_lookup(ctx, module, &modlist); if (r < 0) return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r, "Failed to look up module alias '%s': %m", module); @@ -91,25 +92,25 @@ SYNTHETIC_ERRNO(ENOENT), "Failed to find module '%s'", module); - sym_kmod_list_foreach(itr, modlist) { - _cleanup_(sym_kmod_module_unrefp) struct kmod_module *mod = NULL; + kmod_list_foreach(itr, modlist) { + _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL; int state, err; - mod = sym_kmod_module_get_module(itr); - state = sym_kmod_module_get_initstate(mod); + mod = kmod_module_get_module(itr); + state = kmod_module_get_initstate(mod); switch (state) { case KMOD_MODULE_BUILTIN: log_full(verbose ? LOG_INFO : LOG_DEBUG, - "Module '%s' is built in", sym_kmod_module_get_name(mod)); + "Module '%s' is built in", kmod_module_get_name(mod)); break; case KMOD_MODULE_LIVE: - log_debug("Module '%s' is already loaded", sym_kmod_module_get_name(mod)); + log_debug("Module '%s' is already loaded", kmod_module_get_name(mod)); break; default: - err = sym_kmod_module_probe_insert_module( + err = kmod_module_probe_insert_module( mod, KMOD_PROBE_APPLY_BLACKLIST, /* extra_options= */ NULL, @@ -118,10 +119,10 @@ /* print_action= */ NULL); if (err == 0) log_full(verbose ? LOG_INFO : LOG_DEBUG, - "Inserted module '%s'", sym_kmod_module_get_name(mod)); + "Inserted module '%s'", kmod_module_get_name(mod)); else if (err == KMOD_PROBE_APPLY_BLACKLIST) log_full(verbose ? LOG_INFO : LOG_DEBUG, - "Module '%s' is deny-listed (by kmod)", sym_kmod_module_get_name(mod)); + "Module '%s' is deny-listed (by kmod)", kmod_module_get_name(mod)); else { assert(err < 0); @@ -135,9 +136,9 @@ denylist_parsed = true; } - if (strv_contains(denylist, sym_kmod_module_get_name(mod))) { + if (strv_contains(denylist, kmod_module_get_name(mod))) { log_full(verbose ? LOG_INFO : LOG_DEBUG, - "Module '%s' is deny-listed (by kernel)", sym_kmod_module_get_name(mod)); + "Module '%s' is deny-listed (by kernel)", kmod_module_get_name(mod)); continue; } } @@ -148,7 +149,7 @@ LOG_ERR, err, "Failed to insert module '%s': %m", - sym_kmod_module_get_name(mod)); + kmod_module_get_name(mod)); if (!IN_SET(err, -ENODEV, -ENOENT)) r = err; } @@ -171,21 +172,22 @@ } int module_setup_context(struct kmod_ctx **ret) { - _cleanup_(sym_kmod_unrefp) struct kmod_ctx *ctx = NULL; + _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL; int r; assert(ret); - +#if 0 r = dlopen_libkmod(); if (r < 0) return r; +#endif - ctx = sym_kmod_new(NULL, NULL); + ctx = kmod_new(NULL, NULL); if (!ctx) return -ENOMEM; - (void) sym_kmod_load_resources(ctx); - sym_kmod_set_log_fn(ctx, systemd_kmod_log, NULL); + (void) kmod_load_resources(ctx); + kmod_set_log_fn(ctx, systemd_kmod_log, NULL); *ret = TAKE_PTR(ctx); return 0; --- systemd-257/src/shared/module-util.h.vanilla 2025-01-10 14:47:56.623333325 +0100 +++ systemd-257/src/shared/module-util.h 2025-01-10 14:50:48.433333323 +0100 @@ -9,6 +9,7 @@ #include "macro.h" +#if 0 extern DLSYM_PROTOTYPE(kmod_list_next); extern DLSYM_PROTOTYPE(kmod_load_resources); extern DLSYM_PROTOTYPE(kmod_module_get_initstate); @@ -28,6 +29,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, sym_kmod_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, sym_kmod_module_unref); DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct kmod_list*, sym_kmod_module_unref_list, NULL); +#endif #define sym_kmod_list_foreach(list_entry, first_entry) \ for (list_entry = first_entry; \ --- ./src/core/meson.build.vanilla 2025-01-10 15:11:55.619999982 +0100 +++ ./src/core/meson.build 2025-01-10 15:12:16.519999986 +0100 @@ -179,7 +179,7 @@ ], 'dependencies' : [ libapparmor, - libkmod_cflags, + libkmod, libseccomp, libselinux, ], --- ./src/core/kmod-setup.c.vanilla 2025-01-10 15:15:06.959999986 +0100 +++ ./src/core/kmod-setup.c 2025-01-10 15:15:28.119999990 +0100 @@ -156,7 +156,7 @@ if (have_effective_cap(CAP_SYS_MODULE) <= 0) return 0; - _cleanup_(sym_kmod_unrefp) struct kmod_ctx *ctx = NULL; + _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL; FOREACH_ELEMENT(kmod, kmod_table) { if (kmod->path && access(kmod->path, F_OK) >= 0) continue; --- ./src/modules-load/meson.build.vanilla 2025-01-10 15:12:30.476666655 +0100 +++ ./src/modules-load/meson.build 2025-01-10 15:12:38.473333325 +0100 @@ -8,7 +8,7 @@ libexec_template + { 'name' : 'systemd-modules-load', 'sources' : files('modules-load.c'), - 'dependencies' : libkmod_cflags, + 'dependencies' : libkmod, }, ] --- ./src/modules-load/modules-load.c.vanilla 2025-01-10 15:15:40.689999989 +0100 +++ ./src/modules-load/modules-load.c 2025-01-10 15:15:47.719999989 +0100 @@ -135,7 +135,7 @@ } static int run(int argc, char *argv[]) { - _cleanup_(sym_kmod_unrefp) struct kmod_ctx *ctx = NULL; + _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL; int r, k; r = parse_argv(argc, argv); --- ./src/shared/module-util.c.vanilla 2025-01-10 14:56:33.319999980 +0100 +++ ./src/shared/module-util.c 2025-01-10 15:14:41.403333323 +0100 @@ -8,8 +8,8 @@ #if HAVE_KMOD -static void *libkmod_dl = NULL; #if 0 +static void *libkmod_dl = NULL; DLSYM_PROTOTYPE(kmod_list_next) = NULL; DLSYM_PROTOTYPE(kmod_load_resources) = NULL; DLSYM_PROTOTYPE(kmod_module_get_initstate) = NULL; --- ./src/shared/module-util.h.vanilla 2025-01-10 15:06:13.586666656 +0100 +++ ./src/shared/module-util.h 2025-01-10 15:06:55.539999984 +0100 @@ -25,12 +25,12 @@ extern DLSYM_PROTOTYPE(kmod_validate_resources); int dlopen_libkmod(void); - -DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, sym_kmod_unref); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, sym_kmod_module_unref); -DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct kmod_list*, sym_kmod_module_unref_list, NULL); #endif +DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, kmod_unref); +DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, kmod_module_unref); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct kmod_list*, kmod_module_unref_list, NULL); + #define sym_kmod_list_foreach(list_entry, first_entry) \ for (list_entry = first_entry; \ list_entry != NULL; \ --- ./src/shared/meson.build.vanilla 2025-01-10 15:13:00.453333321 +0100 +++ ./src/shared/meson.build 2025-01-10 15:13:09.893333318 +0100 @@ -324,7 +324,7 @@ libdl, libgcrypt, libiptc_cflags, - libkmod_cflags, + libkmod, liblz4_cflags, libmount, libopenssl, --- ./src/udev/udev-builtin-kmod.c.vanilla 2025-01-10 15:14:10.803333307 +0100 +++ ./src/udev/udev-builtin-kmod.c 2025-01-10 15:14:30.203333321 +0100 @@ -73,7 +73,7 @@ if (!ctx) return; - ctx = sym_kmod_unref(ctx); + ctx = kmod_unref(ctx); } /* called every couple of seconds during event activity; 'true' if config has changed */ @@ -81,7 +81,7 @@ if (!ctx) return false; - if (sym_kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) { + if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) { log_debug("Kernel module index needs reloading."); return true; }