aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/proc_sysctl.c4
-rw-r--r--include/linux/sysctl.h17
-rw-r--r--kernel/sysctl.c29
3 files changed, 11 insertions, 39 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f667e8aeabdf..6ff9981f0a18 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -48,7 +48,7 @@ out:
48static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name) 48static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
49{ 49{
50 int len; 50 int len;
51 for ( ; p->ctl_name || p->procname; p++) { 51 for ( ; p->procname; p++) {
52 52
53 if (!p->procname) 53 if (!p->procname)
54 continue; 54 continue;
@@ -218,7 +218,7 @@ static int scan(struct ctl_table_header *head, ctl_table *table,
218 void *dirent, filldir_t filldir) 218 void *dirent, filldir_t filldir)
219{ 219{
220 220
221 for (; table->ctl_name || table->procname; table++, (*pos)++) { 221 for (; table->procname; table++, (*pos)++) {
222 int res; 222 int res;
223 223
224 /* Can't do anything without a proc name */ 224 /* Can't do anything without a proc name */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 82c32b89932d..7c4aabc04673 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1005,8 +1005,8 @@ extern ctl_handler sysctl_ms_jiffies;
1005 1005
1006/* 1006/*
1007 * Register a set of sysctl names by calling register_sysctl_table 1007 * Register a set of sysctl names by calling register_sysctl_table
1008 * with an initialised array of struct ctl_table's. An entry with zero 1008 * with an initialised array of struct ctl_table's. An entry with
1009 * ctl_name and NULL procname terminates the table. table->de will be 1009 * NULL procname terminates the table. table->de will be
1010 * set up by the registration and need not be initialised in advance. 1010 * set up by the registration and need not be initialised in advance.
1011 * 1011 *
1012 * sysctl names can be mirrored automatically under /proc/sys. The 1012 * sysctl names can be mirrored automatically under /proc/sys. The
@@ -1019,24 +1019,11 @@ extern ctl_handler sysctl_ms_jiffies;
1019 * under /proc; non-leaf nodes will be represented by directories. A 1019 * under /proc; non-leaf nodes will be represented by directories. A
1020 * null procname disables /proc mirroring at this node. 1020 * null procname disables /proc mirroring at this node.
1021 * 1021 *
1022 * sysctl entries with a zero ctl_name will not be available through
1023 * the binary sysctl interface.
1024 *
1025 * sysctl(2) can automatically manage read and write requests through 1022 * sysctl(2) can automatically manage read and write requests through
1026 * the sysctl table. The data and maxlen fields of the ctl_table 1023 * the sysctl table. The data and maxlen fields of the ctl_table
1027 * struct enable minimal validation of the values being written to be 1024 * struct enable minimal validation of the values being written to be
1028 * performed, and the mode field allows minimal authentication. 1025 * performed, and the mode field allows minimal authentication.
1029 * 1026 *
1030 * More sophisticated management can be enabled by the provision of a
1031 * strategy routine with the table entry. This will be called before
1032 * any automatic read or write of the data is performed.
1033 *
1034 * The strategy routine may return:
1035 * <0: Error occurred (error is passed to user process)
1036 * 0: OK - proceed with automatic read or write.
1037 * >0: OK - read or write has been done by the strategy routine, so
1038 * return immediately.
1039 *
1040 * There must be a proc_handler routine for any terminal nodes 1027 * There must be a proc_handler routine for any terminal nodes
1041 * mirrored under /proc/sys (non-terminals are handled by a built-in 1028 * mirrored under /proc/sys (non-terminals are handled by a built-in
1042 * directory handler). Several default handlers are available to 1029 * directory handler). Several default handlers are available to
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f6dacc383c16..b6b6eb1abebb 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)
1618 1618
1619static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1619static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1620{ 1620{
1621 for (; table->ctl_name || table->procname; table++) { 1621 for (; table->procname; table++) {
1622 table->parent = parent; 1622 table->parent = parent;
1623 if (table->child) 1623 if (table->child)
1624 sysctl_set_parent(table, table->child); 1624 sysctl_set_parent(table, table->child);
@@ -1650,11 +1650,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch,
1650 return NULL; 1650 return NULL;
1651 1651
1652 /* ... and nothing else */ 1652 /* ... and nothing else */
1653 if (branch[1].procname || branch[1].ctl_name) 1653 if (branch[1].procname)
1654 return NULL; 1654 return NULL;
1655 1655
1656 /* table should contain subdirectory with the same name */ 1656 /* table should contain subdirectory with the same name */
1657 for (p = table; p->procname || p->ctl_name; p++) { 1657 for (p = table; p->procname; p++) {
1658 if (!p->child) 1658 if (!p->child)
1659 continue; 1659 continue;
1660 if (p->procname && strcmp(p->procname, s) == 0) 1660 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)
1699 * 1699 *
1700 * The members of the &struct ctl_table structure are used as follows: 1700 * The members of the &struct ctl_table structure are used as follows:
1701 * 1701 *
1702 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number 1702 * ctl_name - Dead
1703 * must be unique within that level of sysctl
1704 * 1703 *
1705 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not 1704 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1706 * enter a sysctl file 1705 * enter a sysctl file
@@ -1716,7 +1715,7 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1716 * 1715 *
1717 * proc_handler - the text handler routine (described below) 1716 * proc_handler - the text handler routine (described below)
1718 * 1717 *
1719 * strategy - the strategy routine (described below) 1718 * strategy - Dead
1720 * 1719 *
1721 * de - for internal use by the sysctl routines 1720 * de - for internal use by the sysctl routines
1722 * 1721 *
@@ -1730,19 +1729,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1730 * struct enable minimal validation of the values being written to be 1729 * struct enable minimal validation of the values being written to be
1731 * performed, and the mode field allows minimal authentication. 1730 * performed, and the mode field allows minimal authentication.
1732 * 1731 *
1733 * More sophisticated management can be enabled by the provision of a
1734 * strategy routine with the table entry. This will be called before
1735 * any automatic read or write of the data is performed.
1736 *
1737 * The strategy routine may return
1738 *
1739 * < 0 - Error occurred (error is passed to user process)
1740 *
1741 * 0 - OK - proceed with automatic read or write.
1742 *
1743 * > 0 - OK - read or write has been done by the strategy routine, so
1744 * return immediately.
1745 *
1746 * There must be a proc_handler routine for any terminal nodes 1732 * There must be a proc_handler routine for any terminal nodes
1747 * mirrored under /proc/sys (non-terminals are handled by a built-in 1733 * mirrored under /proc/sys (non-terminals are handled by a built-in
1748 * directory handler). Several default handlers are available to 1734 * directory handler). Several default handlers are available to
@@ -1769,13 +1755,13 @@ struct ctl_table_header *__register_sysctl_paths(
1769 struct ctl_table_set *set; 1755 struct ctl_table_set *set;
1770 1756
1771 /* Count the path components */ 1757 /* Count the path components */
1772 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath) 1758 for (npath = 0; path[npath].procname; ++npath)
1773 ; 1759 ;
1774 1760
1775 /* 1761 /*
1776 * For each path component, allocate a 2-element ctl_table array. 1762 * For each path component, allocate a 2-element ctl_table array.
1777 * The first array element will be filled with the sysctl entry 1763 * The first array element will be filled with the sysctl entry
1778 * for this, the second will be the sentinel (ctl_name == 0). 1764 * for this, the second will be the sentinel (procname == 0).
1779 * 1765 *
1780 * We allocate everything in one go so that we don't have to 1766 * We allocate everything in one go so that we don't have to
1781 * worry about freeing additional memory in unregister_sysctl_table. 1767 * worry about freeing additional memory in unregister_sysctl_table.
@@ -1792,7 +1778,6 @@ struct ctl_table_header *__register_sysctl_paths(
1792 for (n = 0; n < npath; ++n, ++path) { 1778 for (n = 0; n < npath; ++n, ++path) {
1793 /* Copy the procname */ 1779 /* Copy the procname */
1794 new->procname = path->procname; 1780 new->procname = path->procname;
1795 new->ctl_name = path->ctl_name;
1796 new->mode = 0555; 1781 new->mode = 0555;
1797 1782
1798 *prevp = new; 1783 *prevp = new;