Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+25 -20
+3
include/linux/ns_common.h
··· 31 31 }; 32 32 }; 33 33 34 + int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops, 35 + bool alloc_inum); 36 + 34 37 #define to_ns_common(__ns) \ 35 38 _Generic((__ns), \ 36 39 struct cgroup_namespace *: &(__ns)->ns, \
-19
include/linux/proc_ns.h
··· 66 66 67 67 #endif /* CONFIG_PROC_FS */ 68 68 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 - 88 69 #define ns_free_inum(ns) proc_free_inum((ns)->inum) 89 70 90 71 #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
+1 -1
kernel/Makefile
··· 8 8 sysctl.o capability.o ptrace.o user.o \ 9 9 signal.o sys.o umh.o workqueue.o pid.o task_work.o \ 10 10 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 \ 12 12 notifier.o ksysfs.o cred.o reboot.o \ 13 13 async.o range.o smpboot.o ucount.o regset.o ksyms_common.o 14 14
+21
kernel/nscommon.c
··· 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 + }