/kernel/linux/linux-5.10/tools/lib/bpf/ |
D | btf.h | 22 struct btf; 33 LIBBPF_API void btf__free(struct btf *btf); 34 LIBBPF_API struct btf *btf__new(const void *data, __u32 size); 35 LIBBPF_API struct btf *btf__new_empty(void); 36 LIBBPF_API struct btf *btf__parse(const char *path, struct btf_ext **btf_ext); 37 LIBBPF_API struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext); 38 LIBBPF_API struct btf *btf__parse_raw(const char *path); 39 LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf); 40 LIBBPF_API int btf__load(struct btf *btf); 41 LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, [all …]
|
D | btf.c | 30 struct btf { struct 166 static int btf_add_type_idx_entry(struct btf *btf, __u32 type_off) in btf_add_type_idx_entry() argument 170 p = btf_add_mem((void **)&btf->type_offs, &btf->type_offs_cap, sizeof(__u32), in btf_add_type_idx_entry() 171 btf->nr_types + 1, BTF_MAX_NR_TYPES, 1); in btf_add_type_idx_entry() 189 static int btf_parse_hdr(struct btf *btf) in btf_parse_hdr() argument 191 struct btf_header *hdr = btf->hdr; in btf_parse_hdr() 194 if (btf->raw_size < sizeof(struct btf_header)) { in btf_parse_hdr() 200 btf->swapped_endian = true; in btf_parse_hdr() 212 if (btf->raw_size < hdr->hdr_len) { in btf_parse_hdr() 214 hdr->hdr_len, btf->raw_size); in btf_parse_hdr() [all …]
|
D | libbpf.c | 77 skip_mods_and_typedefs(const struct btf *btf, __u32 id, __u32 *res_id); 464 struct btf *btf; member 468 struct btf *btf_vmlinux; 703 find_member_by_name(const struct btf *btf, const struct btf_type *t, in find_member_by_name() argument 710 if (!strcmp(btf__name_by_offset(btf, m->name_off), name)) in find_member_by_name() 718 static int find_btf_by_prefix_kind(const struct btf *btf, const char *prefix, 722 find_struct_ops_kern_types(const struct btf *btf, const char *tname, in find_struct_ops_kern_types() argument 732 kern_type_id = btf__find_by_name_kind(btf, tname, BTF_KIND_STRUCT); in find_struct_ops_kern_types() 738 kern_type = btf__type_by_id(btf, kern_type_id); in find_struct_ops_kern_types() 745 kern_vtype_id = find_btf_by_prefix_kind(btf, STRUCT_OPS_VALUE_PREFIX, in find_struct_ops_kern_types() [all …]
|
D | btf_dump.c | 57 const struct btf *btf; member 106 return btf__name_by_offset(d->btf, name_off); in btf_name_of() 121 struct btf_dump *btf_dump__new(const struct btf *btf, in btf_dump__new() argument 133 d->btf = btf; in btf_dump__new() 137 d->ptr_sz = btf__pointer_size(btf) ? : sizeof(void *); in btf_dump__new() 164 int err, last_id = btf__get_nr_types(d->btf); in btf_dump_resize() 249 if (id > btf__get_nr_types(d->btf)) in btf_dump__dump_type() 281 int i, j, n = btf__get_nr_types(d->btf); in btf_dump_mark_referenced() 286 t = btf__type_by_id(d->btf, i); in btf_dump_mark_referenced() 455 t = btf__type_by_id(d->btf, id); in btf_dump_order_type() [all …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/prog_tests/ |
D | btf_write.c | 14 struct btf *btf; in test_btf_write() local 17 btf = btf__new_empty(); in test_btf_write() 18 if (CHECK(IS_ERR(btf), "new_empty", "failed: %ld\n", PTR_ERR(btf))) in test_btf_write() 21 str_off = btf__find_str(btf, "int"); in test_btf_write() 24 str_off = btf__add_str(btf, "int"); in test_btf_write() 27 str_off = btf__find_str(btf, "int"); in test_btf_write() 31 id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED); in test_btf_write() 34 t = btf__type_by_id(btf, 1); in test_btf_write() 37 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "int", "int_name"); in test_btf_write() 44 id = btf__add_int(btf, "bad sz int", 7, 0); in test_btf_write() [all …]
|
D | btf_dump.c | 27 static int btf_dump_all_types(const struct btf *btf, in btf_dump_all_types() argument 30 size_t type_cnt = btf__get_nr_types(btf); in btf_dump_all_types() 34 d = btf_dump__new(btf, NULL, opts, btf_dump_printf); in btf_dump_all_types() 52 struct btf *btf = NULL; in test_btf_dump_case() local 58 btf = btf__parse_elf(test_file, NULL); in test_btf_dump_case() 59 if (CHECK(IS_ERR(btf), "btf_parse_elf", in test_btf_dump_case() 60 "failed to load test BTF: %ld\n", PTR_ERR(btf))) { in test_btf_dump_case() 61 err = -PTR_ERR(btf); in test_btf_dump_case() 62 btf = NULL; in test_btf_dump_case() 72 btf__set_pointer_size(btf, 8); in test_btf_dump_case() [all …]
|
D | btf_endian.c | 20 struct btf *btf = NULL, *swap_btf = NULL; in test_btf_endian() local 28 btf = btf__parse_elf("btf_dump_test_case_syntax.o", NULL); in test_btf_endian() 29 if (!ASSERT_OK_PTR(btf, "parse_native_btf")) in test_btf_endian() 32 ASSERT_EQ(btf__endianness(btf), endian, "endian"); in test_btf_endian() 33 btf__set_endianness(btf, swap_endian); in test_btf_endian() 34 ASSERT_EQ(btf__endianness(btf), swap_endian, "endian"); in test_btf_endian() 37 raw_data = btf__get_raw_data(btf, &raw_sz); in test_btf_endian() 47 ASSERT_EQ(btf__get_nr_types(swap_btf), btf__get_nr_types(btf), "nr_types"); in test_btf_endian() 73 var_id = btf__add_var(btf, "some_var", BTF_VAR_GLOBAL_ALLOCATED, 1); in test_btf_endian() 79 btf__set_endianness(btf, swap_endian); in test_btf_endian() [all …]
|
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() 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 …]
|
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__get_nr_types(btf); in resolve_symbols() 112 if (__resolve_symbol(btf, type_id)) in resolve_symbols() 116 btf__free(btf); in resolve_symbols()
|
D | ksyms_btf.c | 98 struct btf *btf; in test_ksyms_btf() local 100 btf = libbpf_find_kernel_btf(); in test_ksyms_btf() 101 if (CHECK(IS_ERR(btf), "btf_exists", "failed to load kernel BTF: %ld\n", in test_ksyms_btf() 102 PTR_ERR(btf))) in test_ksyms_btf() 105 percpu_datasec = btf__find_by_name_kind(btf, ".data..percpu", in test_ksyms_btf() 107 btf__free(btf); in test_ksyms_btf()
|
/kernel/linux/linux-5.10/include/linux/ |
D | btf.h | 13 struct btf; 21 void btf_put(struct btf *btf); 23 struct btf *btf_get_by_fd(int fd); 24 int btf_get_info_by_fd(const struct btf *btf, 48 const struct btf_type *btf_type_id_size(const struct btf *btf, 69 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj, 71 int btf_type_seq_show_flags(const struct btf *btf, u32 type_id, void *obj, 87 int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj, 91 u32 btf_id(const struct btf *btf); 92 bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, [all …]
|
/kernel/linux/linux-5.10/kernel/bpf/ |
D | btf.c | 199 struct btf { struct 248 struct btf *btf; member 344 const struct btf *btf; member 383 void (*show)(const struct btf *btf, const struct btf_type *t, 453 s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind) in btf_find_by_name_kind() argument 459 for (i = 1; i <= btf->nr_types; i++) { in btf_find_by_name_kind() 460 t = btf->types[i]; in btf_find_by_name_kind() 464 tname = btf_name_by_offset(btf, t->name_off); in btf_find_by_name_kind() 472 const struct btf_type *btf_type_skip_modifiers(const struct btf *btf, in btf_type_skip_modifiers() argument 475 const struct btf_type *t = btf_type_by_id(btf, id); in btf_type_skip_modifiers() [all …]
|
D | bpf_struct_ops.c | 99 void bpf_struct_ops_init(struct btf *btf, struct bpf_verifier_log *log) in bpf_struct_ops_init() argument 114 module_id = btf_find_by_name_kind(btf, "module", BTF_KIND_STRUCT); in bpf_struct_ops_init() 119 module_type = btf_type_by_id(btf, module_id); in bpf_struct_ops_init() 132 value_id = btf_find_by_name_kind(btf, value_name, in bpf_struct_ops_init() 140 type_id = btf_find_by_name_kind(btf, st_ops->name, in bpf_struct_ops_init() 147 t = btf_type_by_id(btf, type_id); in bpf_struct_ops_init() 157 mname = btf_name_by_offset(btf, member->name_off); in bpf_struct_ops_init() 170 func_proto = btf_type_resolve_func_ptr(btf, in bpf_struct_ops_init() 174 btf_distill_func_proto(log, btf, in bpf_struct_ops_init() 184 if (st_ops->init(btf)) { in bpf_struct_ops_init() [all …]
|
/kernel/linux/linux-5.10/tools/bpf/bpftool/ |
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() 45 func_sig_len = btf_dump_func(d->btf, prog_str, func_proto, NULL, 0, in dump_prog_id_as_func_ptr() 108 ptr_type_id = btf__resolve_type(d->btf, t->type); in btf_dumper_ptr() 111 ptr_type = btf__type_by_id(d->btf, ptr_type_id); in btf_dumper_ptr() 130 actual_type_id = btf__resolve_type(d->btf, type_id); in btf_dumper_modifier() 165 btf__name_by_offset(d->btf, in btf_dumper_enum() 175 static bool is_str_array(const struct btf *btf, const struct btf_array *arr, in is_str_array() argument 184 elem_type = btf__type_by_id(btf, arr->type); in is_str_array() 189 elem_type = btf__type_by_id(btf, elem_type->type); in is_str_array() [all …]
|
D | btf.c | 93 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 97 return btf__name_by_offset(btf, off) ? : "(invalid)"; in btf_str() 100 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument 113 jsonw_string_field(w, "name", btf_str(btf, t->name_off)); in dump_btf_type() 116 btf_str(btf, t->name_off)); in dump_btf_type() 176 const char *name = btf_str(btf, m->name_off); in dump_btf_type() 222 const char *name = btf_str(btf, v->name_off); in dump_btf_type() 272 const char *name = btf_str(btf, p->name_off); in dump_btf_type() 342 static int dump_btf_raw(const struct btf *btf, in dump_btf_raw() argument 356 t = btf__type_by_id(btf, root_type_ids[i]); in dump_btf_raw() [all …]
|
D | main.h | 136 struct btf; 197 const struct btf *btf, 206 const struct btf *btf, in disasm_print_insn() argument 228 const struct btf *btf; member 243 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id, 246 void btf_dump_linfo_plain(const struct btf *btf, 249 void btf_dump_linfo_json(const struct btf *btf,
|
D | gen.c | 95 struct btf *btf, in codegen_datasec_def() argument 100 const char *sec_name = btf__name_by_offset(btf, sec->name_off); in codegen_datasec_def() 122 const struct btf_type *var = btf__type_by_id(btf, sec_var->type); in codegen_datasec_def() 123 const char *var_name = btf__name_by_offset(btf, var->name_off); in codegen_datasec_def() 138 align = btf__align_of(btf, var->type); in codegen_datasec_def() 188 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local 189 int n = btf__get_nr_types(btf); in codegen_datasecs() 193 d = btf_dump__new(btf, NULL, NULL, codegen_btf_dump_printf); in codegen_datasecs() 198 const struct btf_type *t = btf__type_by_id(btf, i); in codegen_datasecs() 203 err = codegen_datasec_def(obj, btf, d, t, obj_name); in codegen_datasecs() [all …]
|
D | map.c | 159 unsigned char *value, struct btf *btf) in print_entry_json() argument 168 if (btf) { in print_entry_json() 170 .btf = btf, in print_entry_json() 201 if (btf) { in print_entry_json() 203 .btf = btf, in print_entry_json() 748 struct bpf_map_info *map_info, struct btf *btf, in dump_map_elem() argument 757 print_entry_json(map_info, key, value, btf); in dump_map_elem() 758 } else if (btf) { in dump_map_elem() 760 .btf = btf, in dump_map_elem() 793 static struct btf *btf_vmlinux; [all …]
|
D | xlated_dumper.c | 217 struct btf *btf = dd->btf; in dump_xlated_json() local 234 if (btf && record) { in dump_xlated_json() 236 btf_dumper_type_only(btf, record->type_id, in dump_xlated_json() 252 btf_dump_linfo_json(btf, linfo, linum); in dump_xlated_json() 302 struct btf *btf = dd->btf; in dump_xlated_plain() local 315 if (btf && record) { in dump_xlated_plain() 317 btf_dumper_type_only(btf, record->type_id, in dump_xlated_plain() 331 btf_dump_linfo_plain(btf, linfo, "; ", in dump_xlated_plain()
|
D | struct_ops.c | 21 static struct btf *btf_vmlinux; 29 static const struct btf *get_btf_vmlinux(void) in get_btf_vmlinux() 43 const struct btf *kern_btf; in get_kern_struct_ops_name() 60 const struct btf *kern_btf; in get_map_info_type_id() 357 const struct btf *kern_btf = d->btf; in __do_dump() 364 kern_btf = d->btf; in __do_dump() 405 const struct btf *kern_btf; in do_dump() 430 d.btf = kern_btf; in do_dump()
|
/kernel/linux/linux-5.10/kernel/bpf/preload/iterators/ |
D | iterators.bpf.c | 35 struct btf { struct 47 struct btf *btf; argument 60 static const char *get_name(struct btf *btf, long btf_id, const char *fallback) in get_name() argument 66 if (!btf) in get_name() 68 str = btf->strings; in get_name() 69 types = btf->types; in get_name() 72 if (name_off >= btf->hdr.str_len) in get_name() 110 get_name(aux->btf, aux->func_info[0].type_id, aux->name), in dump_bpf_prog()
|
/kernel/linux/linux-5.10/tools/perf/util/ |
D | bpf-event.c | 96 struct btf *btf) in perf_env__fetch_btf() argument 102 data = btf__get_raw_data(btf, &data_size); in perf_env__fetch_btf() 122 struct btf *btf, in synthesize_bpf_prog_name() argument 136 if (btf) { in synthesize_bpf_prog_name() 138 t = btf__type_by_id(btf, finfo->type_id); in synthesize_bpf_prog_name() 139 short_name = btf__name_by_offset(btf, t->name_off); in synthesize_bpf_prog_name() 175 struct btf *btf = NULL; in perf_event__synthesize_one_bpf_prog() local 223 if (btf__get_from_id(info->btf_id, &btf)) { in perf_event__synthesize_one_bpf_prog() 226 btf = NULL; in perf_event__synthesize_one_bpf_prog() 229 perf_env__fetch_btf(env, info->btf_id, btf); in perf_event__synthesize_one_bpf_prog() [all …]
|
/kernel/linux/linux-5.10/tools/bpf/bpftool/Documentation/ |
D | bpftool-btf.rst | 2 bpftool-btf 13 **bpftool** [*OPTIONS*] **btf** *COMMAND* 22 | **bpftool** **btf** { **show** | **list** } [**id** *BTF_ID*] 23 | **bpftool** **btf dump** *BTF_SRC* [**format** *FORMAT*] 24 | **bpftool** **btf help** 33 **bpftool btf { show | list }** [**id** *BTF_ID*] 44 **bpftool btf dump** *BTF_SRC* 69 **bpftool btf help** 78 **# bpftool btf dump id 1226** 133 **$ bpftool btf dump file prog.o** [all …]
|
/kernel/linux/linux-5.10/net/ipv4/ |
D | bpf_tcp_ca.c | 31 static int bpf_tcp_ca_init(struct btf *btf) in bpf_tcp_ca_init() argument 35 type_id = btf_find_by_name_kind(btf, "sock", BTF_KIND_STRUCT); in bpf_tcp_ca_init() 40 type_id = btf_find_by_name_kind(btf, "tcp_sock", BTF_KIND_STRUCT); in bpf_tcp_ca_init() 44 tcp_sock_type = btf_type_by_id(btf, tcp_sock_id); in bpf_tcp_ca_init() 73 extern struct btf *btf_vmlinux;
|
/kernel/linux/linux-5.10/Documentation/ABI/testing/ |
D | sysfs-kernel-btf | 1 What: /sys/kernel/btf 9 What: /sys/kernel/btf/vmlinux 16 Documentation/bpf/btf.rst for detailed description of format
|