summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-09-17 13:28:02 +0300
committerChristian Brauner <brauner@kernel.org>2025-09-19 15:26:18 +0300
commitf74ca6da113d5d4b21c00bb4da3f3c137162b4fe (patch)
tree4ab20d29db09fa371f24c1b36170da0d2c74abf9 /include
parentb2a0b192084acd0a86d66cbbc61e17ba1f5bd583 (diff)
downloadlinux-f74ca6da113d5d4b21c00bb4da3f3c137162b4fe.tar.xz
nscommon: move to separate file
It's really awkward spilling the ns common infrastructure into multiple headers. Move it to a separate file. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ns_common.h3
-rw-r--r--include/linux/proc_ns.h19
2 files changed, 3 insertions, 19 deletions
diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
index 7224072cccc5..78b17fe80b62 100644
--- a/include/linux/ns_common.h
+++ b/include/linux/ns_common.h
@@ -31,6 +31,9 @@ struct ns_common {
};
};
+int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
+ bool alloc_inum);
+
#define to_ns_common(__ns) \
_Generic((__ns), \
struct cgroup_namespace *: &(__ns)->ns, \
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 7f89f0829e60..9f21670b5824 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -66,25 +66,6 @@ static inline void proc_free_inum(unsigned int inum) {}
#endif /* CONFIG_PROC_FS */
-static inline int ns_common_init(struct ns_common *ns,
- const struct proc_ns_operations *ops,
- bool alloc_inum)
-{
- if (alloc_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;
-}
-
#define ns_free_inum(ns) proc_free_inum((ns)->inum)
#define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)