summaryrefslogtreecommitdiff
path: root/include/linux/ipc_namespace.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-09-12 13:52:49 +0200
committerChristian Brauner <brauner@kernel.org>2025-09-19 14:26:16 +0200
commitd7afdf889561058068ab46fd8f306c70ef29216a (patch)
tree5391569ec3779f9f7f6b5f1a246d41dddc013b4b /include/linux/ipc_namespace.h
parent58f976d41fd915acd2403a2b8e0eef8e9c478357 (diff)
downloadlwn-d7afdf889561058068ab46fd8f306c70ef29216a.tar.gz
lwn-d7afdf889561058068ab46fd8f306c70ef29216a.zip
ns: add to_<type>_ns() to respective headers
Every namespace type has a container_of(ns, <ns_type>, ns) static inline function that is currently not exposed in the header. So we have a bunch of places that open-code it via container_of(). Move it to the headers so we can use it directly. Reviewed-by: Aleksa Sarai <cyphar@cyphar.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux/ipc_namespace.h')
-rw-r--r--include/linux/ipc_namespace.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e8240cf2611a..924e4754374f 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -129,6 +129,11 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
#endif
#if defined(CONFIG_IPC_NS)
+static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns)
+{
+ return container_of(ns, struct ipc_namespace, ns);
+}
+
extern struct ipc_namespace *copy_ipcs(unsigned long flags,
struct user_namespace *user_ns, struct ipc_namespace *ns);