/linux/tools/lib/bpf/ |
A D | btf.h | 23 struct btf; 38 LIBBPF_API void btf__free(struct btf *btf); 129 LIBBPF_API int btf__load(struct btf *btf); 138 LIBBPF_API const struct btf *btf__base_btf(const struct btf *btf); 148 LIBBPF_API int btf__fd(const struct btf *btf); 149 LIBBPF_API void btf__set_fd(struct btf *btf, int fd); 165 int btf_ext__reloc_func_info(const struct btf *btf, 170 int btf_ext__reloc_line_info(const struct btf *btf, 179 LIBBPF_API int btf__add_type(struct btf *btf, const struct btf *src_btf, 202 LIBBPF_API int btf__add_btf(struct btf *btf, const struct btf *src_btf); [all …]
|
A D | btf.c | 780 struct btf *btf; in btf_new_empty() local 831 struct btf *btf; in btf_new() local 862 btf->strs_data = btf->raw_data + btf->hdr->hdr_len + btf->hdr->str_off; in btf_new() 863 btf->types_data = btf->raw_data + btf->hdr->hdr_len + btf->hdr->type_off; in btf_new() 1096 struct btf *btf; in btf_parse() local 1240 struct btf *btf = (struct btf *)btf_ro; in btf__raw_data() local 1280 struct btf *btf; in btf_get_from_fd() local 1331 struct btf *btf; in btf__load_from_kernel_by_id_split() local 3059 struct btf *btf; member 3181 d->btf = btf; in btf_dedup_new() [all …]
|
A D | relo_core.c | 26 const struct btf *btf; member 43 static bool is_flex_arr(const struct btf *btf, in is_flex_arr() argument 54 t = btf__type_by_id(btf, acc->type_id); in is_flex_arr() 153 static int bpf_core_parse_spec(const struct btf *btf, in bpf_core_parse_spec() argument 170 spec->btf = btf; in bpf_core_parse_spec() 218 sz = btf__resolve_size(btf, id); in bpf_core_parse_spec() 270 sz = btf__resolve_size(btf, id); in bpf_core_parse_spec() 303 const struct btf *targ_btf, in bpf_core_fields_are_compat() 373 const struct btf *targ_btf, in bpf_core_match_member() 457 targ_spec->btf = targ_btf; in bpf_core_spec_match() [all …]
|
A D | linker.c | 58 struct btf *btf; member 147 struct btf *btf; member 921 struct btf *btf = ctx; in check_btf_type_id() local 931 struct btf *btf = ctx; in check_btf_str_off() local 947 if (!obj->btf) in linker_sanity_check_btf() 971 if (!obj->btf) in linker_sanity_check_btf_ext() 1636 linker->btf, glob_sym->btf_id, obj->btf, btf_id)) in glob_syms_match() 2130 if (!obj->btf) in linker_fixup_btf() 2234 if (!obj->btf) in linker_append_btf() 2283 id = btf__add_type(linker->btf, obj->btf, t); in linker_append_btf() [all …]
|
A D | btf_dump.c | 79 const struct btf *btf; member 148 struct btf_dump *btf_dump__new(const struct btf *btf, in btf_dump__new() argument 160 d->btf = btf; in btf_dump__new() 265 if (id >= btf__type_cnt(d->btf)) in btf_dump__dump_type() 302 t = btf__type_by_id(d->btf, i); in btf_dump_mark_referenced() 473 t = btf__type_by_id(d->btf, id); in btf_dump_order_type() 675 t = btf__type_by_id(d->btf, id); in btf_dump_emit_type() 811 static bool btf_is_struct_packed(const struct btf *btf, __u32 id, in btf_is_struct_packed() argument 818 align = btf__align_of(btf, id); in btf_is_struct_packed() 1441 t = btf__type_by_id(d->btf, id); in btf_dump_emit_type_cast() [all …]
|
A D | relo_core.h | 79 const struct btf *btf; member 94 const struct btf *local_btf, 96 int bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id, 97 const struct btf *targ_btf, __u32 targ_id);
|
/linux/tools/testing/selftests/bpf/prog_tests/ |
A D | btf_dump.c | 27 static int btf_dump_all_types(const struct btf *btf, in btf_dump_all_types() argument 53 struct btf *btf = NULL; in test_btf_dump_case() local 61 err = -PTR_ERR(btf); in test_btf_dump_case() 62 btf = NULL; in test_btf_dump_case() 128 btf__free(btf); in test_btf_dump_case() 138 struct btf *btf = NULL; in test_btf_dump_incremental() local 232 btf__free(btf); in test_btf_dump_incremental() 246 static int btf_dump_data(struct btf *btf, struct btf_dump *d, in btf_dump_data() argument 817 struct btf *btf = btf__parse("xdping_kern.o", NULL); in test_btf_dump_datasec_data() local 838 struct btf *btf; in test_btf_dump() local [all …]
|
A D | btf_write.c | 7 static void gen_btf(struct btf *btf) in gen_btf() argument 29 t = btf__type_by_id(btf, 1); in gen_btf() 54 id = btf__add_ptr(btf, 1); in gen_btf() 56 t = btf__type_by_id(btf, 2); in gen_btf() 64 t = btf__type_by_id(btf, 3); in gen_btf() 72 t = btf__type_by_id(btf, 4); in gen_btf() 304 struct btf *btf; in test_btf_add() local 306 btf = btf__new_empty(); in test_btf_add() 310 gen_btf(btf); in test_btf_add() 313 btf, in test_btf_add() [all …]
|
A D | btf_endian.c | 18 struct btf *btf = NULL, *swap_btf = NULL; in test_btf_endian() local 26 btf = btf__parse_elf("btf_dump_test_case_syntax.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 D | core_autosize.c | 60 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 D | resolve_btfids.c | 66 __resolve_symbol(struct btf *btf, int type_id) in BTF_ID_LIST_GLOBAL() 72 type = btf__type_by_id(btf, type_id); in BTF_ID_LIST_GLOBAL() 85 str = btf__name_by_offset(btf, type->name_off); in BTF_ID_LIST_GLOBAL() 100 struct btf *btf; in resolve_symbols() local 104 btf = btf__parse_elf("btf_data.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()
|
/linux/include/linux/ |
A D | btf.h | 15 struct btf; 23 void btf_get(struct btf *btf); 24 void btf_put(struct btf *btf); 27 int btf_get_info_by_fd(const struct btf *btf, 51 const struct btf_type *btf_type_id_size(const struct btf *btf, 94 u32 btf_obj_id(const struct btf *btf); 95 bool btf_is_kernel(const struct btf *btf); 96 bool btf_is_module(const struct btf *btf); 97 struct module *btf_try_get_module(const struct btf *btf); 98 u32 btf_nr_types(const struct btf *btf); [all …]
|
/linux/kernel/bpf/ |
A D | btf.c | 1315 struct btf *btf = env->btf; in __btf_verifier_log_type() local 1359 struct btf *btf = env->btf; in btf_verifier_log_member() local 1452 struct btf *btf = env->btf; in btf_add_type() local 1562 struct btf *btf = env->btf; in env_resolve_init() local 1678 struct btf *btf = env->btf; in env_stack_pop_resolved() local 2276 struct btf *btf = env->btf; in btf_modifier_check_member() local 2301 struct btf *btf = env->btf; in btf_modifier_check_kflag_member() local 2390 struct btf *btf = env->btf; in btf_modifier_resolve() local 2432 struct btf *btf = env->btf; in btf_var_resolve() local 2478 struct btf *btf = env->btf; in btf_ptr_resolve() local [all …]
|
/linux/tools/bpf/bpftool/ |
A D | btf_dumper.c | 27 static int btf_dump_func(const struct btf *btf, char *func_sig, 39 struct btf *prog_btf = NULL; in dump_prog_id_as_func_ptr() 167 btf__name_by_offset(d->btf, in btf_dumper_enum() 177 static bool is_str_array(const struct btf *btf, const struct btf_array *arr, in is_str_array() argument 583 static int __btf_dumper_type_only(const struct btf *btf, __u32 type_id, in __btf_dumper_type_only() argument 596 t = btf__type_by_id(btf, type_id); in __btf_dumper_type_only() 673 static int btf_dump_func(const struct btf *btf, char *func_sig, in btf_dump_func() argument 710 void btf_dumper_type_only(const struct btf *btf, __u32 type_id, char *func_sig, in btf_dumper_type_only() argument 716 if (!btf) in btf_dumper_type_only() 732 void btf_dump_linfo_plain(const struct btf *btf, in btf_dump_linfo_plain() argument [all …]
|
A D | btf.c | 93 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 105 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument 370 static int dump_btf_raw(const struct btf *btf, in dump_btf_raw() argument 388 const struct btf *base; in dump_btf_raw() 415 static int dump_btf_c(const struct btf *btf, in dump_btf_c() argument 461 struct btf *btf = NULL, *base = NULL; in do_dump() local 550 if (IS_ERR(btf)) { in do_dump() 551 err = -PTR_ERR(btf); in do_dump() 552 btf = NULL; in do_dump() 590 if (!btf) { in do_dump() [all …]
|
A D | main.h | 93 extern struct btf *base_btf; 118 struct btf; 179 const struct btf *btf, 188 const struct btf *btf, in disasm_print_insn() argument 210 const struct btf *btf; member 225 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id, 228 void btf_dump_linfo_plain(const struct btf *btf, 231 void btf_dump_linfo_json(const struct btf *btf,
|
A D | map.c | 163 unsigned char *value, struct btf *btf) in print_entry_json() argument 172 if (btf) { in print_entry_json() 174 .btf = btf, in print_entry_json() 207 .btf = btf, in print_entry_json() 772 .btf = btf, in dump_map_elem() 809 struct btf *btf = NULL; in get_map_kv_btf() local 832 static void free_map_kv_btf(struct btf *btf) in free_map_kv_btf() argument 834 if (!IS_ERR(btf) && btf != btf_vmlinux) in free_map_kv_btf() 850 struct btf *btf = NULL; in map_dump() local 1054 struct btf *btf; in print_key_value() local [all …]
|
A D | xlated_dumper.c | 223 struct btf *btf = dd->btf; in dump_xlated_json() local 240 if (btf && record) { in dump_xlated_json() 242 btf_dumper_type_only(btf, record->type_id, in dump_xlated_json() 258 btf_dump_linfo_json(btf, linfo, linum); in dump_xlated_json() 308 struct btf *btf = dd->btf; in dump_xlated_plain() local 321 if (btf && record) { in dump_xlated_plain() 323 btf_dumper_type_only(btf, record->type_id, in dump_xlated_plain() 337 btf_dump_linfo_plain(btf, linfo, "; ", in dump_xlated_plain()
|
A D | gen.c | 124 struct btf *btf, in codegen_datasec_def() argument 163 align = btf__align_of(btf, var->type); in codegen_datasec_def() 213 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local 214 int n = btf__type_cnt(btf); in codegen_datasecs() 221 d = btf_dump__new(btf, NULL, NULL, codegen_btf_dump_printf); in codegen_datasecs() 237 const struct btf_type *t = btf__type_by_id(btf, i); in codegen_datasecs() 243 name = btf__str_by_offset(btf, t->name_off); in codegen_datasecs() 264 err = codegen_datasec_def(obj, btf, d, sec, obj_name); in codegen_datasecs() 665 struct btf *btf; in do_skeleton() local 818 btf = bpf_object__btf(obj); in do_skeleton() [all …]
|
/linux/tools/testing/selftests/bpf/ |
A D | btf_helpers.c | 79 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 86 int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id) in fprintf_btf_type_raw() argument 92 t = btf__type_by_id(btf, id); in fprintf_btf_type_raw() 132 btf_str(btf, m->name_off), m->type, bit_off); in fprintf_btf_type_raw() 144 btf_str(btf, v->name_off), v->val); in fprintf_btf_type_raw() 160 btf_str(btf, p->name_off), p->type); in fprintf_btf_type_raw() 195 const char *btf_type_raw_dump(const struct btf *btf, int type_id) in btf_type_raw_dump() argument 206 fprintf_btf_type_raw(buf_file, btf, type_id); in btf_type_raw_dump() 213 int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]) in btf_validate_raw() argument 236 const char *btf_type_c_dump(const struct btf *btf) in btf_type_c_dump() argument [all …]
|
A D | btf_helpers.h | 9 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);
|
/linux/tools/perf/util/ |
A D | bpf-event.c | 27 struct btf *btf; in btf__load_from_kernel_by_id() local 133 struct btf *btf) in perf_env__fetch_btf() argument 159 struct btf *btf, in synthesize_bpf_prog_name() argument 173 if (btf) { in synthesize_bpf_prog_name() 212 struct btf *btf = NULL; in perf_event__synthesize_one_bpf_prog() local 268 if (libbpf_get_error(btf)) { in perf_event__synthesize_one_bpf_prog() 340 btf__free(btf); in perf_event__synthesize_one_bpf_prog() 487 struct btf *btf = NULL; in perf_env__add_bpf_info() local 531 btf__free(btf); in perf_env__add_bpf_info() 588 struct btf *btf = NULL; in bpf_event__print_bpf_prog_info() local [all …]
|
/linux/tools/bpf/bpftool/Documentation/ |
A D | bpftool-btf.rst | 2 bpftool-btf 16 { **-B** | **--base-btf** } } 25 | **bpftool** **btf help** 45 **bpftool btf dump** *BTF_SRC* 70 **bpftool btf help** 77 -B, --base-btf *FILE* 93 **# bpftool btf dump id 1226** 148 **$ bpftool btf dump file prog.o** 226 **# bpftool btf dump map id 123** 237 | **# bpftool btf dump file /sys/kernel/btf/i2c_smbus** [all …]
|
/linux/kernel/bpf/preload/iterators/ |
A D | iterators.bpf.c | 34 struct btf { struct 46 struct btf *btf; argument 59 static const char *get_name(struct btf *btf, long btf_id, const char *fallback) in get_name() argument 65 if (!btf) in get_name() 67 str = btf->strings; in get_name() 68 types = btf->types; in get_name() 71 if (name_off >= btf->hdr.str_len) in get_name() 109 get_name(aux->btf, aux->func_info[0].type_id, aux->name), in dump_bpf_prog()
|
/linux/net/ipv4/ |
A D | bpf_tcp_ca.c | 35 static int bpf_tcp_ca_init(struct btf *btf) in bpf_tcp_ca_init() argument 39 type_id = btf_find_by_name_kind(btf, "sock", BTF_KIND_STRUCT); in bpf_tcp_ca_init() 44 type_id = btf_find_by_name_kind(btf, "tcp_sock", BTF_KIND_STRUCT); in bpf_tcp_ca_init() 48 tcp_sock_type = btf_type_by_id(btf, tcp_sock_id); in bpf_tcp_ca_init() 77 extern struct btf *btf_vmlinux; 95 const struct btf *btf, in bpf_tcp_ca_btf_struct_access() argument 103 return btf_struct_access(log, btf, t, off, size, atype, next_btf_id); in bpf_tcp_ca_btf_struct_access()
|