X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=kernel%2Fsysctl.c;h=3ca1d5ff0319ea70321f196ab28b7b368179f271;hb=42eaf0d8f2e7b8201afc00b0ebe1bd89ea51d42d;hp=b3ee791ad663c9ef168377df1daa724a2f72351a;hpb=77b14db502cb85a031fe8fde6c85d52f3e0acb63;p=powerpc.git diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b3ee791ad6..3ca1d5ff03 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -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 @@ -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);