diff options
Diffstat (limited to '0001-Module-replace-the-module-with-new-module.patch')
-rw-r--r-- | 0001-Module-replace-the-module-with-new-module.patch | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/0001-Module-replace-the-module-with-new-module.patch b/0001-Module-replace-the-module-with-new-module.patch index 0cbc3fa..a1a75d9 100644 --- a/0001-Module-replace-the-module-with-new-module.patch +++ b/0001-Module-replace-the-module-with-new-module.patch @@ -1,6 +1,6 @@ -From 0eac0869e201a08170cb2255b623eab9d78072f8 Mon Sep 17 00:00:00 2001 +From 07f9e62e5239c678f0a341315490fb9c3015da03 Mon Sep 17 00:00:00 2001 From: Jason Luan <luanjianhai@huawei.com> -Date: Wed, 16 Sep 2020 01:21:50 +0000 +Date: Mon, 3 Mar 2025 13:10:30 +0800 Subject: [PATCH 1/2] Module: replace the module with new module Signed-off-by: fu.lin <fu.lin10@huawei.com> @@ -12,10 +12,10 @@ Signed-off-by: fu.lin <fu.lin10@huawei.com> 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index c095e63..4c0f159 100644 +index 0d74100..e72717f 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -873,8 +873,11 @@ static int do_finit_module(struct kmod_module *mod, unsigned int flags, +@@ -638,8 +638,11 @@ static int do_finit_module(struct kmod_module *mod, unsigned int flags, const ch kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC; if (flags & KMOD_INSERT_FORCE_MODVERSION) kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS; @@ -28,72 +28,76 @@ index c095e63..4c0f159 100644 err = -errno; diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index f3376f5..ef1576f 100644 +index 1c0d118..9c5d3e2 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h -@@ -140,6 +140,9 @@ enum kmod_remove { +@@ -709,6 +709,9 @@ int kmod_module_unref_list(struct kmod_list *list); enum kmod_insert { KMOD_INSERT_FORCE_VERMAGIC = 0x1, KMOD_INSERT_FORCE_MODVERSION = 0x2, + -+ /* custom flag */ ++ /* custom flag */ + KMOD_INSERT_REPLACE = 0x1000, }; - /* Flags to kmod_module_probe_insert_module() */ -@@ -151,6 +154,9 @@ enum kmod_probe { - KMOD_PROBE_DRY_RUN = 0x00010, - KMOD_PROBE_FAIL_ON_LOADED = 0x00020, + /** +@@ -760,6 +763,9 @@ enum kmod_probe { + KMOD_PROBE_DRY_RUN = 0x00010, + KMOD_PROBE_FAIL_ON_LOADED = 0x00020, + /* custom flag */ -+ KMOD_PROBE_REPLACE = 0x01000, ++ KMOD_PROBE_REPLACE = 0x01000, + /* codes below can be used in return value, too */ - KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000, - KMOD_PROBE_APPLY_BLACKLIST = 0x20000, + KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000, + KMOD_PROBE_APPLY_BLACKLIST = 0x20000, diff --git a/shared/missing.h b/shared/missing.h -index 7df6235..3bd0cfa 100644 +index 53b766e..bd7fe34 100644 --- a/shared/missing.h +++ b/shared/missing.h -@@ -19,6 +19,13 @@ - # define MODULE_INIT_COMPRESSED_FILE 4 - #endif +@@ -15,6 +15,13 @@ + #define MODULE_INIT_IGNORE_VERMAGIC 2 + #define MODULE_INIT_COMPRESSED_FILE 4 +#ifndef MODULE_REPLACE_MODULE +# define MODULE_REPLACE_MODULE 0x1000 +#else +_Static_assert(MODULE_REPLACE_MODULE == 0x1000, -+ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); ++ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); +#endif + #ifndef __NR_finit_module - # define __NR_finit_module -1 - #endif + #warning __NR_finit_module missing - kmod might not work correctly + #define __NR_finit_module -1 diff --git a/tools/insmod.c b/tools/insmod.c -index 4a1d11d..7e58ed3 100644 +index fef0072..687e155 100644 --- a/tools/insmod.c +++ b/tools/insmod.c -@@ -15,9 +15,10 @@ +@@ -16,13 +16,14 @@ #include "kmod.h" --static const char cmdopts_s[] = "psfVh"; -+static const char cmdopts_s[] = "psfVrh"; +-static const char cmdopts_s[] = "fsvVh"; ++static const char cmdopts_s[] = "fsvVrh"; static const struct option cmdopts[] = { - {"version", no_argument, 0, 'V'}, + // clang-format off + { "force", no_argument, 0, 'f' }, + { "syslog", no_argument, 0, 's' }, + { "verbose", no_argument, 0, 'v' }, + { "version", no_argument, 0, 'V' }, + {"replace", no_argument, 0, 'r'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0} - }; -@@ -28,6 +29,7 @@ static void help(void) - "\t%s [options] filename [args]\n" - "Options:\n" - "\t-V, --version show version\n" -+ "\t-r, --replace replace module\n" - "\t-h, --help show this help\n", - program_invocation_short_name); + { "help", no_argument, 0, 'h' }, + { NULL, 0, 0, 0 }, + // clang-format on +@@ -38,6 +39,7 @@ static void help(void) + "\t-s, --syslog print to syslog, not stderr\n" + "\t-v, --verbose enables more messages\n" + "\t-V, --version show version\n" ++ "\t-r, --replace replace module\n" + "\t-h, --help show this help\n", + program_invocation_short_name); } -@@ -76,6 +78,9 @@ static int do_insmod(int argc, char *argv[]) +@@ -85,6 +87,9 @@ static int do_insmod(int argc, char *argv[]) case 'h': help(); return EXIT_SUCCESS; @@ -101,8 +105,8 @@ index 4a1d11d..7e58ed3 100644 + flags |= KMOD_INSERT_REPLACE; + break; case 'V': - puts(PACKAGE " version " VERSION); - puts(KMOD_FEATURES); + kmod_version(); + return EXIT_SUCCESS; -- -2.46.0 +2.43.5 |