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

nsproxy: add helper to go from arbitrary namespace to ns_common

They all contains struct ns_common ns and if there ever is one where
that isn't the case we'll catch it here at build time.

Signed-off-by: Christian Brauner <brauner@kernel.org>

+11
+11
include/linux/nsproxy.h
··· 42 42 }; 43 43 extern struct nsproxy init_nsproxy; 44 44 45 + #define to_ns_common(__ns) \ 46 + _Generic((__ns), \ 47 + struct cgroup_namespace *: &(__ns->ns), \ 48 + struct ipc_namespace *: &(__ns->ns), \ 49 + struct net *: &(__ns->ns), \ 50 + struct pid_namespace *: &(__ns->ns), \ 51 + struct mnt_namespace *: &(__ns->ns), \ 52 + struct time_namespace *: &(__ns->ns), \ 53 + struct user_namespace *: &(__ns->ns), \ 54 + struct uts_namespace *: &(__ns->ns)) 55 + 45 56 /* 46 57 * A structure to encompass all bits needed to install 47 58 * a partial or complete new set of namespaces.