mirror of
https://github.com/torvalds/linux.git
synced 2025-10-30 00:06:59 +02:00
Assign the reserved MNT_NS_ANON_INO sentinel to anonymous mount namespaces and cleanup the initial mount ns allocation. This is just a preparatory patch and the ns->inum check in ns_common_init() will be dropped in the next patch. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
21 lines
450 B
C
21 lines
450 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include <linux/ns_common.h>
|
|
|
|
int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
|
|
bool alloc_inum)
|
|
{
|
|
if (alloc_inum && !ns->inum) {
|
|
int ret;
|
|
ret = proc_alloc_inum(&ns->inum);
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
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);
|
|
return 0;
|
|
}
|