summaryrefslogtreecommitdiff
path: root/0002-Module-suspend-the-module-by-rmmod-r-option.patch
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 /0002-Module-suspend-the-module-by-rmmod-r-option.patch
parent410e0c8d2dff6f4aad8c14dcd35bee888ed8cefb (diff)
automatic import of kmod
Diffstat (limited to '0002-Module-suspend-the-module-by-rmmod-r-option.patch')
-rw-r--r--0002-Module-suspend-the-module-by-rmmod-r-option.patch67
1 files changed, 34 insertions, 33 deletions
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