ocfs2-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: keescook@chromium.org, yzaikin@google.com, nixiaoming@huawei.com,
	ebiederm@xmission.com, axboe@kernel.dk, clemens@ladisch.de,
	arnd@arndb.de, gregkh@linuxfoundation.org,
	jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch,
	benh@kernel.crashing.org, rdna@fb.com, viro@zeniv.linux.org.uk,
	mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com,
	vbabka@suse.cz, sfr@canb.auug.org.au, jack@suse.cz,
	amir73il@gmail.com, rafael@kernel.org, tytso@mit.edu
Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, julia.lawall@lip6.fr,
	Luis Chamberlain <mcgrof@kernel.org>,
	akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org,
	ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 08/13] inotify: simplify sysctl declaration with register_sysctl_subdir()
Date: Fri, 29 May 2020 07:41:03 +0000	[thread overview]
Message-ID: <20200529074108.16928-9-mcgrof@kernel.org> (raw)
In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org>

From: Xiaoming Ni <nixiaoming@huawei.com>

move inotify_user sysctl to inotify_user.c and use the new
register_sysctl_subdir() helper.

Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/notify/inotify/inotify_user.c | 11 ++++++++++-
 include/linux/inotify.h          |  3 ---
 kernel/sysctl.c                  | 11 -----------
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index f88bbcc9efeb..64859fbf8463 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -46,7 +46,7 @@ struct kmem_cache *inotify_inode_mark_cachep __read_mostly;
 
 #include <linux/sysctl.h>
 
-struct ctl_table inotify_table[] = {
+static struct ctl_table inotify_table[] = {
 	{
 		.procname	= "max_user_instances",
 		.data		= &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
@@ -73,6 +73,14 @@ struct ctl_table inotify_table[] = {
 	},
 	{ }
 };
+
+static void __init inotify_sysctls_init(void)
+{
+	register_sysctl_subdir("fs", "inotify", inotify_table);
+}
+
+#else
+#define inotify_sysctls_init() do { } while (0)
 #endif /* CONFIG_SYSCTL */
 
 static inline __u32 inotify_arg_to_mask(u32 arg)
@@ -826,6 +834,7 @@ static int __init inotify_user_setup(void)
 	inotify_max_queued_events = 16384;
 	init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES] = 128;
 	init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES] = 8192;
+	inotify_sysctls_init();
 
 	return 0;
 }
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 6a24905f6e1e..8d20caa1b268 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -7,11 +7,8 @@
 #ifndef _LINUX_INOTIFY_H
 #define _LINUX_INOTIFY_H
 
-#include <linux/sysctl.h>
 #include <uapi/linux/inotify.h>
 
-extern struct ctl_table inotify_table[]; /* for sysctl */
-
 #define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
 			  IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
 			  IN_MOVED_TO | IN_CREATE | IN_DELETE | \
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 04ff032f2863..30c2d521502a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -123,10 +123,6 @@ static const int maxolduid = 65535;
 static int ngroups_max = NGROUPS_MAX;
 static const int cap_last_cap = CAP_LAST_CAP;
 
-#ifdef CONFIG_INOTIFY_USER
-#include <linux/inotify.h>
-#endif
-
 #ifdef CONFIG_PROC_SYSCTL
 
 /**
@@ -3012,13 +3008,6 @@ static struct ctl_table fs_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-#ifdef CONFIG_INOTIFY_USER
-	{
-		.procname	= "inotify",
-		.mode		= 0555,
-		.child		= inotify_table,
-	},
-#endif	
 #ifdef CONFIG_EPOLL
 	{
 		.procname	= "epoll",
-- 
2.26.2

  parent reply	other threads:[~2020-05-29  7:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  7:40 [Ocfs2-devel] [PATCH 00/13] sysctl: spring cleaning Luis Chamberlain
2020-05-29  7:40 ` [Ocfs2-devel] [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper Luis Chamberlain
2020-05-29  8:13   ` Jani Nikula
2020-05-29 12:16     ` Luis Chamberlain
2020-05-29 12:40   ` Eric W. Biederman
2020-05-29 12:42     ` Eric W. Biederman
2020-05-29  7:40 ` [Ocfs2-devel] [PATCH 02/13] cdrom: use new sysctl subdir helper register_sysctl_subdir() Luis Chamberlain
2020-05-29 12:46   ` Eric W. Biederman
2020-05-29  7:40 ` [Ocfs2-devel] [PATCH 03/13] hpet: " Luis Chamberlain
2020-05-29  7:40 ` [Ocfs2-devel] [PATCH 04/13] i915: " Luis Chamberlain
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 05/13] macintosh/mac_hid.c: " Luis Chamberlain
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 06/13] ocfs2: " Luis Chamberlain
2020-05-29  8:23   ` Kees Cook
2020-05-29 11:49     ` [Ocfs2-devel] [Intel-gfx] " Luis Chamberlain
2020-05-29 14:49       ` Kees Cook
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 07/13] test_sysctl: " Luis Chamberlain
2020-05-29  7:41 ` Luis Chamberlain [this message]
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir() Luis Chamberlain
2020-05-29 10:26   ` Greg KH
2020-05-29 11:59     ` Xiaoming Ni
2020-05-29 12:09     ` Luis Chamberlain
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 10/13] eventpoll: " Luis Chamberlain
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 11/13] random: " Luis Chamberlain
2020-05-29 10:26   ` Greg KH
2020-05-29 12:09     ` Xiaoming Ni
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 12/13] sysctl: add helper to register empty subdir Luis Chamberlain
2020-05-29  8:15   ` Kees Cook
2020-05-29 13:03   ` Eric W. Biederman
2020-05-29  7:41 ` [Ocfs2-devel] [PATCH 13/13] fs: move binfmt_misc sysctl to its own file Luis Chamberlain
2020-05-29  8:14   ` Kees Cook
2020-06-04  8:45   ` Xiaoming Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200529074108.16928-9-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=benh@kernel.crashing.org \
    --cc=clemens@ladisch.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jack@suse.cz \
    --cc=jani.nikula@linux.intel.com \
    --cc=jlbec@evilplan.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=julia.lawall@lip6.fr \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark@fasheh.com \
    --cc=nixiaoming@huawei.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=rafael@kernel.org \
    --cc=rdna@fb.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tytso@mit.edu \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).