[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJvW7hto4E740Hi9b22wszYLxVwUCDS5jMdQ_2E3==GRQ@mail.gmail.com>
Date: Tue, 21 Jul 2020 12:17:36 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: YangYuxi <yx.atom1@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ebpf: fix parameter naming confusing
On Thu, Jul 16, 2020 at 7:08 PM YangYuxi <yx.atom1@...il.com> wrote:
>
> Signed-off-by: YangYuxi <yx.atom1@...il.com>
> ---
> kernel/bpf/syscall.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 0fd80ac81f70..300ae16baffc 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1881,13 +1881,13 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
> EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
>
> bool bpf_prog_get_ok(struct bpf_prog *prog,
> - enum bpf_prog_type *attach_type, bool attach_drv)
> + enum bpf_prog_type *prog_type, bool attach_drv)
> {
> /* not an attachment, just a refcount inc, always allow */
> - if (!attach_type)
> + if (!prog_type)
> return true;
I think it makes it worse.
Now the comment doesn't match the code.
And attach_drv name also looks out of place.
Technically program type is also an attach type to some degree.
The name could be a bit confusing, but in combination with type:
'enum bpf_prog_type *attach_type'
I think it's pretty clear what these functions are doing.
So I prefer to keep the code as-is.
Powered by blists - more mailing lists