Skip to content

Commit a467257

Browse files
yingelinmcgrof
authored andcommitted
kernel/kexec_core: move kexec_core sysctls into its own file
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]>
1 parent acd0b04 commit a467257

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

kernel/kexec_core.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,28 @@ int kimage_load_segment(struct kimage *image,
936936
struct kimage *kexec_image;
937937
struct kimage *kexec_crash_image;
938938
int kexec_load_disabled;
939+
#ifdef CONFIG_SYSCTL
940+
static struct ctl_table kexec_core_sysctls[] = {
941+
{
942+
.procname = "kexec_load_disabled",
943+
.data = &kexec_load_disabled,
944+
.maxlen = sizeof(int),
945+
.mode = 0644,
946+
/* only handle a transition from default "0" to "1" */
947+
.proc_handler = proc_dointvec_minmax,
948+
.extra1 = SYSCTL_ONE,
949+
.extra2 = SYSCTL_ONE,
950+
},
951+
{ }
952+
};
953+
954+
static int __init kexec_core_sysctl_init(void)
955+
{
956+
register_sysctl_init("kernel", kexec_core_sysctls);
957+
return 0;
958+
}
959+
late_initcall(kexec_core_sysctl_init);
960+
#endif
939961

940962
/*
941963
* No panic_cpu check version of crash_kexec(). This function is called

kernel/sysctl.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#include <linux/capability.h>
6262
#include <linux/binfmts.h>
6363
#include <linux/sched/sysctl.h>
64-
#include <linux/kexec.h>
6564
#include <linux/mount.h>
6665
#include <linux/userfaultfd_k.h>
6766
#include <linux/pid.h>
@@ -1712,18 +1711,6 @@ static struct ctl_table kern_table[] = {
17121711
.proc_handler = tracepoint_printk_sysctl,
17131712
},
17141713
#endif
1715-
#ifdef CONFIG_KEXEC_CORE
1716-
{
1717-
.procname = "kexec_load_disabled",
1718-
.data = &kexec_load_disabled,
1719-
.maxlen = sizeof(int),
1720-
.mode = 0644,
1721-
/* only handle a transition from default "0" to "1" */
1722-
.proc_handler = proc_dointvec_minmax,
1723-
.extra1 = SYSCTL_ONE,
1724-
.extra2 = SYSCTL_ONE,
1725-
},
1726-
#endif
17271714
#ifdef CONFIG_MODULES
17281715
{
17291716
.procname = "modprobe",

0 commit comments

Comments
 (0)