Re: [PATCH bpf-next v3 06/18] libbpf: Add enum64 deduplication support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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.


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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux