diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-09-12 13:52:49 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-09-19 14:26:16 +0200 |
| commit | d7afdf889561058068ab46fd8f306c70ef29216a (patch) | |
| tree | 5391569ec3779f9f7f6b5f1a246d41dddc013b4b /include/net | |
| parent | uts: support ns lookup (diff) | |
| download | linux-d7afdf889561058068ab46fd8f306c70ef29216a.tar.gz linux-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/net')
| -rw-r--r-- | include/net/net_namespace.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 025a7574b275..fd090ceb80bf 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -262,6 +262,11 @@ void ipx_unregister_sysctl(void); #ifdef CONFIG_NET_NS void __put_net(struct net *net); +static inline struct net *to_net_ns(struct ns_common *ns) +{ + return container_of(ns, struct net, ns); +} + /* Try using get_net_track() instead */ static inline struct net *get_net(struct net *net) { |
