diff options
author | Christian Brauner <brauner@kernel.org> | 2025-09-24 13:33:59 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-09-25 09:23:54 +0200 |
commit | 4055526d35746ce8b04bfa5e14e14f28bb163186 (patch) | |
tree | 9d42503429528822e4cc7c2a38f2fd4bbcf10d4c /kernel/nscommon.c | |
parent | 10cdfcd37ade7ce736bc4a1927680f390a6b1f7b (diff) |
ns: move ns type into struct ns_common
It's misplaced in struct proc_ns_operations and ns->ops might be NULL if
the namespace is compiled out but we still want to know the type of the
namespace for the initial namespace struct.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'kernel/nscommon.c')
-rw-r--r-- | kernel/nscommon.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/nscommon.c b/kernel/nscommon.c index 3cef89ddef41..92c9df1e8774 100644 --- a/kernel/nscommon.c +++ b/kernel/nscommon.c @@ -7,7 +7,7 @@ #ifdef CONFIG_DEBUG_VFS static void ns_debug(struct ns_common *ns, const struct proc_ns_operations *ops) { - switch (ns->ops->type) { + switch (ns->ns_type) { #ifdef CONFIG_CGROUPS case CLONE_NEWCGROUP: VFS_WARN_ON_ONCE(ops != &cgroupns_operations); @@ -52,12 +52,13 @@ static void ns_debug(struct ns_common *ns, const struct proc_ns_operations *ops) } #endif -int __ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops, int inum) +int __ns_common_init(struct ns_common *ns, u32 ns_type, const struct proc_ns_operations *ops, int inum) { refcount_set(&ns->__ns_ref, 1); ns->stashed = NULL; ns->ops = ops; ns->ns_id = 0; + ns->ns_type = ns_type; RB_CLEAR_NODE(&ns->ns_tree_node); INIT_LIST_HEAD(&ns->ns_list_node); |