]> Git Repo - linux.git/commitdiff
kernel/kexec_core: move kexec_core sysctls into its own file
authoryingelin <[email protected]>
Sun, 24 Apr 2022 02:57:40 +0000 (10:57 +0800)
committerLuis Chamberlain <[email protected]>
Mon, 25 Apr 2022 21:01:11 +0000 (14:01 -0700)
This move the kernel/kexec_core.c respective sysctls to its own file.

kernel/sysctl.c has grown to an insane mess, We move sysctls to places
where features actually belong to improve the readability and reduce
merge conflicts. At the same time, the proc-sysctl maintainers can easily
care about the core logic other than the sysctl knobs added for some feature.

We already moved all filesystem sysctls out. This patch is part of the effort
to move kexec related sysctls out.

Signed-off-by: yingelin <[email protected]>
Acked-by: Baoquan He <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
kernel/kexec_core.c
kernel/sysctl.c

index 68480f731192ebe325f607953dbdcc70d2dfbe18..a0456baf52cc7c4051ec3fb4eab42dac75bc56e0 100644 (file)
@@ -936,6 +936,28 @@ int kimage_load_segment(struct kimage *image,
 struct kimage *kexec_image;
 struct kimage *kexec_crash_image;
 int kexec_load_disabled;
+#ifdef CONFIG_SYSCTL
+static struct ctl_table kexec_core_sysctls[] = {
+       {
+               .procname       = "kexec_load_disabled",
+               .data           = &kexec_load_disabled,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               /* only handle a transition from default "0" to "1" */
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ONE,
+               .extra2         = SYSCTL_ONE,
+       },
+       { }
+};
+
+static int __init kexec_core_sysctl_init(void)
+{
+       register_sysctl_init("kernel", kexec_core_sysctls);
+       return 0;
+}
+late_initcall(kexec_core_sysctl_init);
+#endif
 
 /*
  * No panic_cpu check version of crash_kexec().  This function is called
index b60345cbadf05672d48fd2ef063223698453d23f..0f3cb61a2e39e09355b1b77a1b70dfd0a60b229b 100644 (file)
@@ -61,7 +61,6 @@
 #include <linux/capability.h>
 #include <linux/binfmts.h>
 #include <linux/sched/sysctl.h>
-#include <linux/kexec.h>
 #include <linux/mount.h>
 #include <linux/userfaultfd_k.h>
 #include <linux/pid.h>
@@ -1712,18 +1711,6 @@ static struct ctl_table kern_table[] = {
                .proc_handler   = tracepoint_printk_sysctl,
        },
 #endif
-#ifdef CONFIG_KEXEC_CORE
-       {
-               .procname       = "kexec_load_disabled",
-               .data           = &kexec_load_disabled,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               /* only handle a transition from default "0" to "1" */
-               .proc_handler   = proc_dointvec_minmax,
-               .extra1         = SYSCTL_ONE,
-               .extra2         = SYSCTL_ONE,
-       },
-#endif
 #ifdef CONFIG_MODULES
        {
                .procname       = "modprobe",
This page took 0.061964 seconds and 4 git commands to generate.