aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/btf.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r--tools/lib/bpf/btf.h43
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index b0610dcdae6b..b393da90cc85 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -55,33 +55,44 @@ struct btf_ext_header {
55 __u32 line_info_len; 55 __u32 line_info_len;
56}; 56};
57 57
58typedef int (*btf_print_fn_t)(const char *, ...)
59 __attribute__((format(printf, 1, 2)));
60
61LIBBPF_API void btf__free(struct btf *btf); 58LIBBPF_API void btf__free(struct btf *btf);
62LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log); 59LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size);
63LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, 60LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
64 const char *type_name); 61 const char *type_name);
62LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
65LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf, 63LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
66 __u32 id); 64 __u32 id);
67LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id); 65LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
68LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id); 66LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
69LIBBPF_API int btf__fd(const struct btf *btf); 67LIBBPF_API int btf__fd(const struct btf *btf);
68LIBBPF_API void btf__get_strings(const struct btf *btf, const char **strings,
69 __u32 *str_len);
70LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset); 70LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
71LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf); 71LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
72LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
73 __u32 expected_key_size,
74 __u32 expected_value_size,
75 __u32 *key_type_id, __u32 *value_type_id);
76
77LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size);
78LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext);
79LIBBPF_API int btf_ext__reloc_func_info(const struct btf *btf,
80 const struct btf_ext *btf_ext,
81 const char *sec_name, __u32 insns_cnt,
82 void **func_info, __u32 *cnt);
83LIBBPF_API int btf_ext__reloc_line_info(const struct btf *btf,
84 const struct btf_ext *btf_ext,
85 const char *sec_name, __u32 insns_cnt,
86 void **line_info, __u32 *cnt);
87LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
88LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);
89
90struct btf_dedup_opts {
91 bool dont_resolve_fwds;
92};
72 93
73struct btf_ext *btf_ext__new(__u8 *data, __u32 size, btf_print_fn_t err_log); 94LIBBPF_API int btf__dedup(struct btf *btf, struct btf_ext *btf_ext,
74void btf_ext__free(struct btf_ext *btf_ext); 95 const struct btf_dedup_opts *opts);
75int btf_ext__reloc_func_info(const struct btf *btf,
76 const struct btf_ext *btf_ext,
77 const char *sec_name, __u32 insns_cnt,
78 void **func_info, __u32 *func_info_len);
79int btf_ext__reloc_line_info(const struct btf *btf,
80 const struct btf_ext *btf_ext,
81 const char *sec_name, __u32 insns_cnt,
82 void **line_info, __u32 *cnt);
83__u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
84__u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);
85 96
86#ifdef __cplusplus 97#ifdef __cplusplus
87} /* extern "C" */ 98} /* extern "C" */