diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-04-03 06:18:02 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2009-11-11 03:53:43 -0500 |
commit | 2315ffa0a9f789c588c7139effa7404a387d8685 (patch) | |
tree | 756d32f0ab8b67e9d45a1e4399c9ee6080909e70 /kernel/sysctl.c | |
parent | 6fce56ec91b502ba6fcbbc2a6d25a8c2c7f77934 (diff) |
sysctl: Don't look at ctl_name and strategy in the generic code
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>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 29 |
1 files changed, 7 insertions, 22 deletions
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 | ||
1619 | static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) | 1619 | static 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; |