summaryrefslogtreecommitdiff
path: root/kernel/nscommon.c
blob: c3a90bb665ad671d08577b3808e1eb8d8c97b641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// SPDX-License-Identifier: GPL-2.0-only

#include <linux/ns_common.h>
#include <linux/proc_ns.h>

int __ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops, int inum)
{
	refcount_set(&ns->count, 1);
	ns->stashed = NULL;
	ns->ops = ops;
	ns->ns_id = 0;
	RB_CLEAR_NODE(&ns->ns_tree_node);
	INIT_LIST_HEAD(&ns->ns_list_node);

	if (inum) {
		ns->inum = inum;
		return 0;
	}
	return proc_alloc_inum(&ns->inum);
}