On Wed, Jun 1, 2022 at 11:31 AM Yonghong Song <yhs@xxxxxx> wrote: > > > > On 5/31/22 4:50 PM, Andrii Nakryiko wrote: > > On Thu, May 26, 2022 at 11:55 AM Yonghong Song <yhs@xxxxxx> wrote: > >> > >> Add enum64 deduplication support. BTF_KIND_ENUM64 handling > >> is very similar to BTF_KIND_ENUM. > >> > >> Signed-off-by: Yonghong Song <yhs@xxxxxx> > >> --- > >> tools/lib/bpf/btf.c | 62 +++++++++++++++++++++++++++++++++++++++++++-- > >> tools/lib/bpf/btf.h | 5 ++++ > >> 2 files changed, 65 insertions(+), 2 deletions(-) > >> > > > > [...] > > > >> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h > >> index a41463bf9060..b22c648c69ff 100644 > >> --- a/tools/lib/bpf/btf.h > >> +++ b/tools/lib/bpf/btf.h > >> @@ -531,6 +531,11 @@ static inline bool btf_is_type_tag(const struct btf_type *t) > >> return btf_kind(t) == BTF_KIND_TYPE_TAG; > >> } > >> > >> +static inline bool btf_type_is_any_enum(const struct btf_type *t) > > > > btf_is_any_enum() for consistency with all other helpers? > > I am using btf_type_is_any_enum() since btf_type_is_* is the kernel > code convention and btf_type_is_any_enum() is used in relo_core.c > which is used by both kernel and libbpf. > > But I can change to btf_is_any_enum(). It should be okay. > Right, but all the btf_is_*() APIs are part of public libbpf API, so we should prioritize keeping that consistent. When Alexei was adding CO-RE logic from libbpf to kernel we had few more such naming mismatches. I don't remember if he added #define or just a small static wrapper, but we can do the same for kernel side. So yeah, please do rename, thanks! > > > > The rest looks great! > > > >> +{ > >> + return btf_is_enum(t) || btf_is_enum64(t); > >> +} > >> + > >> static inline __u8 btf_int_encoding(const struct btf_type *t) > >> { > >> return BTF_INT_ENCODING(*(__u32 *)(t + 1)); > >> -- > >> 2.30.2 > >>