mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 13:15:57 +00:00
sysctl: Factor out insert_header and erase_header
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
parent
e0d045290a
commit
8425d6aaf0
@ -57,6 +57,17 @@ static void init_header(struct ctl_table_header *head,
|
|||||||
head->parent = NULL;
|
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 */
|
/* called under sysctl_lock */
|
||||||
static int use_table(struct ctl_table_header *p)
|
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
|
* do not remove from the list until nobody holds it; walking the
|
||||||
* list in do_sysctl() relies on that.
|
* 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)
|
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))
|
if (sysctl_check_dups(namespaces, header, path, table))
|
||||||
goto fail_locked;
|
goto fail_locked;
|
||||||
header->parent->count++;
|
insert_header(header);
|
||||||
list_add_tail(&header->ctl_entry, &header->set->list);
|
|
||||||
spin_unlock(&sysctl_lock);
|
spin_unlock(&sysctl_lock);
|
||||||
|
|
||||||
return header;
|
return header;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user