/**
* __register_sysctl_table - register a leaf sysctl table
- * @root: List of sysctl headers to register on
- * @namespaces: Data to compute which lists of sysctl entries are visible
+ * @set: Sysctl tree to register on
* @path: The path to the directory the sysctl table is in.
* @table: the top-level table structure
*
* to the table header on success.
*/
struct ctl_table_header *__register_sysctl_table(
- struct ctl_table_root *root,
- struct nsproxy *namespaces,
+ struct ctl_table_set *set,
const char *path, struct ctl_table *table)
{
+ struct ctl_table_root *root = set->dir.header.root;
struct ctl_table_header *links = NULL;
struct ctl_table_header *header;
const char *name, *nextname;
- struct ctl_table_set *set;
struct ctl_dir *dir;
header = kzalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
if (!header)
return NULL;
- init_header(header, root, NULL, table);
+ init_header(header, root, set, table);
if (sysctl_check_table(path, table))
goto fail;
spin_lock(&sysctl_lock);
- header->set = set = lookup_header_set(root, namespaces);
dir = &set->dir;
dir->header.nreg++;
spin_unlock(&sysctl_lock);
}
static int register_leaf_sysctl_tables(const char *path, char *pos,
- struct ctl_table_header ***subheader,
- struct ctl_table_root *root, struct nsproxy *namespaces,
+ struct ctl_table_header ***subheader, struct ctl_table_set *set,
struct ctl_table *table)
{
struct ctl_table *ctl_table_arg = NULL;
/* Register everything except a directory full of subdirectories */
if (nr_files || !nr_dirs) {
struct ctl_table_header *header;
- header = __register_sysctl_table(root, namespaces, path, files);
+ header = __register_sysctl_table(set, path, files);
if (!header) {
kfree(ctl_table_arg);
goto out;
goto out;
err = register_leaf_sysctl_tables(path, child_pos, subheader,
- root, namespaces, entry->child);
+ set, entry->child);
pos[0] = '\0';
if (err)
goto out;
/**
* __register_sysctl_paths - register a sysctl table hierarchy
- * @root: List of sysctl headers to register on
- * @namespaces: Data to compute which lists of sysctl entries are visible
+ * @set: Sysctl tree to register on
* @path: The path to the directory the sysctl table is in.
* @table: the top-level table structure
*
* See __register_sysctl_table for more details.
*/
struct ctl_table_header *__register_sysctl_paths(
- struct ctl_table_root *root,
- struct nsproxy *namespaces,
+ struct ctl_table_set *set,
const struct ctl_path *path, struct ctl_table *table)
{
struct ctl_table *ctl_table_arg = table;
table = table->child;
}
if (nr_subheaders == 1) {
- header = __register_sysctl_table(root, namespaces, new_path, table);
+ header = __register_sysctl_table(set, new_path, table);
if (header)
header->ctl_table_arg = ctl_table_arg;
} else {
header->ctl_table_arg = ctl_table_arg;
if (register_leaf_sysctl_tables(new_path, pos, &subheader,
- root, namespaces, table))
+ set, table))
goto err_register_leaves;
}
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table)
{
- return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
+ return __register_sysctl_paths(&sysctl_table_root.default_set,
path, table);
}
EXPORT_SYMBOL(register_sysctl_paths);
struct ctl_table_header *register_net_sysctl_table(struct net *net,
const struct ctl_path *path, struct ctl_table *table)
{
- struct nsproxy namespaces;
- namespaces = *current->nsproxy;
- namespaces.net_ns = net;
- return __register_sysctl_paths(&net_sysctl_root,
- &namespaces, path, table);
+ return __register_sysctl_paths(&net->sysctls, path, table);
}
EXPORT_SYMBOL_GPL(register_net_sysctl_table);
struct ctl_table_header *register_net_sysctl_rotable(const
struct ctl_path *path, struct ctl_table *table)
{
- return __register_sysctl_paths(&net_sysctl_ro_root,
- &init_nsproxy, path, table);
+ return __register_sysctl_paths(&net_sysctl_ro_root.default_set,
+ path, table);
}
EXPORT_SYMBOL_GPL(register_net_sysctl_rotable);