Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48390
b: refs/heads/master
c: d912b0c
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Feb 14, 2007
1 parent 4c1e305 commit a651f49
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 77b14db502cb85a031fe8fde6c85d52f3e0acb63
refs/heads/master: d912b0cc1a617d7c590d57b7ea971d50c7f02503
1 change: 1 addition & 0 deletions trunk/include/linux/sysctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ struct ctl_table
int maxlen;
mode_t mode;
ctl_table *child;
ctl_table *parent; /* Automatically set */
proc_handler *proc_handler; /* Callback for text formatting */
ctl_handler *strategy; /* Callback function for all r/w */
struct proc_dir_entry *de; /* /proc control block */
Expand Down
18 changes: 18 additions & 0 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,23 @@ int do_sysctl_strategy (ctl_table *table,
}
#endif /* CONFIG_SYSCTL_SYSCALL */

static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
{
for (; table->ctl_name || table->procname; table++) {
table->parent = parent;
if (table->child)
sysctl_set_parent(table, table->child);
}
}

static __init int sysctl_init(void)
{
sysctl_set_parent(NULL, root_table);
return 0;
}

core_initcall(sysctl_init);

/**
* register_sysctl_table - register a sysctl hierarchy
* @table: the top-level table structure
Expand Down Expand Up @@ -1318,6 +1335,7 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table)
INIT_LIST_HEAD(&tmp->ctl_entry);
tmp->used = 0;
tmp->unregistering = NULL;
sysctl_set_parent(NULL, table);
spin_lock(&sysctl_lock);
list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
spin_unlock(&sysctl_lock);
Expand Down

0 comments on commit a651f49

Please sign in to comment.