]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs: move shared sysctls to fs/sysctls.c
authorLuis Chamberlain <mcgrof@kernel.org>
Sat, 22 Jan 2022 06:13:06 +0000 (22:13 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 22 Jan 2022 06:33:36 +0000 (08:33 +0200)
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.

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.

So move sysctls which are shared between filesystems into a common file
outside of kernel/sysctl.c.

Link: https://lkml.kernel.org/r/20211129205548.605569-6-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Lukas Middendorf <kernel@tuxforce.de>
Cc: Stephen Kitt <steve@sk2.org>
Cc: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/Makefile
fs/sysctls.c [new file with mode: 0644]
kernel/sysctl.c

index 84c5e4cdfee5a694da7fc96b6a08109d653e4cb5..ea8770d124da211a61f01d58c111d0660968de9c 100644 (file)
@@ -28,6 +28,7 @@ obj-y                         += notify/
 obj-$(CONFIG_EPOLL)            += eventpoll.o
 obj-y                          += anon_inodes.o
 obj-$(CONFIG_SIGNALFD)         += signalfd.o
+obj-$(CONFIG_SYSCTL)           += sysctls.o
 obj-$(CONFIG_TIMERFD)          += timerfd.o
 obj-$(CONFIG_EVENTFD)          += eventfd.o
 obj-$(CONFIG_USERFAULTFD)      += userfaultfd.o
diff --git a/fs/sysctls.c b/fs/sysctls.c
new file mode 100644 (file)
index 0000000..54216cd
--- /dev/null
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * /proc/sys/fs shared sysctls
+ *
+ * These sysctls are shared between different filesystems.
+ */
+#include <linux/init.h>
+#include <linux/sysctl.h>
+
+static struct ctl_table fs_shared_sysctls[] = {
+       {
+               .procname       = "overflowuid",
+               .data           = &fs_overflowuid,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_MAXOLDUID,
+       },
+       {
+               .procname       = "overflowgid",
+               .data           = &fs_overflowgid,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_MAXOLDUID,
+       },
+       { }
+};
+
+static int __init init_fs_shared_sysctls(void)
+{
+       register_sysctl_init("fs", fs_shared_sysctls);
+       return 0;
+}
+
+early_initcall(init_fs_shared_sysctls);
index 5bbb4c59dd1a1cec6280045a7cb2d1d3f73b9cc1..6d9d2001b790fe7d8beb6cbfc119f0d8ab91a1d1 100644 (file)
@@ -2897,24 +2897,6 @@ static struct ctl_table vm_table[] = {
 };
 
 static struct ctl_table fs_table[] = {
-       {
-               .procname       = "overflowuid",
-               .data           = &fs_overflowuid,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec_minmax,
-               .extra1         = SYSCTL_ZERO,
-               .extra2         = SYSCTL_MAXOLDUID,
-       },
-       {
-               .procname       = "overflowgid",
-               .data           = &fs_overflowgid,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec_minmax,
-               .extra1         = SYSCTL_ZERO,
-               .extra2         = SYSCTL_MAXOLDUID,
-       },
 #ifdef CONFIG_FILE_LOCKING
        {
                .procname       = "leases-enable",