]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kernel/acct: move acct sysctls to its own file
authortangmeng <tangmeng@uniontech.com>
Fri, 18 Feb 2022 10:59:23 +0000 (18:59 +0800)
committerLuis Chamberlain <mcgrof@kernel.org>
Wed, 6 Apr 2022 20:43:44 +0000 (13:43 -0700)
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.

To help with this maintenance let's start by moving sysctls to places
where they actually belong.  The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.

All filesystem syctls now get reviewed by fs folks. This commit
follows the commit of fs, move the acct sysctl to its own file,
kernel/acct.c.

Signed-off-by: tangmeng <tangmeng@uniontech.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
include/linux/acct.h
kernel/acct.c
kernel/sysctl.c

index bc70e81895c097839871ec6e3e36337972c01875..2718c4854815b0d93576f9c45ed4fea803855d6d 100644 (file)
@@ -21,7 +21,6 @@
 
 #ifdef CONFIG_BSD_PROCESS_ACCT
 struct pid_namespace;
-extern int acct_parm[]; /* for sysctl */
 extern void acct_collect(long exitcode, int group_dead);
 extern void acct_process(void);
 extern void acct_exit_ns(struct pid_namespace *);
index 3df53cf1dcd5ed08a72c68bd407b35b56513a75f..13706356ec54d4386eb37d563e3a13d769da63e0 100644 (file)
  * Turned into sysctl-controllable parameters. AV, 12/11/98
  */
 
-int acct_parm[3] = {4, 2, 30};
+static int acct_parm[3] = {4, 2, 30};
 #define RESUME         (acct_parm[0])  /* >foo% free space - resume */
 #define SUSPEND                (acct_parm[1])  /* <foo% free space - suspend */
 #define ACCT_TIMEOUT   (acct_parm[2])  /* foo second timeout between checks */
 
+#ifdef CONFIG_SYSCTL
+static struct ctl_table kern_acct_table[] = {
+       {
+               .procname       = "acct",
+               .data           = &acct_parm,
+               .maxlen         = 3*sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+       },
+       { }
+};
+
+static __init int kernel_acct_sysctls_init(void)
+{
+       register_sysctl_init("kernel", kern_acct_table);
+       return 0;
+}
+late_initcall(kernel_acct_sysctls_init);
+#endif /* CONFIG_SYSCTL */
+
 /*
  * External references and all of the globals.
  */
index 90fc2212b536788c0119bc98706ad02aa8742148..5421e28dbb2527f35b6fdeebe363acdbae7dacac 100644 (file)
@@ -82,9 +82,6 @@
 #ifdef CONFIG_SPARC
 #include <asm/setup.h>
 #endif
-#ifdef CONFIG_BSD_PROCESS_ACCT
-#include <linux/acct.h>
-#endif
 #ifdef CONFIG_RT_MUTEXES
 #include <linux/rtmutex.h>
 #endif
@@ -1856,15 +1853,6 @@ static struct ctl_table kern_table[] = {
                .proc_handler   = proc_dostring,
        },
 #endif
-#ifdef CONFIG_BSD_PROCESS_ACCT
-       {
-               .procname       = "acct",
-               .data           = &acct_parm,
-               .maxlen         = 3*sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-       },
-#endif
 #ifdef CONFIG_MAGIC_SYSRQ
        {
                .procname       = "sysrq",