Home
last modified time | relevance | path

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

1234567

/linux/tools/testing/selftests/bpf/prog_tests/
H A Dlinked_list.c250 static struct btf *init_btf(void) in init_btf()
253 struct btf *btf; in init_btf() local
255 btf = btf__new_empty(); in init_btf()
256 if (!ASSERT_OK_PTR(btf, "btf__new_empty")) in init_btf()
258 id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED); in init_btf()
261 lid = btf__add_struct(btf, "bpf_spin_lock", 4); in init_btf()
264 hid = btf__add_struct(btf, "bpf_list_head", 16); in init_btf()
267 nid = btf__add_struct(btf, "bpf_list_node", 24); in init_btf()
270 return btf; in init_btf()
272 btf__free(btf); in init_btf()
[all …]
H A Dbtf_write.c7 static void gen_btf(struct btf *btf) in gen_btf() argument
17 str_off = btf__find_str(btf, "int"); in gen_btf()
20 str_off = btf__add_str(btf, "int"); in gen_btf()
23 str_off = btf__find_str(btf, "int"); in gen_btf()
27 id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED); in gen_btf()
30 t = btf__type_by_id(btf, 1); in gen_btf()
33 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "int", "int_name"); in gen_btf()
38 ASSERT_STREQ(btf_type_raw_dump(btf, 1), in gen_btf()
42 id = btf__add_int(btf, "bad sz int", 7, 0); in gen_btf()
45 id = btf__add_int(btf, "bad enc int", 4, 123); in gen_btf()
[all …]
H A Dbtf_dump.c3 #include <bpf/btf.h>
26 static int btf_dump_all_types(const struct btf *btf, void *ctx) in btf_dump_all_types() argument
28 size_t type_cnt = btf__type_cnt(btf); in btf_dump_all_types()
32 d = btf_dump__new(btf, btf_dump_printf, ctx, NULL); in btf_dump_all_types()
51 struct btf *btf = NULL; in test_btf_dump_case() local
57 btf = btf__parse_elf(test_file, NULL); in test_btf_dump_case()
58 if (!ASSERT_OK_PTR(btf, "btf_parse_elf")) { in test_btf_dump_case()
59 err = -PTR_ERR(btf); in test_btf_dump_case()
130 struct btf *btf; global() member
184 struct btf *btf; test_btf_dump_incremental() local
285 struct btf *btf; test_btf_dump_type_tags() local
339 btf_dump_data(struct btf * btf,struct btf_dump * d,char * name,char * prefix,__u64 flags,void * ptr,size_t ptr_sz,char * str,const char * expected_val) btf_dump_data() argument
420 test_btf_dump_int_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_int_data() argument
478 test_btf_dump_float_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_float_data() argument
523 test_btf_dump_char_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_char_data() argument
545 test_btf_dump_typedef_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_typedef_data() argument
600 test_btf_dump_enum_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_enum_data() argument
636 test_btf_dump_struct_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_struct_data() argument
871 test_btf_dump_var_data(struct btf * btf,struct btf_dump * d,char * str) test_btf_dump_var_data() argument
883 struct btf *btf; global() member
998 test_btf_datasec(struct btf * btf,struct btf_dump * d,char * str,const char * name,const char * expected_val,void * data,size_t data_sz) test_btf_datasec() argument
1026 struct btf *btf; test_btf_dump_datasec_data() local
1049 struct btf *btf; test_btf_dump() local
[all...]
H 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()
50 btf__add_int(btf, "int", 4, BTF_INT_SIGNED); /* [1] int */ in test_btf_field_iter()
51 btf__add_int(btf, "int64", 8, BTF_INT_SIGNED); /* [2] int64 */ in test_btf_field_iter()
52 btf__add_ptr(btf, 1); /* [3] int * */ in test_btf_field_iter()
53 btf__add_array(btf, 1, 2, 3); /* [4] int64[3] */ in test_btf_field_iter()
54 btf__add_struct(btf, "s1", 12); /* [5] struct s1 { */ in test_btf_field_iter()
55 btf__add_field(btf, "f1", 3, 0, 0); /* int *f1; */ in test_btf_field_iter()
56 btf__add_field(btf, "f2", 1, 0, 0); /* int f2; */ in test_btf_field_iter()
[all …]
H A Dlibbpf_str.c23 struct btf *btf; in test_libbpf_bpf_attach_type_str() local
28 btf = btf__parse("/sys/kernel/btf/vmlinux", NULL); in test_libbpf_bpf_attach_type_str()
29 if (!ASSERT_OK_PTR(btf, "btf_parse")) in test_libbpf_bpf_attach_type_str()
33 id = btf__find_by_name_kind(btf, "bpf_attach_type", BTF_KIND_ENUM); in test_libbpf_bpf_attach_type_str()
36 t = btf__type_by_id(btf, id); in test_libbpf_bpf_attach_type_str()
48 attach_type_name = btf__str_by_offset(btf, e->name_off); 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
73 btf = btf__parse("/sys/kernel/btf/vmlinux", NULL); in test_libbpf_bpf_link_type_str()
74 if (!ASSERT_OK_PTR(btf, "btf_parse")) in test_libbpf_bpf_link_type_str()
[all …]
H 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 …]
H 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()
27 const char *prog_type_name = btf__str_by_offset(btf, e->name_off); 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()
[all …]
H 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()
71 var_id = btf__add_var(btf, "some_var", BTF_VAR_GLOBAL_ALLOCATED, 1); in test_btf_endian()
77 btf__set_endianness(btf, swap_endian); in test_btf_endian()
[all …]
H 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()
94 long_long_id = btf__add_int(btf, "unsigned long long", 8, 0); in test_core_autosize()
96 void_ptr_id = btf__add_ptr(btf, 0); in test_core_autosize()
99 id = btf__add_struct(btf, "test_struct", 20 /* bytes */); in test_core_autosize()
[all …]
H 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()
339 btf__add_struct(btf, "s", 8); /* [2] struct s { */ in btf_add_dup_struct_in_cu()
340 btf__add_field(btf, "a", ID(3), 0, 0); /* struct anon a; */ in btf_add_dup_struct_in_cu()
341 btf__add_field(btf, "b", ID(4), 0, 0); /* struct anon b; */ in btf_add_dup_struct_in_cu()
344 btf__add_struct(btf, "(anon)", 8); /* [3] struct anon { */ in btf_add_dup_struct_in_cu()
[all …]
H A Dresolve_btfids.c5 #include <bpf/btf.h>
7 #include <linux/btf.h>
66 __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_raw("resolve_btfids.test.o.BTF"); in resolve_symbols()
105 if (CHECK(libbpf_get_error(btf), "resolv in resolve_symbols()
[all...]
H A Dctx_rewrite.c252 static int find_field_offset_aux(struct btf *btf, int btf_id, char *field_name, int off) in find_field_offset_aux() argument
254 const struct btf_type *type = btf__type_by_id(btf, btf_id); in find_field_offset_aux()
273 const char *mname = btf__name_by_offset(btf, m->name_off); in find_field_offset_aux()
276 int msize = find_field_offset_aux(btf, m->type, field_name, in find_field_offset_aux()
291 static int find_field_offset(struct btf *btf, char *pattern, regmatch_t *matches) in find_field_offset() argument
315 btf_id = btf__find_by_name(btf, type_str); in find_field_offset()
321 field_offset = find_field_offset_aux(btf, btf_id, field_str, 0); in find_field_offset()
492 static bool match_pattern(struct btf *btf, char *pattern, char *text, char *reg_map[][2]) in match_pattern() argument
563 field_offset = find_field_offset(btf, pattern, matches); in match_pattern()
589 field_offset = find_field_offset(btf, pattern, matches); in match_pattern()
[all …]
/linux/tools/lib/bpf/
H A Dbtf.h10 #include <linux/btf.h>
24 struct btf;
37 * @param btf BTF object to free
39 LIBBPF_API void btf__free(struct btf *btf);
55 LIBBPF_API struct btf *btf__new(const void *data, __u32 size);
77 LIBBPF_API struct btf *btf__new_split(const void *data, __u32 size, struct btf *base_btf);
91 LIBBPF_API struct btf *btf__new_empty(void);
110 LIBBPF_API struct btf *btf__new_empty_spli
[all...]
H A Dbtf.c18 #include <linux/btf.h>
20 #include "btf.h"
32 struct btf { struct
100 struct btf *base_btf;
201 static void *btf_add_type_offs_mem(struct btf *btf, size_t add_cnt) in btf_add_type_offs_mem()
203 return libbpf_add_mem((void **)&btf->type_offs, &btf->type_offs_cap, sizeof(__u32), in btf_add_type_offs_mem()
204 btf->nr_types, BTF_MAX_NR_TYPES, add_cnt);
207 static int btf_add_type_idx_entry(struct btf *bt in btf_add_type_idx_entry()
34 raw_databtf global() argument
36 raw_data_swappedbtf global() argument
37 raw_sizebtf global() argument
61 swapped_endianbtf global() argument
78 hdrbtf global() argument
98 base_btfbtf global() argument
120 strs_dedupedbtf global() argument
121 owns_basebtf global() argument
124 raw_data_is_mmapbtf global() argument
127 fdbtf global() argument
130 ptr_szbtf global() argument
199 btf_add_type_offs_mem(struct btf * btf,size_t add_cnt) btf_add_type_offs_mem() argument
205 btf_add_type_idx_entry(struct btf * btf,__u32 type_off) btf_add_type_idx_entry() argument
227 btf_parse_hdr(struct btf * btf) btf_parse_hdr() argument
276 btf_parse_str_sec(struct btf * btf) btf_parse_str_sec() argument
420 btf_parse_type_sec(struct btf * btf) btf_parse_type_sec() argument
458 btf_validate_str(const struct btf * btf,__u32 str_off,const char * what,__u32 type_id) btf_validate_str() argument
471 btf_validate_id(const struct btf * btf,__u32 id,__u32 ctx_id) btf_validate_id() argument
484 btf_validate_type(const struct btf * btf,const struct btf_type * t,__u32 id) btf_validate_type() argument
602 btf_sanity_check(const struct btf * btf) btf_sanity_check() argument
617 btf__type_cnt(const struct btf * btf) btf__type_cnt() argument
622 btf__base_btf(const struct btf * btf) btf__base_btf() argument
628 btf_type_by_id(const struct btf * btf,__u32 type_id) btf_type_by_id() argument
637 btf__type_by_id(const struct btf * btf,__u32 type_id) btf__type_by_id() argument
644 determine_ptr_size(const struct btf * btf) determine_ptr_size() argument
688 btf_ptr_sz(const struct btf * btf) btf_ptr_sz() argument
703 btf__pointer_size(const struct btf * btf) btf__pointer_size() argument
718 btf__set_pointer_size(struct btf * btf,size_t ptr_sz) btf__set_pointer_size() argument
737 btf__endianness(const struct btf * btf) btf__endianness() argument
745 btf__set_endianness(struct btf * btf,enum btf_endianness endian) btf__set_endianness() argument
770 btf__resolve_size(const struct btf * btf,__u32 type_id) btf__resolve_size() argument
825 btf__align_of(const struct btf * btf,__u32 id) btf__align_of() argument
880 btf__resolve_type(const struct btf * btf,__u32 type_id) btf__resolve_type() argument
900 btf__find_by_name(const struct btf * btf,const char * type_name) btf__find_by_name() argument
918 btf_find_by_name_kind(const struct btf * btf,int start_id,const char * type_name,__u32 kind) btf_find_by_name_kind() argument
940 btf__find_by_name_kind_own(const struct btf * btf,const char * type_name,__u32 kind) btf__find_by_name_kind_own() argument
946 btf__find_by_name_kind(const struct btf * btf,const char * type_name,__u32 kind) btf__find_by_name_kind() argument
952 btf_is_modifiable(const struct btf * btf) btf_is_modifiable() argument
957 btf_free_raw_data(struct btf * btf) btf_free_raw_data() argument
968 btf__free(struct btf * btf) btf__free() argument
997 struct btf *btf; btf_new_empty() local
1049 struct btf *btf; btf_new() local
1197 struct btf *btf = NULL; btf_parse_elf() local
1306 struct btf *btf = NULL; btf_parse_raw() local
1381 struct btf *btf; btf_parse_raw_mmap() local
1410 struct btf *btf; btf_parse() local
1437 btf_load_into_kernel(struct btf * btf,char * log_buf,size_t log_sz,__u32 log_level,int token_fd) btf_load_into_kernel() argument
1518 btf__load_into_kernel(struct btf * btf) btf__load_into_kernel() argument
1523 btf__fd(const struct btf * btf) btf__fd() argument
1528 btf__set_fd(struct btf * btf,int fd) btf__set_fd() argument
1533 btf_strs_data(const struct btf * btf) btf_strs_data() argument
1538 btf_get_raw_data(const struct btf * btf,__u32 * size,bool swap_endian) btf_get_raw_data() argument
1590 struct btf *btf = (struct btf *)btf_ro; btf__raw_data() local
1610 btf__str_by_offset(const struct btf * btf,__u32 offset) btf__str_by_offset() argument
1620 btf__name_by_offset(const struct btf * btf,__u32 offset) btf__name_by_offset() argument
1630 struct btf *btf; btf_get_from_fd() local
1681 struct btf *btf; btf_load_from_kernel() local
1710 btf_invalidate_raw_data(struct btf * btf) btf_invalidate_raw_data() argument
1724 btf_ensure_modifiable(struct btf * btf) btf_ensure_modifiable() argument
1784 btf__find_str(struct btf * btf,const char * s) btf__find_str() argument
1810 btf__add_str(struct btf * btf,const char * s) btf__add_str() argument
1832 btf_add_type_mem(struct btf * btf,size_t add_sz) btf_add_type_mem() argument
1843 btf_commit_type(struct btf * btf,int data_sz) btf_commit_type() argument
1928 btf__add_type(struct btf * btf,const struct btf * src_btf,const struct btf_type * src_type) btf__add_type() argument
1938 btf__add_btf(struct btf * btf,const struct btf * src_btf) btf__add_btf() argument
2066 btf__add_int(struct btf * btf,const char * name,size_t byte_sz,int encoding) btf__add_int() argument
2114 btf__add_float(struct btf * btf,const char * name,size_t byte_sz) btf__add_float() argument
2159 btf_add_ref_kind(struct btf * btf,int kind,const char * name,int ref_type_id,int kflag) btf_add_ref_kind() argument
2195 btf__add_ptr(struct btf * btf,int ref_type_id) btf__add_ptr() argument
2209 btf__add_array(struct btf * btf,int index_type_id,int elem_type_id,__u32 nr_elems) btf__add_array() argument
2239 btf_add_composite(struct btf * btf,int kind,const char * name,__u32 bytes_sz) btf_add_composite() argument
2280 btf__add_struct(struct btf * btf,const char * name,__u32 byte_sz) btf__add_struct() argument
2298 btf__add_union(struct btf * btf,const char * name,__u32 byte_sz) btf__add_union() argument
2303 btf_last_type(struct btf * btf) btf_last_type() argument
2318 btf__add_field(struct btf * btf,const char * name,int type_id,__u32 bit_offset,__u32 bit_size) btf__add_field() argument
2373 btf_add_enum_common(struct btf * btf,const char * name,__u32 byte_sz,bool is_signed,__u8 kind) btf_add_enum_common() argument
2418 btf__add_enum(struct btf * btf,const char * name,__u32 byte_sz) btf__add_enum() argument
2435 btf__add_enum_value(struct btf * btf,const char * name,__s64 value) btf__add_enum_value() argument
2497 btf__add_enum64(struct btf * btf,const char * name,__u32 byte_sz,bool is_signed) btf__add_enum64() argument
2512 btf__add_enum64_value(struct btf * btf,const char * name,__u64 value) btf__add_enum64_value() argument
2564 btf__add_fwd(struct btf * btf,const char * name,enum btf_fwd_kind fwd_kind) btf__add_fwd() argument
2600 btf__add_typedef(struct btf * btf,const char * name,int ref_type_id) btf__add_typedef() argument
2615 btf__add_volatile(struct btf * btf,int ref_type_id) btf__add_volatile() argument
2627 btf__add_const(struct btf * btf,int ref_type_id) btf__add_const() argument
2639 btf__add_restrict(struct btf * btf,int ref_type_id) btf__add_restrict() argument
2652 btf__add_type_tag(struct btf * btf,const char * value,int ref_type_id) btf__add_type_tag() argument
2669 btf__add_type_attr(struct btf * btf,const char * value,int ref_type_id) btf__add_type_attr() argument
2685 btf__add_func(struct btf * btf,const char * name,enum btf_func_linkage linkage,int proto_type_id) btf__add_func() argument
2717 btf__add_func_proto(struct btf * btf,int ret_type_id) btf__add_func_proto() argument
2751 btf__add_func_param(struct btf * btf,const char * name,int type_id) btf__add_func_param() argument
2804 btf__add_var(struct btf * btf,const char * name,int linkage,int type_id) btf__add_var() argument
2854 btf__add_datasec(struct btf * btf,const char * name,__u32 byte_sz) btf__add_datasec() argument
2893 btf__add_datasec_var_info(struct btf * btf,int var_type_id,__u32 offset,__u32 byte_sz) btf__add_datasec_var_info() argument
2931 btf_add_decl_tag(struct btf * btf,const char * value,int ref_type_id,int component_idx,int kflag) btf_add_decl_tag() argument
2973 btf__add_decl_tag(struct btf * btf,const char * value,int ref_type_id,int component_idx) btf__add_decl_tag() argument
2990 btf__add_decl_attr(struct btf * btf,const char * value,int ref_type_id,int component_idx) btf__add_decl_attr() argument
3554 btf__dedup(struct btf * btf,const struct btf_dedup_opts * opts) btf__dedup() argument
3624 struct btf *btf; global() member
3730 btf_dedup_new(struct btf * btf,const struct btf_dedup_opts * opts) btf_dedup_new() argument
5414 struct btf *btf; btf__load_vmlinux_btf() local
5851 btf_header(const struct btf * btf) btf_header() argument
5856 btf_set_base_btf(struct btf * btf,const struct btf * base_btf) btf_set_base_btf() argument
5863 btf__relocate(struct btf * btf,const struct btf * base_btf) btf__relocate() argument
[all...]
H 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,
H A Drelo_core.c22 skip_mods_and_typedefs(const struct btf *btf, u32 id, u32 *res_id) in skip_mods_and_typedefs() argument
24 return btf_type_skip_modifiers(btf, id, res_id); in skip_mods_and_typedefs()
27 static const char *btf__name_by_offset(const struct btf *btf, u32 offset) in btf__name_by_offset() argument
29 return btf_name_by_offset(btf, offset); in btf__name_by_offset()
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()
70 static bool is_flex_arr(const struct btf *btf, in is_flex_arr() argument
81 t = btf_type_by_id(btf, acc->type_id); in is_flex_arr()
145 int __bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id, in __bpf_core_types_are_compat()
[all …]
/linux/kernel/bpf/
H A Dbtf.c254 struct btf { struct
275 struct btf *base_btf; argument
316 struct btf *btf; member
422 const struct btf *btf; member
461 void (*show)(const struct btf *btf, const struct btf_type *t,
499 static int btf_start_id(const struct btf *btf) in btf_start_id() argument
501 return btf->start_id + (btf->base_btf ? 0 : 1); in btf_start_id()
537 bool btf_is_vmlinux(const struct btf *btf) in btf_is_vmlinux() argument
539 return btf->kernel_btf && !btf->base_btf; in btf_is_vmlinux()
542 u32 btf_nr_types(const struct btf *btf) in btf_nr_types() argument
[all …]
H A Dbpf_struct_ops.c43 struct btf *btf; member
87 extern struct btf *btf_vmlinux;
89 static bool is_valid_value_type(struct btf *btf, s32 value_id, in is_valid_value_type() argument
97 vt = btf_type_by_id(btf, value_id); in is_valid_value_type()
104 mt = btf_type_by_id(btf, member->type); in is_valid_value_type()
113 mt = btf_type_by_id(btf, member->type); in is_valid_value_type()
116 value_name, btf_name_by_offset(btf, type->name_off)); in is_valid_value_type()
171 static int prepare_arg_info(struct btf *btf, in prepare_arg_info() argument
196 stub_func_id = btf_find_by_name_kind(btf, stub_fname, BTF_KIND_FUNC); in prepare_arg_info()
202 stub_func_proto = btf_type_by_id(btf, stub_func_id); in prepare_arg_info()
[all …]
/linux/tools/bpf/bpftool/
H A Dbtf.c107 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument
111 return btf__name_by_offset(btf, off) ? : "(invalid)"; in btf_str()
119 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument
129 jsonw_string_field(w, "name", btf_str(btf, t->name_off)); in dump_btf_type()
132 btf_str(btf, t->name_off)); in dump_btf_type()
193 const char *name = btf_str(btf, m->name_off); in dump_btf_type()
242 const char *name = btf_str(btf, v->name_off); in dump_btf_type()
280 const char *name = btf_str(btf, v->name_off); in dump_btf_type()
339 const char *name = btf_str(btf, p->name_off); in dump_btf_type()
393 if (v->type < btf__type_cnt(btf)) { in dump_btf_type()
[all …]
H 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()
47 func_sig_len = btf_dump_func(d->btf, prog_str, func_proto, NULL, 0, in dump_prog_id_as_func_ptr()
118 ptr_type_id = btf__resolve_type(d->btf, t->type); in btf_dumper_ptr()
121 ptr_type = btf__type_by_id(d->btf, ptr_type_id); in btf_dumper_ptr()
140 actual_type_id = btf__resolve_type(d->btf, type_id); in btf_dumper_modifier()
175 btf__name_by_offset(d->btf, in btf_dumper_enum()
201 btf__name_by_offset(d->btf, in btf_dumper_enum64()
211 static bool is_str_array(const struct btf *btf, const struct btf_array *arr, in is_str_array() argument
220 elem_type = btf__type_by_id(btf, arr->type); in is_str_array()
[all …]
H A Dgen.c22 #include <bpf/btf.h>
59 resolve_func_ptr(const struct btf *btf, __u32 id, __u32 *res_id) in resolve_func_ptr() argument
63 t = skip_mods_and_typedefs(btf, id, NULL); in resolve_func_ptr()
67 t = skip_mods_and_typedefs(btf, t->type, res_id); in resolve_func_ptr()
148 struct btf *btf, in codegen_datasec_def() argument
153 const char *sec_name = btf__name_by_offset(btf, sec->name_off); in codegen_datasec_def()
167 const struct btf_type *var = btf__type_by_id(btf, sec_var->type); in codegen_datasec_def()
168 const char *var_name = btf__name_by_offset(btf, va in codegen_datasec_def()
235 find_type_for_map(struct btf * btf,const char * map_ident) find_type_for_map() argument
277 struct btf *btf = bpf_object__btf(obj); codegen_datasecs() local
318 btf_is_ptr_to_func_proto(const struct btf * btf,const struct btf_type * v) btf_is_ptr_to_func_proto() argument
326 struct btf *btf = bpf_object__btf(obj); codegen_subskel_datasecs() local
499 struct btf *btf = bpf_object__btf(obj); codegen_asserts() local
1015 walk_st_ops_shadow_vars(struct btf * btf,const char * ident,const struct btf_type * map_type,__u32 map_type_id) walk_st_ops_shadow_vars() argument
1130 gen_st_ops_shadow_type(const char * obj_name,struct btf * btf,const char * ident,const struct bpf_map * map) gen_st_ops_shadow_type() argument
1158 gen_st_ops_shadow(const char * obj_name,struct btf * btf,struct bpf_object * obj) gen_st_ops_shadow() argument
1192 gen_st_ops_shadow_init(struct btf * btf,struct bpf_object * obj) gen_st_ops_shadow_init() argument
1229 struct btf *btf; do_skeleton() local
1642 struct btf *btf; do_subskeleton() local
2000 btf_save_raw(const struct btf * btf,const char * path) btf_save_raw() argument
2167 struct btf *btf = info->src_btf; btfgen_record_field_relo() local
2230 struct btf *btf = info->src_btf; btfgen_mark_type_match() local
2413 struct btf *btf = NULL; btfgen_record_obj() local
[all...]
/linux/tools/bpf/resolve_btfids/
H A Dmain.c127 struct btf *btf; member
128 struct btf *base_btf;
165 struct btf *btf; member
583 struct btf *base_btf = NULL, *btf = NULL; in load_btf() local
596 btf = btf__parse_split(obj->btf_path ?: obj->path, base_btf); in load_btf()
597 err = libbpf_get_error(btf); in load_btf()
605 obj->btf = btf; in load_btf()
611 btf__free(btf); in load_btf()
613 obj->btf = NULL; in load_btf()
623 struct btf *btf = obj->btf; in symbols_resolve() local
[all …]
/linux/tools/testing/selftests/bpf/
H 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);
H A Dbtf_helpers.c81 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument
85 return btf__str_by_offset(btf, off) ?: "(invalid)"; in btf_str()
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()
101 fprintf(out, "[%u] %s '%s'", id, btf_kind_str(kind), btf_str(btf, t->name_off)); in fprintf_btf_type_raw()
135 btf_str(btf, m->name_off), m->type, bit_off); 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
[all …]
/linux/tools/perf/util/
H A Dbpf-event.c106 struct btf *btf) in perf_env__fetch_btf() argument
112 data = btf__raw_data(btf, &data_size); in perf_env__fetch_btf()
132 struct btf *btf, in synthesize_bpf_prog_name() argument
146 if (btf) { in synthesize_bpf_prog_name()
148 t = btf__type_by_id(btf, finfo->type_id); in synthesize_bpf_prog_name()
149 short_name = btf__name_by_offset(btf, t->name_off); in synthesize_bpf_prog_name()
176 struct btf *btf; member
189 struct btf *btf; in bpf_metadata_read_map_data() local
213 btf = btf__load_from_kernel_by_id(map_info.btf_id); in bpf_metadata_read_map_data()
214 if (!btf) in bpf_metadata_read_map_data()
[all …]

1234567