On Wed 10-09-25 16:36:49, Christian Brauner wrote:
> Move the helper to ns_common.h where it belongs.
>
> Signed-off-by: Christian Brauner <brauner@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> include/linux/ns_common.h | 20 ++++++++++++++++++++
> include/linux/nsproxy.h | 11 -----------
> 2 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
> index 7d22ea50b098..bc2e0758e1c9 100644
> --- a/include/linux/ns_common.h
> +++ b/include/linux/ns_common.h
> @@ -6,6 +6,15 @@
>
> struct proc_ns_operations;
>
> +struct cgroup_namespace;
> +struct ipc_namespace;
> +struct mnt_namespace;
> +struct net;
> +struct pid_namespace;
> +struct time_namespace;
> +struct user_namespace;
> +struct uts_namespace;
> +
> struct ns_common {
> struct dentry *stashed;
> const struct proc_ns_operations *ops;
> @@ -13,4 +22,15 @@ struct ns_common {
> refcount_t count;
> };
>
> +#define to_ns_common(__ns) \
> + _Generic((__ns), \
> + struct cgroup_namespace *: &(__ns)->ns, \
> + struct ipc_namespace *: &(__ns)->ns, \
> + struct mnt_namespace *: &(__ns)->ns, \
> + struct net *: &(__ns)->ns, \
> + struct pid_namespace *: &(__ns)->ns, \
> + struct time_namespace *: &(__ns)->ns, \
> + struct user_namespace *: &(__ns)->ns, \
> + struct uts_namespace *: &(__ns)->ns)
> +
> #endif
> diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
> index dab6a1734a22..e6bec522b139 100644
> --- a/include/linux/nsproxy.h
> +++ b/include/linux/nsproxy.h
> @@ -42,17 +42,6 @@ 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.
>
> --
> 2.47.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR