/Linux-v5.15/tools/lib/bpf/ |
D | btf.h | 22 struct btf; 33 LIBBPF_API void btf__free(struct btf *btf); 35 LIBBPF_API struct btf *btf__new(const void *data, __u32 size); 36 LIBBPF_API struct btf *btf__new_split(const void *data, __u32 size, struct btf *base_btf); 37 LIBBPF_API struct btf *btf__new_empty(void); 38 LIBBPF_API struct btf *btf__new_empty_split(struct btf *base_btf); 40 LIBBPF_API struct btf *btf__parse(const char *path, struct btf_ext **btf_ext); 41 LIBBPF_API struct btf *btf__parse_split(const char *path, struct btf *base_btf); 42 LIBBPF_API struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext); 43 LIBBPF_API struct btf *btf__parse_elf_split(const char *path, struct btf *base_btf); [all …]
|
D | btf.c | 31 struct btf { struct 97 struct btf *base_btf; argument 192 static int btf_add_type_idx_entry(struct btf *btf, __u32 type_off) in btf_add_type_idx_entry() argument 196 p = libbpf_add_mem((void **)&btf->type_offs, &btf->type_offs_cap, sizeof(__u32), in btf_add_type_idx_entry() 197 btf->nr_types, BTF_MAX_NR_TYPES, 1); in btf_add_type_idx_entry() 215 static int btf_parse_hdr(struct btf *btf) in btf_parse_hdr() argument 217 struct btf_header *hdr = btf->hdr; in btf_parse_hdr() 220 if (btf->raw_size < sizeof(struct btf_header)) { in btf_parse_hdr() 226 btf->swapped_endian = true; in btf_parse_hdr() 238 meta_left = btf->raw_size - sizeof(*hdr); in btf_parse_hdr() [all …]
|
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() 196 t = skip_mods_and_typedefs(btf, type_id, &id); in bpf_core_parse_spec() 211 acc->name = btf__name_by_offset(btf, btf_enum(t)[access_idx].name_off); in bpf_core_parse_spec() 218 sz = btf__resolve_size(btf, id); in bpf_core_parse_spec() 224 t = skip_mods_and_typedefs(btf, id, &id); in bpf_core_parse_spec() 243 name = btf__name_by_offset(btf, m->name_off); in bpf_core_parse_spec() [all …]
|
D | linker.c | 59 struct btf *btf; member 148 struct btf *btf; member 198 btf__free(linker->btf); in bpf_linker__free() 420 linker->btf = btf__new_empty(); in init_output_elf() 421 err = libbpf_get_error(linker->btf); in init_output_elf() 461 btf__free(obj.btf); in bpf_linker__add_file() 656 obj->btf = btf__new(data->d_buf, shdr->sh_size); in linker_load_obj_file() 657 err = libbpf_get_error(obj->btf); in linker_load_obj_file() 922 struct btf *btf = ctx; in check_btf_type_id() local 924 if (*type_id > btf__get_nr_types(btf)) in check_btf_type_id() [all …]
|
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-v5.15/tools/testing/selftests/bpf/prog_tests/ |
D | btf_write.c | 13 struct btf *btf; in test_btf_write() local 16 btf = btf__new_empty(); in test_btf_write() 17 if (!ASSERT_OK_PTR(btf, "new_empty")) in test_btf_write() 20 str_off = btf__find_str(btf, "int"); in test_btf_write() 23 str_off = btf__add_str(btf, "int"); in test_btf_write() 26 str_off = btf__find_str(btf, "int"); in test_btf_write() 30 id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED); in test_btf_write() 33 t = btf__type_by_id(btf, 1); in test_btf_write() 36 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "int", "int_name"); in test_btf_write() 41 ASSERT_STREQ(btf_type_raw_dump(btf, 1), 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() 53 struct btf *btf = NULL; in test_btf_dump_case() local 59 btf = btf__parse_elf(test_file, NULL); in test_btf_dump_case() 60 if (!ASSERT_OK_PTR(btf, "btf_parse_elf")) { 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() 74 CHECK(btf__pointer_size(btf) != 8, "ptr_sz", "exp %d, got %zu\n", in test_btf_dump_case() [all …]
|
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__get_raw_data(btf, &raw_sz); in test_btf_endian() 45 ASSERT_EQ(btf__get_nr_types(swap_btf), btf__get_nr_types(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 …]
|
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 | 115 struct btf *btf; in test_ksyms_btf() local 117 btf = libbpf_find_kernel_btf(); in test_ksyms_btf() 118 if (!ASSERT_OK_PTR(btf, "btf_exists")) in test_ksyms_btf() 121 percpu_datasec = btf__find_by_name_kind(btf, ".data..percpu", in test_ksyms_btf() 123 btf__free(btf); in test_ksyms_btf()
|
/Linux-v5.15/include/linux/ |
D | btf.h | 14 struct btf; 22 void btf_get(struct btf *btf); 23 void btf_put(struct btf *btf); 25 struct btf *btf_get_by_fd(int fd); 26 int btf_get_info_by_fd(const struct btf *btf, 50 const struct btf_type *btf_type_id_size(const struct btf *btf, 71 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj, 73 int btf_type_seq_show_flags(const struct btf *btf, u32 type_id, void *obj, 89 int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj, 93 u32 btf_obj_id(const struct btf *btf); [all …]
|
/Linux-v5.15/kernel/bpf/ |
D | btf.c | 200 struct btf { struct 216 struct btf *base_btf; argument 256 struct btf *btf; member 353 const struct btf *btf; member 392 void (*show)(const struct btf *btf, const struct btf_type *t, 462 u32 btf_nr_types(const struct btf *btf) in btf_nr_types() argument 466 while (btf) { in btf_nr_types() 467 total += btf->nr_types; in btf_nr_types() 468 btf = btf->base_btf; in btf_nr_types() 474 s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind) in btf_find_by_name_kind() argument [all …]
|
/Linux-v5.15/tools/testing/selftests/bpf/ |
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);
|
D | btf_helpers.c | 78 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 82 return btf__str_by_offset(btf, off) ?: "(invalid)"; in btf_str() 85 int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id) in fprintf_btf_type_raw() argument 91 t = btf__type_by_id(btf, id); in fprintf_btf_type_raw() 98 fprintf(out, "[%u] %s '%s'", id, btf_kind_str(kind), btf_str(btf, t->name_off)); in fprintf_btf_type_raw() 131 btf_str(btf, m->name_off), m->type, bit_off); in fprintf_btf_type_raw() 143 btf_str(btf, v->name_off), v->val); in fprintf_btf_type_raw() 159 btf_str(btf, p->name_off), p->type); in fprintf_btf_type_raw() 190 const char *btf_type_raw_dump(const struct btf *btf, int type_id) in btf_type_raw_dump() argument 201 fprintf_btf_type_raw(buf_file, btf, type_id); in btf_type_raw_dump() [all …]
|
/Linux-v5.15/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() 110 ptr_type_id = btf__resolve_type(d->btf, t->type); in btf_dumper_ptr() 113 ptr_type = btf__type_by_id(d->btf, ptr_type_id); in btf_dumper_ptr() 132 actual_type_id = btf__resolve_type(d->btf, type_id); in btf_dumper_modifier() 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 186 elem_type = btf__type_by_id(btf, arr->type); in is_str_array() 191 elem_type = btf__type_by_id(btf, elem_type->type); in is_str_array() [all …]
|
D | btf.c | 96 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 100 return btf__name_by_offset(btf, off) ? : "(invalid)"; in btf_str() 108 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument 118 jsonw_string_field(w, "name", btf_str(btf, t->name_off)); in dump_btf_type() 121 btf_str(btf, t->name_off)); in dump_btf_type() 181 const char *name = btf_str(btf, m->name_off); in dump_btf_type() 227 const char *name = btf_str(btf, v->name_off); in dump_btf_type() 277 const char *name = btf_str(btf, p->name_off); in dump_btf_type() 331 if (v->type <= btf__get_nr_types(btf)) { in dump_btf_type() 332 vt = btf__type_by_id(btf, v->type); in dump_btf_type() [all …]
|
D | main.h | 93 extern struct btf *base_btf; 137 struct btf; 198 const struct btf *btf, 207 const struct btf *btf, in disasm_print_insn() argument 229 const struct btf *btf; member 244 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id, 247 void btf_dump_linfo_plain(const struct btf *btf, 250 void btf_dump_linfo_json(const struct btf *btf,
|
D | map.c | 160 unsigned char *value, struct btf *btf) in print_entry_json() argument 169 if (btf) { in print_entry_json() 171 .btf = btf, in print_entry_json() 202 if (btf) { in print_entry_json() 204 .btf = btf, in print_entry_json() 749 struct bpf_map_info *map_info, struct btf *btf, in dump_map_elem() argument 758 print_entry_json(map_info, key, value, btf); in dump_map_elem() 759 } else if (btf) { in dump_map_elem() 761 .btf = btf, in dump_map_elem() 794 static struct btf *btf_vmlinux; [all …]
|
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()
|
D | gen.c | 96 struct btf *btf, in codegen_datasec_def() argument 101 const char *sec_name = btf__name_by_offset(btf, sec->name_off); in codegen_datasec_def() 125 const struct btf_type *var = btf__type_by_id(btf, sec_var->type); in codegen_datasec_def() 126 const char *var_name = btf__name_by_offset(btf, var->name_off); in codegen_datasec_def() 145 align = btf__align_of(btf, var->type); in codegen_datasec_def() 195 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local 196 int n = btf__get_nr_types(btf); in codegen_datasecs() 200 d = btf_dump__new(btf, NULL, NULL, codegen_btf_dump_printf); in codegen_datasecs() 205 const struct btf_type *t = btf__type_by_id(btf, i); in codegen_datasecs() 210 err = codegen_datasec_def(obj, btf, d, t, obj_name); in codegen_datasecs() [all …]
|
/Linux-v5.15/tools/perf/util/ |
D | bpf-event.c | 24 struct btf * __weak btf__load_from_kernel_by_id(__u32 id) in btf__load_from_kernel_by_id() 26 struct btf *btf; in btf__load_from_kernel_by_id() local 29 int err = btf__get_from_id(id, &btf); in btf__load_from_kernel_by_id() 32 return err ? ERR_PTR(err) : btf; in btf__load_from_kernel_by_id() 107 struct btf *btf) in perf_env__fetch_btf() argument 113 data = btf__get_raw_data(btf, &data_size); in perf_env__fetch_btf() 129 struct btf *btf, in synthesize_bpf_prog_name() argument 143 if (btf) { in synthesize_bpf_prog_name() 145 t = btf__type_by_id(btf, finfo->type_id); in synthesize_bpf_prog_name() 146 short_name = btf__name_by_offset(btf, t->name_off); in synthesize_bpf_prog_name() [all …]
|
/Linux-v5.15/kernel/bpf/preload/iterators/ |
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-v5.15/tools/bpf/bpftool/Documentation/ |
D | bpftool-btf.rst | 2 bpftool-btf 13 **bpftool** [*OPTIONS*] **btf** *COMMAND* 16 { **-B** | **--base-btf** } } 23 | **bpftool** **btf** { **show** | **list** } [**id** *BTF_ID*] 24 | **bpftool** **btf dump** *BTF_SRC* [**format** *FORMAT*] 25 | **bpftool** **btf help** 34 **bpftool btf { show | list }** [**id** *BTF_ID*] 45 **bpftool btf dump** *BTF_SRC* 70 **bpftool btf help** 77 -B, --base-btf *FILE* [all …]
|
/Linux-v5.15/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 19 What: /sys/kernel/btf/<module-name> 25 information as an add-on to the kernel's BTF (/sys/kernel/btf/vmlinux).
|