aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-10 01:36:41 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:40:28 -0500
commite0d045290a8454ecd7f63c78c10d412f35d6ef94 (patch)
treecadffb5cfbb130c2bcb6fc694f28a39d9b613170 /fs/proc/proc_sysctl.c
parent938aaa4f9249aa1519fd0db07fc72125de2df338 (diff)
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 = {
42 42
43static DEFINE_SPINLOCK(sysctl_lock); 43static DEFINE_SPINLOCK(sysctl_lock);
44 44
45static void init_header(struct ctl_table_header *head,
46 struct ctl_table_root *root, struct ctl_table_set *set,
47 struct ctl_table *table)
48{
49 head->ctl_table_arg = table;
50 INIT_LIST_HEAD(&head->ctl_entry);
51 head->used = 0;
52 head->count = 1;
53 head->nreg = 1;
54 head->unregistering = NULL;
55 head->root = root;
56 head->set = set;
57 head->parent = NULL;
58}
59
45/* called under sysctl_lock */ 60/* called under sysctl_lock */
46static int use_table(struct ctl_table_header *p) 61static int use_table(struct ctl_table_header *p)
47{ 62{
@@ -932,14 +947,8 @@ struct ctl_table_header *__register_sysctl_table(
932 new_name += namelen + 1; 947 new_name += namelen + 1;
933 } 948 }
934 *prevp = table; 949 *prevp = table;
935 header->ctl_table_arg = table; 950
936 951 init_header(header, root, NULL, table);
937 INIT_LIST_HEAD(&header->ctl_entry);
938 header->used = 0;
939 header->unregistering = NULL;
940 header->root = root;
941 header->count = 1;
942 header->nreg = 1;
943 if (sysctl_check_table(path, table)) 952 if (sysctl_check_table(path, table))
944 goto fail; 953 goto fail;
945 954