xref: /openbmc/linux/tools/lib/bpf/btf.h (revision f220d3eb)
1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /* Copyright (c) 2018 Facebook */
3 
4 #ifndef __BPF_BTF_H
5 #define __BPF_BTF_H
6 
7 #include <linux/types.h>
8 
9 #define BTF_ELF_SEC ".BTF"
10 
11 struct btf;
12 struct btf_type;
13 
14 typedef int (*btf_print_fn_t)(const char *, ...)
15 	__attribute__((format(printf, 1, 2)));
16 
17 void btf__free(struct btf *btf);
18 struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
19 __s32 btf__find_by_name(const struct btf *btf, const char *type_name);
20 const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id);
21 __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
22 int btf__resolve_type(const struct btf *btf, __u32 type_id);
23 int btf__fd(const struct btf *btf);
24 const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
25 
26 #endif
27