Commit 85e4daae authored by Christian Brauner's avatar Christian Brauner

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: default avatarChristian Brauner <brauner@kernel.org>
parent d057c108
...@@ -42,6 +42,17 @@ struct nsproxy { ...@@ -42,6 +42,17 @@ struct nsproxy {
}; };
extern struct nsproxy init_nsproxy; extern struct nsproxy init_nsproxy;
#define to_ns_common(__ns) \
_Generic((__ns), \
struct cgroup_namespace *: &(__ns->ns), \
struct ipc_namespace *: &(__ns->ns), \
struct net *: &(__ns->ns), \
struct pid_namespace *: &(__ns->ns), \
struct mnt_namespace *: &(__ns->ns), \
struct time_namespace *: &(__ns->ns), \
struct user_namespace *: &(__ns->ns), \
struct uts_namespace *: &(__ns->ns))
/* /*
* A structure to encompass all bits needed to install * A structure to encompass all bits needed to install
* a partial or complete new set of namespaces. * a partial or complete new set of namespaces.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment