linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: ebiederm@xmission.com, keescook@chromium.org, yzaikin@google.com,
	john.johansen@canonical.com, paul@paul-moore.com,
	jmorris@namei.org, serge@hallyn.com, luto@amacapital.net,
	wad@chromium.org, dverkamp@chromium.org, paulmck@kernel.org,
	baihaowen@meizu.com, frederic@kernel.org, jeffxu@google.com,
	ebiggers@kernel.org, tytso@mit.edu, guoren@kernel.org
Cc: j.granados@samsung.com, zhangpeng362@huawei.com,
	tangmeng@uniontech.com, willy@infradead.org,
	nixiaoming@huawei.com, sujiaxun@uniontech.com,
	patches@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths()
Date: Thu,  2 Mar 2023 12:28:26 -0800	[thread overview]
Message-ID: <20230302202826.776286-12-mcgrof@kernel.org> (raw)
In-Reply-To: <20230302202826.776286-1-mcgrof@kernel.org>

Now that all users are removed, drop the export for register_sysctl_paths()

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c  | 30 +++++++++---------------------
 include/linux/sysctl.h | 11 -----------
 2 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 15d5e02f1ec0..ff06434f7be1 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1486,6 +1486,7 @@ static int count_subheaders(struct ctl_table *table)
 	return nr_subheaders + has_files;
 }
 
+/* Note: this can recurse and call itself when dealing with subdirectories */
 static int register_leaf_sysctl_tables(const char *path, char *pos,
 	struct ctl_table_header ***subheader, struct ctl_table_set *set,
 	struct ctl_table *table)
@@ -1571,9 +1572,10 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
  * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  * array. A completely 0 filled entry terminates the table.
  *
- * See __register_sysctl_table for more details.
+ * See __register_sysctl_table for more details. This routine can
+ * recurse by having register_leaf_sysctl_tables() call itself.
  */
-struct ctl_table_header *__register_sysctl_paths(
+static struct ctl_table_header *__register_sysctl_paths(
 	struct ctl_table_set *set,
 	const struct ctl_path *path, struct ctl_table *table)
 {
@@ -1613,6 +1615,7 @@ struct ctl_table_header *__register_sysctl_paths(
 		subheader = subheaders;
 		header->ctl_table_arg = ctl_table_arg;
 
+		/* this can recurse */
 		if (register_leaf_sysctl_tables(new_path, pos, &subheader,
 						set, table))
 			goto err_register_leaves;
@@ -1635,37 +1638,22 @@ struct ctl_table_header *__register_sysctl_paths(
 }
 
 /**
- * register_sysctl_paths - register a sysctl table hierarchy
- * @path: The path to the directory the sysctl table is in.
+ * register_sysctl_table - register a sysctl table hierarchy
  * @table: the top-level table structure
  *
  * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  * array. A completely 0 filled entry terminates the table.
  *
  * See __register_sysctl_paths for more details.
- */
-struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
-						struct ctl_table *table)
-{
-	return __register_sysctl_paths(&sysctl_table_root.default_set,
-					path, table);
-}
-EXPORT_SYMBOL(register_sysctl_paths);
-
-/**
- * register_sysctl_table - register a sysctl table hierarchy
- * @table: the top-level table structure
- *
- * Register a sysctl table hierarchy. @table should be a filled in ctl_table
- * array. A completely 0 filled entry terminates the table.
  *
- * See register_sysctl_paths for more details.
+ * This is a deprecated compatibility wrapper. You should avoid adding new
+ * users of this into the kernel.
  */
 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
 {
 	static const struct ctl_path null_path[] = { {} };
 
-	return register_sysctl_paths(null_path, table);
+	return __register_sysctl_paths(&sysctl_table_root.default_set, null_path, table);
 }
 EXPORT_SYMBOL(register_sysctl_table);
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 780690dc08cd..e8459fc56b50 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -221,13 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
 struct ctl_table_header *__register_sysctl_table(
 	struct ctl_table_set *set,
 	const char *path, struct ctl_table *table);
-struct ctl_table_header *__register_sysctl_paths(
-	struct ctl_table_set *set,
-	const struct ctl_path *path, struct ctl_table *table);
 struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
 struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
-struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
-						struct ctl_table *table);
 
 void unregister_sysctl_table(struct ctl_table_header * table);
 
@@ -277,12 +272,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
 	return NULL;
 }
 
-static inline struct ctl_table_header *register_sysctl_paths(
-			const struct ctl_path *path, struct ctl_table *table)
-{
-	return NULL;
-}
-
 static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table)
 {
 	return NULL;
-- 
2.39.1


  parent reply	other threads:[~2023-03-02 20:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
2023-03-02 20:28 ` [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table() Luis Chamberlain
2023-03-02 20:28 ` [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories Luis Chamberlain
2023-03-02 22:56   ` John Johansen
2023-03-02 20:28 ` [PATCH 03/11] sysctl: clarify register_sysctl_init() base directory order Luis Chamberlain
2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
2023-03-02 20:42   ` Georgia Garcia
2023-03-02 22:51   ` John Johansen
2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 22:58   ` John Johansen
2023-03-02 20:28 ` [PATCH 06/11] yama: simplfy sysctls " Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 20:28 ` [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init() Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 20:28 ` [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl() Luis Chamberlain
2023-03-02 23:13   ` Jeff Xu
2023-03-09 22:11     ` Luis Chamberlain
2023-03-09 22:27       ` Andrew Morton
2023-03-19 20:47         ` Luis Chamberlain
2023-03-10  4:14       ` Eric Biggers
2023-03-10  7:00         ` Luis Chamberlain
2023-03-02 20:28 ` [PATCH 09/11] fs-verity: " Luis Chamberlain
2023-03-07 19:47   ` Eric Biggers
2023-03-02 20:28 ` [PATCH 10/11] csky: simplify alignment sysctl registration Luis Chamberlain
2023-03-02 20:28 ` Luis Chamberlain [this message]
2023-03-10  4:17   ` [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths() Eric Biggers
2023-03-10  7:01     ` Luis Chamberlain

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=20230302202826.776286-12-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=apparmor@lists.ubuntu.com \
    --cc=baihaowen@meizu.com \
    --cc=dverkamp@chromium.org \
    --cc=ebiederm@xmission.com \
    --cc=ebiggers@kernel.org \
    --cc=frederic@kernel.org \
    --cc=guoren@kernel.org \
    --cc=j.granados@samsung.com \
    --cc=jeffxu@google.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=nixiaoming@huawei.com \
    --cc=patches@lists.linux.dev \
    --cc=paul@paul-moore.com \
    --cc=paulmck@kernel.org \
    --cc=serge@hallyn.com \
    --cc=sujiaxun@uniontech.com \
    --cc=tangmeng@uniontech.com \
    --cc=tytso@mit.edu \
    --cc=wad@chromium.org \
    --cc=willy@infradead.org \
    --cc=yzaikin@google.com \
    --cc=zhangpeng362@huawei.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).