Skip to content

Commit

Permalink
sysctl: Factor out init_header from __register_sysctl_paths
Browse files Browse the repository at this point in the history
Factor out a routing to initialize the sysctl_table_header.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed Jan 25, 2012
1 parent 938aaa4 commit e0d0452
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit e0d0452

Please sign in to comment.