summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/btf_helpers.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2021-11-11 17:26:25 -0800
committerAlexei Starovoitov <ast@kernel.org>2021-11-11 17:41:11 -0800
commit0dc85872203bf7b15c56c7eb228b8f3fabb17ac2 (patch)
tree75db0fc12541d122df710b791c704925ed29736a /tools/testing/selftests/bpf/btf_helpers.c
parent3da5ba6f0509ace03cad38b554c89797129e90be (diff)
downloadlinux-0dc85872203bf7b15c56c7eb228b8f3fabb17ac2.tar.bz2
selftests/bpf: Test libbpf API function btf__add_type_tag()
Add unit tests for btf__add_type_tag(). Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211112012625.1505748-1-yhs@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/btf_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/btf_helpers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/btf_helpers.c b/tools/testing/selftests/bpf/btf_helpers.c
index acb59202486d..b5941d514e17 100644
--- a/tools/testing/selftests/bpf/btf_helpers.c
+++ b/tools/testing/selftests/bpf/btf_helpers.c
@@ -25,11 +25,12 @@ static const char * const btf_kind_str_mapping[] = {
[BTF_KIND_DATASEC] = "DATASEC",
[BTF_KIND_FLOAT] = "FLOAT",
[BTF_KIND_DECL_TAG] = "DECL_TAG",
+ [BTF_KIND_TYPE_TAG] = "TYPE_TAG",
};
static const char *btf_kind_str(__u16 kind)
{
- if (kind > BTF_KIND_DECL_TAG)
+ if (kind > BTF_KIND_TYPE_TAG)
return "UNKNOWN";
return btf_kind_str_mapping[kind];
}
@@ -109,6 +110,7 @@ int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id)
case BTF_KIND_VOLATILE:
case BTF_KIND_RESTRICT:
case BTF_KIND_TYPEDEF:
+ case BTF_KIND_TYPE_TAG:
fprintf(out, " type_id=%u", t->type);
break;
case BTF_KIND_ARRAY: {