summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-03-03 05:37:34 +0000
committerCoprDistGit <infra@openeuler.org>2025-03-03 05:37:34 +0000
commitac532eee12c3929f30735db399927eda69db0992 (patch)
treeaa634a82d42d315473851f56872b7c7016c8d77e
parent410e0c8d2dff6f4aad8c14dcd35bee888ed8cefb (diff)
automatic import of kmod
-rw-r--r--.gitignore1
-rw-r--r--0001-Module-replace-the-module-with-new-module.patch84
-rw-r--r--0002-Module-suspend-the-module-by-rmmod-r-option.patch67
-rw-r--r--kmod.changes4
-rw-r--r--kmod.spec10
-rw-r--r--sources2
6 files changed, 87 insertions, 81 deletions
diff --git a/.gitignore b/.gitignore
index b140e66..652006f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/kmod-33.tar.xz
+/kmod-34.tar.xz
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
diff --git a/0002-Module-suspend-the-module-by-rmmod-r-option.patch b/0002-Module-suspend-the-module-by-rmmod-r-option.patch
index d84410e..f8ca061 100644
--- a/0002-Module-suspend-the-module-by-rmmod-r-option.patch
+++ b/0002-Module-suspend-the-module-by-rmmod-r-option.patch
@@ -1,6 +1,6 @@
-From 3466b9698c4372ec81ed71384e1845898b7044d0 Mon Sep 17 00:00:00 2001
+From 34df0e7e2b8cdfb53cae2038944ddbaf281edd1c Mon Sep 17 00:00:00 2001
From: Ruidong Cao <caoruidong@huawei.com>
-Date: Fri, 25 Sep 2020 03:00:25 -0400
+Date: Mon, 3 Mar 2025 13:15:40 +0800
Subject: [PATCH 2/2] Module: suspend the module by rmmod r option
Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
@@ -13,10 +13,10 @@ Signed-off-by: fu.lin <fu.lin10@huawei.com>
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
-index fd9861a..96f462a 100644
+index e72717f..d9ddb99 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
-@@ -846,7 +846,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod,
+@@ -598,7 +598,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, unsigned int
return -ENOENT;
/* Filter out other flags and force ONONBLOCK */
@@ -26,57 +26,58 @@ index fd9861a..96f462a 100644
err = delete_module(mod->name, flags);
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
-index a56e5b4..78d11b3 100644
+index 9c5d3e2..4a4e0d0 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
-@@ -147,6 +147,9 @@ enum kmod_remove {
- KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */
- /* libkmod-only defines, not passed to kernel */
+@@ -819,6 +819,9 @@ enum kmod_remove {
+ KMOD_REMOVE_FORCE = O_TRUNC,
+ KMOD_REMOVE_NOWAIT = O_NONBLOCK,
KMOD_REMOVE_NOLOG = 1,
+
+ /* custom flag */
+ KMOD_REMOVE_REPLACE = 0x1000,
};
- /* Insertion flags */
+ /**
diff --git a/shared/missing.h b/shared/missing.h
-index 4d2253b..19fb36f 100644
+index bd7fe34..826dcaf 100644
--- a/shared/missing.h
+++ b/shared/missing.h
@@ -19,7 +19,7 @@
# 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`, `KMOD_REMOVE_REPLACE` and `KMOD_PROBE_REPLACE` defination");
+- "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination");
++ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE`, `KMOD_REMOVE_REPLACE` and `KMOD_PROBE_REPLACE` defination");
#endif
#ifndef __NR_finit_module
diff --git a/tools/rmmod.c b/tools/rmmod.c
-index 3942e7b..1278234 100644
+index 962d850..0907dea 100644
--- a/tools/rmmod.c
+++ b/tools/rmmod.c
-@@ -36,9 +36,10 @@
- static int verbose = DEFAULT_VERBOSE;
- static int use_syslog;
+@@ -20,10 +20,11 @@
--static const char cmdopts_s[] = "fsvVwh";
-+static const char cmdopts_s[] = "frsvVwh";
+ #include "kmod.h"
+
+-static const char cmdopts_s[] = "fsvVh";
++static const char cmdopts_s[] = "frsvVh";
static const struct option cmdopts[] = {
- {"force", no_argument, 0, 'f'},
+ // clang-format off
+ { "force", no_argument, 0, 'f' },
+ {"replace", no_argument, 0, 'r'},
- {"syslog", no_argument, 0, 's'},
- {"verbose", no_argument, 0, 'v'},
- {"version", no_argument, 0, 'V'},
-@@ -54,6 +55,7 @@ static void help(void)
- "\t-f, --force forces a module unload and may crash your\n"
- "\t machine. This requires Forced Module Removal\n"
- "\t option in your kernel. DANGEROUS\n"
-+ "\t-r, --replace replace module\n"
- "\t-s, --syslog print to syslog, not stderr\n"
- "\t-v, --verbose enables more messages\n"
- "\t-V, --version show version\n"
-@@ -120,6 +122,9 @@ static int do_rmmod(int argc, char *argv[])
+ { "syslog", no_argument, 0, 's' },
+ { "verbose", no_argument, 0, 'v' },
+ { "version", no_argument, 0, 'V' },
+@@ -39,6 +40,7 @@ static void help(void)
+ "Options:\n"
+ "\t-f, --force DANGEROUS: forces a module unload and may\n"
+ "\t crash your machine\n"
++ "\t-r, --replace replace module\n"
+ "\t-s, --syslog print to syslog, not stderr\n"
+ "\t-v, --verbose enables more messages\n"
+ "\t-V, --version show version\n"
+@@ -103,6 +105,9 @@ static int do_rmmod(int argc, char *argv[])
case 'f':
flags |= KMOD_REMOVE_FORCE;
break;
@@ -84,8 +85,8 @@ index 3942e7b..1278234 100644
+ flags |= KMOD_REMOVE_REPLACE;
+ break;
case 's':
- use_syslog = 1;
+ use_syslog = true;
break;
--
-2.35.1
+2.43.5
diff --git a/kmod.changes b/kmod.changes
index c5288bd..187a4c7 100644
--- a/kmod.changes
+++ b/kmod.changes
@@ -1,6 +1,6 @@
%changelog
-* Sun Feb 02 2025 Funda Wang <fundawang@yeah.net> - 33-1
-- update to version 33
+* Mon Mar 03 2025 Funda Wang <fundawang@yeah.net> - 34-1
+- update to version 34
- python binding removed in 32
* Tue May 07 2024 guoqinglan <guoqinglan@kylinsec.com.cn> - 30-3
diff --git a/kmod.spec b/kmod.spec
index c03fbcb..a7d7769 100644
--- a/kmod.spec
+++ b/kmod.spec
@@ -1,5 +1,5 @@
Name: kmod
-Version: 33
+Version: 34
Release: 1
Summary: Kernel module management
License: GPL-2.0-or-later
@@ -56,10 +56,6 @@ pushd $RPM_BUILD_ROOT/%{_mandir}/man5
ln -s modprobe.d.5 modprobe.conf.5
popd
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d
-
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
for i in $RPM_BUILD_ROOT%{_sbindir}/modprobe $RPM_BUILD_ROOT%{_sbindir}/modinfo $RPM_BUILD_ROOT%{_sbindir}/insmod \
$RPM_BUILD_ROOT%{_sbindir}/rmmod $RPM_BUILD_ROOT%{_sbindir}/depmod $RPM_BUILD_ROOT%{_sbindir}/lsmod
@@ -67,6 +63,10 @@ do
ln -sf ../bin/kmod $i
done
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d
+
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf
diff --git a/sources b/sources
index cf253a0..060b9d3 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-c451c4aa61521adbe8af147f498046f8 kmod-33.tar.xz
+3e6c5c9ad9c7367ab9c3cc4f08dfde62 kmod-34.tar.xz