summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-10 02:35:01 +0100
committerEric W. Biederman <ebiederm@xmission.com>2012-01-25 01:40:28 +0100
commit8425d6aaf0704b98480131ed339c208ffce12e44 (patch)
treee4bd69b641dc9fa5677b2b7d78ca9319cd979edc /fs/proc
parentsysctl: Factor out init_header from __register_sysctl_paths (diff)
downloadlinux-8425d6aaf0704b98480131ed339c208ffce12e44.tar.xz
linux-8425d6aaf0704b98480131ed339c208ffce12e44.zip
sysctl: Factor out insert_header and erase_header
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc')
-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,
head->parent = NULL;
}
+static void erase_header(struct ctl_table_header *head)
+{
+ list_del_init(&head->ctl_entry);
+}
+
+static void insert_header(struct ctl_table_header *header)
+{
+ header->parent->count++;
+ list_add_tail(&header->ctl_entry, &header->set->list);
+}
+
/* called under sysctl_lock */
static int use_table(struct ctl_table_header *p)
{
@@ -96,7 +107,7 @@ static void start_unregistering(struct ctl_table_header *p)
* do not remove from the list until nobody holds it; walking the
* list in do_sysctl() relies on that.
*/
- list_del_init(&p->ctl_entry);
+ erase_header(p);
}
static void sysctl_head_get(struct ctl_table_header *head)
@@ -974,8 +985,7 @@ struct ctl_table_header *__register_sysctl_table(
}
if (sysctl_check_dups(namespaces, header, path, table))
goto fail_locked;
- header->parent->count++;
- list_add_tail(&header->ctl_entry, &header->set->list);
+ insert_header(header);
spin_unlock(&sysctl_lock);
return header;