Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170012
b: refs/heads/master
c: 2315ffa
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Nov 11, 2009
1 parent b07142a commit ce4a3a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6fce56ec91b502ba6fcbbc2a6d25a8c2c7f77934
refs/heads/master: 2315ffa0a9f789c588c7139effa7404a387d8685
4 changes: 2 additions & 2 deletions trunk/fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
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;
Expand Down Expand Up @@ -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 */
Expand Down
17 changes: 2 additions & 15 deletions trunk/include/linux/sysctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
29 changes: 7 additions & 22 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
*
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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;
Expand Down

0 comments on commit ce4a3a0

Please sign in to comment.