Re: [PATCH bpf-next v1] bpf,arena: Rename the kfunc set variable

From: Alexei Starovoitov
Date: Tue May 07 2024 - 16:42:25 EST


On Tue, May 7, 2024 at 9:43 AM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Tue, May 7, 2024 at 7:36 AM Alexei Starovoitov
> <alexei.starovoitov@xxxxxxxxx> wrote:
> >
> > On Mon, May 6, 2024 at 7:46 PM Haiyue Wang <haiyue.wang@xxxxxxxxx> wrote:
> > >
> > > Rename the kfunc set variable to specify the 'arena' function scope,
> > > although the 'UNSPEC' type BPF program is mapped to 'COMMON' hook.
> > >
> > > And there is 'common_kfunc_set' defined for real 'common' function in
> > > file 'kernel/bpf/helpers.c'.
> >
> > I think common_kfunc_set is a better name to describe that these
> > two kfuncs are in a common category.
> > BPF_PROG_TYPE_UNSPEC is a lot less obvious.
> >
> > There are two static common_kfunc_set in helpers.c and arena.c
> > and that's fine.
>
> it is actually confusing when reading/grepping code, though, so why

What's the confusion? Same name static var in different files?
There are tons of such cases in the kernel src tree.

> not have arena_common_kfunc_set and whatever the meaningful
> "qualifier" name for the other one?

arena_common_kfunc_set is certainly better than arena_kfunc_set,
but I don't like to make the precedent to start renaming static vars
because they have the same name.

> >
> > pw-bot: cr