Home
last modified time | relevance | path

Searched refs:btf (Results 1 – 25 of 102) sorted by relevance

12345

/tools/lib/bpf/
A Dbtf.h24 struct btf;
39 LIBBPF_API void btf__free(struct btf *btf);
145 LIBBPF_API int btf__load_into_kernel(struct btf *btf);
150 LIBBPF_API __u32 btf__type_cnt(const struct btf *btf);
151 LIBBPF_API const struct btf *btf__base_btf(const struct btf *btf);
161 LIBBPF_API int btf__fd(const struct btf *btf);
162 LIBBPF_API void btf__set_fd(struct btf *btf, int fd);
176 LIBBPF_API int btf__add_type(struct btf *btf, const struct btf *src_btf,
199 LIBBPF_API int btf__add_btf(struct btf *btf, const struct btf *src_btf);
204 LIBBPF_API int btf__add_array(struct btf *btf,
[all …]
A Dbtf.c998 struct btf *btf; in btf_new_empty() local
1050 struct btf *btf; in btf_new() local
1087 btf->strs_data = btf->raw_data + btf->hdr->hdr_len + btf->hdr->str_off; in btf_new()
1382 struct btf *btf; in btf_parse_raw_mmap() local
1411 struct btf *btf; in btf_parse() local
1591 struct btf *btf = (struct btf *)btf_ro; in btf__raw_data() local
1631 struct btf *btf; in btf_get_from_fd() local
1682 struct btf *btf; in btf_load_from_kernel() local
3625 struct btf *btf; member
3743 d->btf = btf; in btf_dedup_new()
[all …]
A Drelo_core.h10 const struct btf *btf; member
30 const struct btf *btf; member
71 int __bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id,
72 const struct btf *targ_btf, __u32 targ_id, int level);
73 int bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id,
74 const struct btf *targ_btf, __u32 targ_id);
75 int __bpf_core_types_match(const struct btf *local_btf, __u32 local_id, const struct btf *targ_btf,
77 int bpf_core_types_match(const struct btf *local_btf, __u32 local_id, const struct btf *targ_btf,
84 const struct btf *local_btf,
93 int bpf_core_parse_spec(const char *prog_name, const struct btf *btf,
A Drelo_core.c22 skip_mods_and_typedefs(const struct btf *btf, u32 id, u32 *res_id) in skip_mods_and_typedefs() argument
27 static const char *btf__name_by_offset(const struct btf *btf, u32 offset) in btf__name_by_offset() argument
32 static s64 btf__resolve_size(const struct btf *btf, u32 type_id) in btf__resolve_size() argument
37 t = btf_type_by_id(btf, type_id); in btf__resolve_size()
38 t = btf_resolve_size(btf, t, &size); in btf__resolve_size()
71 static bool is_flex_arr(const struct btf *btf, in is_flex_arr() argument
263 int bpf_core_parse_spec(const char *prog_name, const struct btf *btf, in bpf_core_parse_spec() argument
279 spec->btf = btf; in bpf_core_parse_spec()
329 sz = btf__resolve_size(btf, id); in bpf_core_parse_spec()
483 const struct btf *targ_btf, in bpf_core_match_member()
[all …]
/tools/testing/selftests/bpf/prog_tests/
A Dlinked_list.c253 struct btf *btf; in init_btf() local
270 return btf; in init_btf()
272 btf__free(btf); in init_btf()
279 struct btf *btf; in list_and_rb_node_same_struct() local
326 btf__free(btf); in list_and_rb_node_same_struct()
331 struct btf *btf = NULL; in test_btf() local
353 btf__free(btf); in test_btf()
379 btf__free(btf); in test_btf()
405 btf__free(btf); in test_btf()
425 btf__free(btf); in test_btf()
[all …]
A Dbtf_field_iter.c43 struct btf *btf = NULL; in test_btf_field_iter() local
46 btf = btf__new_empty(); in test_btf_field_iter()
47 if (!ASSERT_OK_PTR(btf, "empty_btf")) in test_btf_field_iter()
52 btf__add_ptr(btf, 1); /* [3] int * */ in test_btf_field_iter()
73 btf__add_func_param(btf, "p1", 1); in test_btf_field_iter()
74 btf__add_func_param(btf, "p2", 3); in test_btf_field_iter()
88 btf__add_datasec_var_info(btf, 15, 0, 4); in test_btf_field_iter()
89 btf__add_datasec_var_info(btf, 16, 4, 8); in test_btf_field_iter()
92 btf, in test_btf_field_iter()
128 for (id = 1; id < btf__type_cnt(btf); id++) { in test_btf_field_iter()
[all …]
A Dbtf_write.c7 static void gen_btf(struct btf *btf) in gen_btf() argument
30 t = btf__type_by_id(btf, 1); in gen_btf()
55 id = btf__add_ptr(btf, 1); in gen_btf()
57 t = btf__type_by_id(btf, 2); in gen_btf()
65 t = btf__type_by_id(btf, 3); in gen_btf()
73 t = btf__type_by_id(btf, 4); in gen_btf()
357 struct btf *btf; in test_btf_add() local
359 btf = btf__new_empty(); in test_btf_add()
363 gen_btf(btf); in test_btf_add()
366 btf, in test_btf_add()
[all …]
A Dbtf_dump.c51 struct btf *btf = NULL; in test_btf_dump_case() local
60 btf = NULL; in test_btf_dump_case()
130 struct btf *btf; member
184 struct btf *btf; in test_btf_dump_incremental() local
190 btf = t.btf; in test_btf_dump_incremental()
285 struct btf *btf; in test_btf_dump_type_tags() local
291 btf = t.btf; in test_btf_dump_type_tags()
883 struct btf *btf; member
986 ctx.btf = t.btf; in test_btf_dump_string_data()
1026 struct btf *btf; in test_btf_dump_datasec_data() local
[all …]
A Dlibbpf_str.c23 struct btf *btf; in test_libbpf_bpf_attach_type_str() local
36 t = btf__type_by_id(btf, id); in test_libbpf_bpf_attach_type_str()
59 btf__free(btf); in test_libbpf_bpf_attach_type_str()
68 struct btf *btf; in test_libbpf_bpf_link_type_str() local
81 t = btf__type_by_id(btf, id); in test_libbpf_bpf_link_type_str()
104 btf__free(btf); in test_libbpf_bpf_link_type_str()
113 struct btf *btf; in test_libbpf_bpf_map_type_str() local
126 t = btf__type_by_id(btf, id); in test_libbpf_bpf_map_type_str()
161 btf__free(btf); in test_libbpf_bpf_map_type_str()
170 struct btf *btf; in test_libbpf_bpf_prog_type_str() local
[all …]
A Dbtf_endian.c18 struct btf *btf = NULL, *swap_btf = NULL; in test_btf_endian() local
26 btf = btf__parse_elf("btf_dump_test_case_syntax.bpf.o", NULL); in test_btf_endian()
27 if (!ASSERT_OK_PTR(btf, "parse_native_btf")) in test_btf_endian()
30 ASSERT_EQ(btf__endianness(btf), endian, "endian"); in test_btf_endian()
31 btf__set_endianness(btf, swap_endian); in test_btf_endian()
32 ASSERT_EQ(btf__endianness(btf), swap_endian, "endian"); in test_btf_endian()
35 raw_data = btf__raw_data(btf, &raw_sz); in test_btf_endian()
45 ASSERT_EQ(btf__type_cnt(swap_btf), btf__type_cnt(btf), "nr_types"); in test_btf_endian()
77 btf__set_endianness(btf, swap_endian); in test_btf_endian()
78 raw_data = btf__raw_data(btf, &raw_sz); in test_btf_endian()
[all …]
A Dlibbpf_probes.c9 struct btf *btf; in test_libbpf_probe_prog_types() local
14 btf = btf__parse("/sys/kernel/btf/vmlinux", NULL); in test_libbpf_probe_prog_types()
15 if (!ASSERT_OK_PTR(btf, "btf_parse")) in test_libbpf_probe_prog_types()
19 id = btf__find_by_name_kind(btf, "bpf_prog_type", BTF_KIND_ENUM); in test_libbpf_probe_prog_types()
22 t = btf__type_by_id(btf, id); in test_libbpf_probe_prog_types()
44 btf__free(btf); in test_libbpf_probe_prog_types()
49 struct btf *btf; in test_libbpf_probe_map_types() local
54 btf = btf__parse("/sys/kernel/btf/vmlinux", NULL); in test_libbpf_probe_map_types()
55 if (!ASSERT_OK_PTR(btf, "btf_parse")) in test_libbpf_probe_map_types()
62 t = btf__type_by_id(btf, id); in test_libbpf_probe_map_types()
[all …]
A Dtest_global_funcs.c26 static void check_ctx_arg_type(const struct btf *btf, const struct btf_param *p) in check_ctx_arg_type() argument
31 t = btf__type_by_id(btf, p->type); in check_ctx_arg_type()
35 s = btf_type_raw_dump(btf, t->type); in check_ctx_arg_type()
47 struct btf *btf = NULL; in subtest_ctx_arg_rewrite() local
50 struct btf *kern_btf = NULL; in subtest_ctx_arg_rewrite()
87 btf = btf__load_from_kernel_by_id(info.btf_id); in subtest_ctx_arg_rewrite()
88 if (!ASSERT_OK_PTR(btf, "obj_kern_btf")) in subtest_ctx_arg_rewrite()
99 fn_t = btf__type_by_id(btf, rec->type_id); in subtest_ctx_arg_rewrite()
104 proto_t = btf__type_by_id(btf, fn_t->type); in subtest_ctx_arg_rewrite()
108 name = btf__name_by_offset(btf, fn_t->name_off); in subtest_ctx_arg_rewrite()
[all …]
A Dcore_autosize.c60 struct btf *btf = NULL; in test_core_autosize() local
66 btf = btf__new_empty(); in test_core_autosize()
67 if (!ASSERT_OK_PTR(btf, "empty_btf")) in test_core_autosize()
85 btf__set_pointer_size(btf, 4); in test_core_autosize()
87 char_id = btf__add_int(btf, "unsigned char", 1, 0); in test_core_autosize()
89 short_id = btf__add_int(btf, "unsigned short", 2, 0); in test_core_autosize()
92 int_id = btf__add_int(btf, "long unsigned int", 4, 0); in test_core_autosize()
96 void_ptr_id = btf__add_ptr(btf, 0); in test_core_autosize()
101 err = btf__add_field(btf, "ptr", void_ptr_id, 0, 0); in test_core_autosize()
115 raw_data = btf__raw_data(btf, &raw_sz); in test_core_autosize()
[all …]
A Dresolve_btfids.c66 __resolve_symbol(struct btf *btf, int type_id) in BTF_ID()
72 type = btf__type_by_id(btf, type_id); in BTF_ID()
85 str = btf__name_by_offset(btf, type->name_off); in BTF_ID()
100 struct btf *btf; in resolve_symbols() local
104 btf = btf__parse_elf("btf_data.bpf.o", NULL); in resolve_symbols()
105 if (CHECK(libbpf_get_error(btf), "resolve", in resolve_symbols()
109 nr = btf__type_cnt(btf); in resolve_symbols()
112 if (__resolve_symbol(btf, type_id)) in resolve_symbols()
116 btf__free(btf); in resolve_symbols()
A Dbtf_dedup_split.c9 struct btf *btf1, *btf2; in test_split_simple()
127 struct btf *btf1, *btf2; in test_split_fwd_resolve()
225 struct btf *btf1, *btf2; in test_split_struct_duped()
332 static void btf_add_dup_struct_in_cu(struct btf *btf, int start_id) in btf_add_dup_struct_in_cu() argument
335 btf__set_pointer_size(btf, 8); /* enforce 64-bit arch */ in btf_add_dup_struct_in_cu()
337 btf__add_int(btf, "int", 4, BTF_INT_SIGNED); /* [1] int */ in btf_add_dup_struct_in_cu()
345 btf__add_field(btf, "f1", ID(1), 0, 0); /* int f1; */ in btf_add_dup_struct_in_cu()
346 btf__add_field(btf, "f2", ID(1), 32, 0); /* int f2; */ in btf_add_dup_struct_in_cu()
350 btf__add_field(btf, "f1", ID(1), 0, 0); /* int f1; */ in btf_add_dup_struct_in_cu()
358 struct btf *btf1, *btf2 = NULL; in test_split_dup_struct_in_cu()
[all …]
A Dtest_bpf_ma.c16 struct btf *btf; in do_bpf_ma_test() local
24 btf = bpf_object__btf(skel->obj); in do_bpf_ma_test()
25 if (!ASSERT_OK_PTR(btf, "btf")) in do_bpf_ma_test()
30 id = btf__find_by_name_kind(btf, tname, BTF_KIND_STRUCT); in do_bpf_ma_test()
38 id = btf__find_by_name_kind(btf, tname, BTF_KIND_STRUCT); in do_bpf_ma_test()
/tools/testing/selftests/bpf/
A Dbtf_helpers.h9 int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id);
10 const char *btf_type_raw_dump(const struct btf *btf, int type_id);
11 int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]);
13 #define VALIDATE_RAW_BTF(btf, raw_types...) \ argument
14 btf_validate_raw(btf, \
18 const char *btf_type_c_dump(const struct btf *btf);
A Dbtf_helpers.c81 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument
88 int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id) in fprintf_btf_type_raw() argument
94 t = btf__type_by_id(btf, id); in fprintf_btf_type_raw()
150 btf_str(btf, v->name_off), v->val); in fprintf_btf_type_raw()
164 btf_str(btf, v->name_off), in fprintf_btf_type_raw()
181 btf_str(btf, p->name_off), p->type); in fprintf_btf_type_raw()
216 const char *btf_type_raw_dump(const struct btf *btf, int type_id) in btf_type_raw_dump() argument
227 fprintf_btf_type_raw(buf_file, btf, type_id); in btf_type_raw_dump()
234 int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]) in btf_validate_raw() argument
257 const char *btf_type_c_dump(const struct btf *btf) in btf_type_c_dump() argument
[all …]
/tools/bpf/bpftool/
A Dbtf_dumper.c27 static int btf_dump_func(const struct btf *btf, char *func_sig,
40 struct btf *prog_btf = NULL; in dump_prog_id_as_func_ptr()
175 btf__name_by_offset(d->btf, in btf_dumper_enum()
211 static bool is_str_array(const struct btf *btf, const struct btf_array *arr, in is_str_array() argument
619 static int __btf_dumper_type_only(const struct btf *btf, __u32 type_id, in __btf_dumper_type_only() argument
710 static int btf_dump_func(const struct btf *btf, char *func_sig, in btf_dump_func() argument
747 void btf_dumper_type_only(const struct btf *btf, __u32 type_id, char *func_sig, in btf_dumper_type_only() argument
753 if (!btf) in btf_dumper_type_only()
769 void btf_dump_linfo_plain(const struct btf *btf, in btf_dump_linfo_plain() argument
801 void btf_dump_linfo_json(const struct btf *btf, in btf_dump_linfo_json() argument
[all …]
A Dbtf.c107 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument
119 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument
435 static int dump_btf_raw(const struct btf *btf, in dump_btf_raw() argument
504 struct btf *btf = ctx; in cmp_kfuncs() local
745 static struct sort_datum *sort_btf_c(const struct btf *btf) in sort_btf_c() argument
771 static int dump_btf_c(const struct btf *btf, in dump_btf_c() argument
884 struct btf *btf = NULL, *base = NULL; in do_dump() local
968 if (!btf) { in do_dump()
1042 if (!btf) { in do_dump()
1050 if (!btf) { in do_dump()
[all …]
A Dgen.c148 struct btf *btf, in codegen_datasec_def() argument
277 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local
326 struct btf *btf = bpf_object__btf(obj); in codegen_subskel_datasecs() local
499 struct btf *btf = bpf_object__btf(obj); in codegen_asserts() local
506 if (!btf) in codegen_asserts()
1112 if (!btf) in gen_st_ops_shadow()
1177 struct btf *btf; in do_skeleton() local
1582 struct btf *btf; in do_subskeleton() local
2107 struct btf *btf = info->src_btf; in btfgen_record_field_relo() local
2170 struct btf *btf = info->src_btf; in btfgen_mark_type_match() local
[all …]
A Dmain.h86 extern struct btf *base_btf;
113 struct btf;
182 const struct btf *btf,
191 const struct btf *btf, in disasm_print_insn() argument
213 const struct btf *btf; member
228 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id,
231 void btf_dump_linfo_plain(const struct btf *btf,
234 void btf_dump_linfo_json(const struct btf *btf,
236 void btf_dump_linfo_dotlabel(const struct btf *btf,
/tools/perf/tests/
A Dsigtrap.c61 static struct btf *btf; variable
65 if (btf == NULL) in btf__available()
66 btf = btf__load_vmlinux_btf(); in btf__available()
68 return btf != NULL; in btf__available()
73 btf__free(btf); in btf__exit()
74 btf = NULL; in btf__exit()
90 return __btf_type__find_member_by_name(btf, id, "sigtrap") != NULL; in attr_has_sigtrap()
103 id = btf__find_by_name_kind(btf, "spinlock", BTF_KIND_STRUCT); in kernel_with_sleepable_spinlocks()
108 member = __btf_type__find_member_by_name(btf, id, "lock"); in kernel_with_sleepable_spinlocks()
113 type = btf__type_by_id(btf, member->type); in kernel_with_sleepable_spinlocks()
[all …]
/tools/perf/util/
A Dbpf-event.c106 struct btf *btf) in perf_env__fetch_btf() argument
132 struct btf *btf, in synthesize_bpf_prog_name() argument
146 if (btf) { in synthesize_bpf_prog_name()
176 struct btf *btf; member
189 struct btf *btf; in bpf_metadata_read_map_data() local
214 if (!btf) in bpf_metadata_read_map_data()
247 map->btf = btf; in bpf_metadata_read_map_data()
255 btf__free(btf); in bpf_metadata_read_map_data()
542 struct btf *btf = NULL; in perf_event__synthesize_one_bpf_prog() local
834 struct btf *btf = NULL; in perf_env__add_bpf_info() local
[all …]
A Dbtf.c12 const struct btf_member *__btf_type__find_member_by_name(struct btf *btf, in __btf_type__find_member_by_name() argument
15 const struct btf_type *t = btf__type_by_id(btf, type_id); in __btf_type__find_member_by_name()
20 const char *current_member_name = btf__name_by_offset(btf, m->name_off); in __btf_type__find_member_by_name()

Completed in 68 milliseconds

12345