aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/btf.h
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2022-06-06 23:26:26 -0700
committerAlexei Starovoitov <ast@kernel.org>2022-06-07 10:20:43 -0700
commit2ef2026349cf388b25601a094e99542ed536fde3 (patch)
tree3b9005564ea361de1d958980598ba6f3e70a9af9 /tools/lib/bpf/btf.h
parentlibbpf: Add enum64 parsing and new enum64 public API (diff)
downloadlinux-2ef2026349cf388b25601a094e99542ed536fde3.tar.xz
linux-2ef2026349cf388b25601a094e99542ed536fde3.zip
libbpf: Add enum64 deduplication support
Add enum64 deduplication support. BTF_KIND_ENUM64 handling is very similar to BTF_KIND_ENUM. Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20220607062626.3720166-1-yhs@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r--tools/lib/bpf/btf.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index a41463bf9060..c7e8b1fdfe24 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_is_any_enum(const struct btf_type *t)
+{
+ 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));