diff options
author | Christian Brauner <brauner@kernel.org> | 2024-06-28 10:05:19 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-06-28 10:37:29 +0200 |
commit | 85e4daaeb70bc68ec920e0c268eb428113d31b21 (patch) | |
tree | 5de134796d12f4f115a0c878ad3d4f2b8f4f9004 /include/linux | |
parent | d057c108155ab8d02b603c7ee5da7df615c2f32f (diff) |
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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/nsproxy.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index e6bec522b139..dab6a1734a22 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -42,6 +42,17 @@ struct 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 partial or complete new set of namespaces. |