In sysctl_net register the two networking roots in the proper order.
In register_sysctl walk the sysctl sets in the reverse order of the
sysctl roots.
Remove parent from ctl_table_set and setup_sysctl_set as it is no
longer needed.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
header->attached_by = header->ctl_table;
header->attached_to = root_table;
header->parent = &root_table_header;
- for (set = header->set; set; set = set->parent) {
+ set = header->set;
+ root = header->root;
+ for (;;) {
struct ctl_table_header *p;
list_for_each_entry(p, &set->list, ctl_entry) {
if (p->unregistering)
continue;
try_attach(p, header);
}
+ if (root == &sysctl_table_root)
+ break;
+ root = list_entry(root->root_list.prev,
+ struct ctl_table_root, root_list);
+ set = lookup_header_set(root, namespaces);
}
header->parent->count++;
list_add_tail(&header->ctl_entry, &header->set->list);
EXPORT_SYMBOL(unregister_sysctl_table);
void setup_sysctl_set(struct ctl_table_set *p,
- struct ctl_table_set *parent,
int (*is_seen)(struct ctl_table_set *))
{
INIT_LIST_HEAD(&p->list);
- p->parent = parent ? parent : &sysctl_table_root.default_set;
p->is_seen = is_seen;
}
struct ctl_table_set {
struct list_head list;
- struct ctl_table_set *parent;
int (*is_seen)(struct ctl_table_set *);
};
void proc_sys_poll_notify(struct ctl_table_poll *poll);
extern void setup_sysctl_set(struct ctl_table_set *p,
- struct ctl_table_set *parent,
int (*is_seen)(struct ctl_table_set *));
extern void retire_sysctl_set(struct ctl_table_set *set);
}
static inline void setup_sysctl_set(struct ctl_table_set *p,
- struct ctl_table_set *parent,
int (*is_seen)(struct ctl_table_set *))
{
}
static int __net_init sysctl_net_init(struct net *net)
{
setup_sysctl_set(&net->sysctls,
- &net_sysctl_ro_root.default_set,
is_seen);
return 0;
}
ret = register_pernet_subsys(&sysctl_pernet_ops);
if (ret)
goto out;
- register_sysctl_root(&net_sysctl_root);
- setup_sysctl_set(&net_sysctl_ro_root.default_set, NULL, NULL);
+ setup_sysctl_set(&net_sysctl_ro_root.default_set, NULL);
register_sysctl_root(&net_sysctl_ro_root);
+ register_sysctl_root(&net_sysctl_root);
out:
return ret;
}