summaryrefslogtreecommitdiff
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-09 22:36:41 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 16:40:28 -0800
commite0d045290a8454ecd7f63c78c10d412f35d6ef94 (patch)
treecadffb5cfbb130c2bcb6fc694f28a39d9b613170 /fs/proc/proc_sysctl.c
parent938aaa4f9249aa1519fd0db07fc72125de2df338 (diff)
downloadlwn-e0d045290a8454ecd7f63c78c10d412f35d6ef94.tar.gz
lwn-e0d045290a8454ecd7f63c78c10d412f35d6ef94.zip
sysctl: Factor out init_header from __register_sysctl_paths
Factor out a routing to initialize the sysctl_table_header. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 13faa48c467e..49799259b0f3 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -42,6 +42,21 @@ static struct ctl_table_root sysctl_table_root = {
static DEFINE_SPINLOCK(sysctl_lock);
+static void init_header(struct ctl_table_header *head,
+ struct ctl_table_root *root, struct ctl_table_set *set,
+ struct ctl_table *table)
+{
+ head->ctl_table_arg = table;
+ INIT_LIST_HEAD(&head->ctl_entry);
+ head->used = 0;
+ head->count = 1;
+ head->nreg = 1;
+ head->unregistering = NULL;
+ head->root = root;
+ head->set = set;
+ head->parent = NULL;
+}
+
/* called under sysctl_lock */
static int use_table(struct ctl_table_header *p)
{
@@ -932,14 +947,8 @@ struct ctl_table_header *__register_sysctl_table(
new_name += namelen + 1;
}
*prevp = table;
- header->ctl_table_arg = table;
-
- INIT_LIST_HEAD(&header->ctl_entry);
- header->used = 0;
- header->unregistering = NULL;
- header->root = root;
- header->count = 1;
- header->nreg = 1;
+
+ init_header(header, root, NULL, table);
if (sysctl_check_table(path, table))
goto fail;