All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: linux-kernel@vger.kernel.org
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Subject: [PATCH 07/23] sysctl: Don't look at ctl_name and strategy in the generic code
Date: Sun,  8 Nov 2009 04:21:54 -0800	[thread overview]
Message-ID: <1257682930-31401-7-git-send-email-ebiederm@xmission.com> (raw)
In-Reply-To: <m14op5jjo4.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@xmission.com>

The ctl_name and strategy fields are unused, now that sys_sysctl
is a compatibility wrapper around /proc/sys.  No longer looking
at them in the generic code is effectively what we are doing
now and provides the guarantee that during further cleanups
we can just remove references to those fields and everything
will work ok.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/proc/proc_sysctl.c  |    4 ++--
 include/linux/sysctl.h |   17 ++---------------
 kernel/sysctl.c        |   29 +++++++----------------------
 3 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f667e8a..6ff9981 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -48,7 +48,7 @@ out:
 static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
 {
 	int len;
-	for ( ; p->ctl_name || p->procname; p++) {
+	for ( ; p->procname; p++) {
 
 		if (!p->procname)
 			continue;
@@ -218,7 +218,7 @@ static int scan(struct ctl_table_header *head, ctl_table *table,
 		void *dirent, filldir_t filldir)
 {
 
-	for (; table->ctl_name || table->procname; table++, (*pos)++) {
+	for (; table->procname; table++, (*pos)++) {
 		int res;
 
 		/* Can't do anything without a proc name */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 82c32b8..7c4aabc 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1005,8 +1005,8 @@ extern ctl_handler sysctl_ms_jiffies;
 
 /*
  * Register a set of sysctl names by calling register_sysctl_table
- * with an initialised array of struct ctl_table's.  An entry with zero
- * ctl_name and NULL procname terminates the table.  table->de will be
+ * with an initialised array of struct ctl_table's.  An entry with 
+ * NULL procname terminates the table.  table->de will be
  * set up by the registration and need not be initialised in advance.
  *
  * sysctl names can be mirrored automatically under /proc/sys.  The
@@ -1019,24 +1019,11 @@ extern ctl_handler sysctl_ms_jiffies;
  * under /proc; non-leaf nodes will be represented by directories.  A
  * null procname disables /proc mirroring at this node.
  *
- * sysctl entries with a zero ctl_name will not be available through
- * the binary sysctl interface.
- *
  * sysctl(2) can automatically manage read and write requests through
  * the sysctl table.  The data and maxlen fields of the ctl_table
  * struct enable minimal validation of the values being written to be
  * performed, and the mode field allows minimal authentication.
  * 
- * More sophisticated management can be enabled by the provision of a
- * strategy routine with the table entry.  This will be called before
- * any automatic read or write of the data is performed.
- * 
- * The strategy routine may return:
- * <0: Error occurred (error is passed to user process)
- * 0:  OK - proceed with automatic read or write.
- * >0: OK - read or write has been done by the strategy routine, so 
- *     return immediately.
- * 
  * There must be a proc_handler routine for any terminal nodes
  * mirrored under /proc/sys (non-terminals are handled by a built-in
  * directory handler).  Several default handlers are available to
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f6dacc3..b6b6eb1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1618,7 +1618,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
 
 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
 {
-	for (; table->ctl_name || table->procname; table++) {
+	for (; table->procname; table++) {
 		table->parent = parent;
 		if (table->child)
 			sysctl_set_parent(table, table->child);
@@ -1650,11 +1650,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch,
 		return NULL;
 
 	/* ... and nothing else */
-	if (branch[1].procname || branch[1].ctl_name)
+	if (branch[1].procname)
 		return NULL;
 
 	/* table should contain subdirectory with the same name */
-	for (p = table; p->procname || p->ctl_name; p++) {
+	for (p = table; p->procname; p++) {
 		if (!p->child)
 			continue;
 		if (p->procname && strcmp(p->procname, s) == 0)
@@ -1699,8 +1699,7 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
  *
  * The members of the &struct ctl_table structure are used as follows:
  *
- * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
- *            must be unique within that level of sysctl
+ * ctl_name - Dead
  *
  * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
  *            enter a sysctl file
@@ -1716,7 +1715,7 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
  *
  * proc_handler - the text handler routine (described below)
  *
- * strategy - the strategy routine (described below)
+ * strategy - Dead
  *
  * de - for internal use by the sysctl routines
  *
@@ -1730,19 +1729,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
  * struct enable minimal validation of the values being written to be
  * performed, and the mode field allows minimal authentication.
  *
- * More sophisticated management can be enabled by the provision of a
- * strategy routine with the table entry.  This will be called before
- * any automatic read or write of the data is performed.
- *
- * The strategy routine may return
- *
- * < 0 - Error occurred (error is passed to user process)
- *
- * 0   - OK - proceed with automatic read or write.
- *
- * > 0 - OK - read or write has been done by the strategy routine, so
- *       return immediately.
- *
  * There must be a proc_handler routine for any terminal nodes
  * mirrored under /proc/sys (non-terminals are handled by a built-in
  * directory handler).  Several default handlers are available to
@@ -1769,13 +1755,13 @@ struct ctl_table_header *__register_sysctl_paths(
 	struct ctl_table_set *set;
 
 	/* Count the path components */
-	for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
+	for (npath = 0; path[npath].procname; ++npath)
 		;
 
 	/*
 	 * For each path component, allocate a 2-element ctl_table array.
 	 * The first array element will be filled with the sysctl entry
-	 * for this, the second will be the sentinel (ctl_name == 0).
+	 * for this, the second will be the sentinel (procname == 0).
 	 *
 	 * We allocate everything in one go so that we don't have to
 	 * worry about freeing additional memory in unregister_sysctl_table.
@@ -1792,7 +1778,6 @@ struct ctl_table_header *__register_sysctl_paths(
 	for (n = 0; n < npath; ++n, ++path) {
 		/* Copy the procname */
 		new->procname = path->procname;
-		new->ctl_name = path->ctl_name;
 		new->mode     = 0555;
 
 		*prevp = new;
-- 
1.6.5.2.143.g8cc62


  parent reply	other threads:[~2009-11-08 12:26 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 12:16 [PATCH 00/23] Removal of binary sysctl support Eric W. Biederman
2009-11-08 12:21 ` [PATCH 01/23] sysctl: Remove the unused frv sysctl unumbers Eric W. Biederman
2009-11-08 12:21 ` [PATCH 02/23] sysctl: Stop using binary sysctl numbers in arlan Eric W. Biederman
2009-11-11 21:07   ` John W. Linville
2009-11-08 12:21 ` [PATCH 03/23] sysctl: Reduce sys_sysctl to a compatibility wrapper around /proc/sys Eric W. Biederman
2009-11-08 12:21 ` [PATCH 04/23] sysctl: Neuter the generic sysctl strategy routines Eric W. Biederman
2009-11-08 12:21 ` [PATCH 05/23] sysctl: Remove dead code from sysctl_check Eric W. Biederman
2009-11-08 12:21 ` [PATCH 06/23] sysctl: Remove references to ctl_name and strategy from the generic sysctl table Eric W. Biederman
2009-11-08 12:21 ` Eric W. Biederman [this message]
2009-11-08 12:21 ` [PATCH 08/23] sysctl ipc: Remove dead binary sysctl support code Eric W. Biederman
2009-11-08 12:21 ` [PATCH 09/23] sysctl net: Remove unused binary sysctl code Eric W. Biederman
2009-11-08 12:21 ` [PATCH 10/23] sysctl fs: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:21 ` [PATCH 11/23] sysctl kernel: Remove binary sysctl logic Eric W. Biederman
2009-11-08 12:21 ` [PATCH 12/23] sysctl security/keys: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 13/23] sysctl crypto: " Eric W. Biederman
2009-11-08 15:44   ` Herbert Xu
2009-11-08 12:22 ` [PATCH 14/23] sysctl drivers: " Eric W. Biederman
2009-11-09  8:17   ` Clemens Ladisch
2009-11-08 12:22 ` [PATCH 15/23] sysctl mips/lasat: " Eric W. Biederman
2009-11-09 14:10   ` Ralf Baechle
2009-11-08 12:22 ` [PATCH 16/23] sysctl frv: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 17/23] sysctl s390: Remove dead sysctl binary support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 18/23] sysctl ia64: Remove dead binary sysctl support Eric W. Biederman
2009-11-08 12:22 ` [PATCH 19/23] sysctl powerpc: " Eric W. Biederman
2009-11-08 20:44   ` Benjamin Herrenschmidt
2009-11-08 12:22 ` [PATCH 20/23] sysctl sh: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 21/23] sysctl x86: " Eric W. Biederman
2009-11-08 12:22 ` [PATCH 22/23] sysctl arm: Remove " Eric W. Biederman
2009-11-08 12:34   ` Russell King
2009-11-08 22:45     ` Eric W. Biederman
2009-11-08 22:56       ` Russell King
2009-11-08 23:31         ` Eric W. Biederman
2009-11-08 23:34           ` Russell King
2009-11-08 23:05       ` Eric W. Biederman
2009-11-09  0:48         ` Arjan van de Ven
2009-11-09  3:27           ` Eric W. Biederman
2009-11-09  4:57             ` Arjan van de Ven
2009-11-09  5:37               ` Eric W. Biederman
2009-11-09  9:38                 ` Andi Kleen
2009-11-09 11:45                   ` Eric W. Biederman
2009-11-09 12:04                     ` Andi Kleen
2009-11-09 12:41                       ` Eric W. Biederman
2009-11-09 13:28                         ` Andi Kleen
2009-11-09 15:28                           ` Arnd Bergmann
2009-11-09 15:46                             ` Andi Kleen
2009-11-09 16:23                               ` Arnd Bergmann
2009-11-10  4:42                                 ` Eric W. Biederman
2009-11-10  8:01                               ` Eric W. Biederman
2009-11-11  2:31                               ` Eric W. Biederman
2009-11-09 12:42                       ` Eric W. Biederman
2009-11-08 12:22 ` [PATCH 23/23] sysctl: Remove the last of the generic " Eric W. Biederman
2009-11-08 13:06 ` [PATCH 00/23] Removal of " Arnd Bergmann
2009-11-09  3:44   ` Eric W. Biederman

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=1257682930-31401-7-git-send-email-ebiederm@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.