aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-09 20:35:01 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:40:28 -0500
commit8425d6aaf0704b98480131ed339c208ffce12e44 (patch)
treee4bd69b641dc9fa5677b2b7d78ca9319cd979edc /fs/proc/proc_sysctl.c
parente0d045290a8454ecd7f63c78c10d412f35d6ef94 (diff)
sysctl: Factor out insert_header and erase_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.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 49799259b0f3..7e96a2681b60 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -57,6 +57,17 @@ static void init_header(struct ctl_table_header *head,
57 head->parent = NULL; 57 head->parent = NULL;
58} 58}
59 59
60static void erase_header(struct ctl_table_header *head)
61{
62 list_del_init(&head->ctl_entry);
63}
64
65static void insert_header(struct ctl_table_header *header)
66{
67 header->parent->count++;
68 list_add_tail(&header->ctl_entry, &header->set->list);
69}
70
60/* called under sysctl_lock */ 71/* called under sysctl_lock */
61static int use_table(struct ctl_table_header *p) 72static int use_table(struct ctl_table_header *p)
62{ 73{
@@ -96,7 +107,7 @@ static void start_unregistering(struct ctl_table_header *p)
96 * do not remove from the list until nobody holds it; walking the 107 * do not remove from the list until nobody holds it; walking the
97 * list in do_sysctl() relies on that. 108 * list in do_sysctl() relies on that.
98 */ 109 */
99 list_del_init(&p->ctl_entry); 110 erase_header(p);
100} 111}
101 112
102static void sysctl_head_get(struct ctl_table_header *head) 113static void sysctl_head_get(struct ctl_table_header *head)
@@ -974,8 +985,7 @@ struct ctl_table_header *__register_sysctl_table(
974 } 985 }
975 if (sysctl_check_dups(namespaces, header, path, table)) 986 if (sysctl_check_dups(namespaces, header, path, table))
976 goto fail_locked; 987 goto fail_locked;
977 header->parent->count++; 988 insert_header(header);
978 list_add_tail(&header->ctl_entry, &header->set->list);
979 spin_unlock(&sysctl_lock); 989 spin_unlock(&sysctl_lock);
980 990
981 return header; 991 return header;