[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYvZ3Z=AHUVVV=Z2ne4QwRF86e7W_ZfmL1qwbEA6UWY9Q@mail.gmail.com>
Date: Tue, 28 Apr 2020 22:38:43 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next v1 01/19] net: refactor net assignment for
seq_net_private structure
On Mon, Apr 27, 2020 at 1:13 PM Yonghong Song <yhs@...com> wrote:
>
> Refactor assignment of "net" in seq_net_private structure
> in proc_net.c to a helper function. The helper later will
> be used by bpfdump.
typo: bpfdump -> bpf_iter ?
Otherwise:
Acked-by: Andrii Nakryiko <andriin@...com>
>
> Signed-off-by: Yonghong Song <yhs@...com>
> ---
> fs/proc/proc_net.c | 5 ++---
> include/linux/seq_file_net.h | 8 ++++++++
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
> index 4888c5224442..aee07c19cf8b 100644
> --- a/fs/proc/proc_net.c
> +++ b/fs/proc/proc_net.c
> @@ -75,9 +75,8 @@ static int seq_open_net(struct inode *inode, struct file *file)
> put_net(net);
> return -ENOMEM;
> }
> -#ifdef CONFIG_NET_NS
> - p->net = net;
> -#endif
> +
> + set_seq_net_private(p, net);
> return 0;
> }
>
> diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
> index 0fdbe1ddd8d1..0ec4a18b9aca 100644
> --- a/include/linux/seq_file_net.h
> +++ b/include/linux/seq_file_net.h
> @@ -35,4 +35,12 @@ static inline struct net *seq_file_single_net(struct seq_file *seq)
> #endif
> }
>
> +static inline void set_seq_net_private(struct seq_net_private *p,
> + struct net *net)
> +{
> +#ifdef CONFIG_NET_NS
> + p->net = net;
> +#endif
> +}
> +
> #endif
> --
> 2.24.1
>
Powered by blists - more mailing lists