File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ struct ns_common {
3131 };
3232};
3333
34+ int ns_common_init (struct ns_common * ns , const struct proc_ns_operations * ops ,
35+ bool alloc_inum );
36+
3437#define to_ns_common (__ns ) \
3538 _Generic((__ns), \
3639 struct cgroup_namespace *: &(__ns)->ns, \
Original file line number Diff line number Diff line change @@ -66,25 +66,6 @@ static inline void proc_free_inum(unsigned int inum) {}
6666
6767#endif /* CONFIG_PROC_FS */
6868
69- static inline int ns_common_init (struct ns_common * ns ,
70- const struct proc_ns_operations * ops ,
71- bool alloc_inum )
72- {
73- if (alloc_inum ) {
74- int ret ;
75- ret = proc_alloc_inum (& ns -> inum );
76- if (ret )
77- return ret ;
78- }
79- refcount_set (& ns -> count , 1 );
80- ns -> stashed = NULL ;
81- ns -> ops = ops ;
82- ns -> ns_id = 0 ;
83- RB_CLEAR_NODE (& ns -> ns_tree_node );
84- INIT_LIST_HEAD (& ns -> ns_list_node );
85- return 0 ;
86- }
87-
8869#define ns_free_inum (ns ) proc_free_inum((ns)->inum)
8970
9071#define get_proc_ns (inode ) ((struct ns_common *)(inode)->i_private)
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ obj-y = fork.o exec_domain.o panic.o \
88 sysctl.o capability.o ptrace.o user.o \
99 signal.o sys.o umh.o workqueue.o pid.o task_work.o \
1010 extable.o params.o \
11- kthread.o sys_ni.o nsproxy.o nstree.o \
11+ kthread.o sys_ni.o nsproxy.o nstree.o nscommon.o \
1212 notifier.o ksysfs.o cred.o reboot.o \
1313 async.o range.o smpboot.o ucount.o regset.o ksyms_common.o
1414
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0-only
2+
3+ #include <linux/ns_common.h>
4+
5+ int ns_common_init (struct ns_common * ns , const struct proc_ns_operations * ops ,
6+ bool alloc_inum )
7+ {
8+ if (alloc_inum ) {
9+ int ret ;
10+ ret = proc_alloc_inum (& ns -> inum );
11+ if (ret )
12+ return ret ;
13+ }
14+ refcount_set (& ns -> count , 1 );
15+ ns -> stashed = NULL ;
16+ ns -> ops = ops ;
17+ ns -> ns_id = 0 ;
18+ RB_CLEAR_NODE (& ns -> ns_tree_node );
19+ INIT_LIST_HEAD (& ns -> ns_list_node );
20+ return 0 ;
21+ }
You can’t perform that action at this time.
0 commit comments