/linux-6.3-rc2/tools/testing/selftests/bpf/prog_tests/ |
A D | linked_list.c | 246 struct btf *btf; in init_btf() local 263 return btf; in init_btf() 265 btf__free(btf); in init_btf() 271 struct btf *btf = NULL; in test_btf() local 293 btf__free(btf); in test_btf() 319 btf__free(btf); in test_btf() 345 btf__free(btf); in test_btf() 365 btf__free(btf); in test_btf() 388 btf__free(btf); in test_btf() 410 btf__free(btf); in test_btf() [all …]
|
A D | btf_write.c | 7 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 D | btf_dump.c | 26 static int btf_dump_all_types(const struct btf *btf, void *ctx) in btf_dump_all_types() argument 51 struct btf *btf = NULL; in test_btf_dump_case() local 60 btf = NULL; in test_btf_dump_case() 125 btf__free(btf); in test_btf_dump_case() 135 struct btf *btf = NULL; in test_btf_dump_incremental() local 255 btf__free(btf); in test_btf_dump_incremental() 269 static int btf_dump_data(struct btf *btf, struct btf_dump *d, in btf_dump_data() argument 840 struct btf *btf; in test_btf_dump_datasec_data() local 857 btf__free(btf); in test_btf_dump_datasec_data() 863 struct btf *btf; in test_btf_dump() local [all …]
|
A D | libbpf_str.c | 23 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() 154 btf__free(btf); in test_libbpf_bpf_map_type_str() 163 struct btf *btf; in test_libbpf_bpf_prog_type_str() local [all …]
|
A D | libbpf_probes.c | 9 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() 42 btf__free(btf); in test_libbpf_probe_prog_types() 47 struct btf *btf; in test_libbpf_probe_map_types() local 52 btf = btf__parse("/sys/kernel/btf/vmlinux", NULL); in test_libbpf_probe_map_types() 53 if (!ASSERT_OK_PTR(btf, "btf_parse")) in test_libbpf_probe_map_types() 60 t = btf__type_by_id(btf, id); in test_libbpf_probe_map_types() [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.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 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 | btf_dedup_split.c | 9 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() 351 btf__add_field(btf, "f2", ID(1), 32, 0); /* int f2; */ in btf_add_dup_struct_in_cu() [all …]
|
A D | resolve_btfids.c | 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_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()
|
/linux-6.3-rc2/tools/lib/bpf/ |
A D | btf.h | 23 struct btf; 38 LIBBPF_API void btf__free(struct btf *btf); 123 LIBBPF_API int btf__load_into_kernel(struct btf *btf); 124 LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, 128 LIBBPF_API __u32 btf__type_cnt(const struct btf *btf); 129 LIBBPF_API const struct btf *btf__base_btf(const struct btf *btf); 139 LIBBPF_API int btf__fd(const struct btf *btf); 140 LIBBPF_API void btf__set_fd(struct btf *btf, int fd); 151 LIBBPF_API int btf__add_type(struct btf *btf, const struct btf *src_btf, 174 LIBBPF_API int btf__add_btf(struct btf *btf, const struct btf *src_btf); [all …]
|
A D | btf.c | 818 struct btf *btf; in btf_new_empty() local 869 struct btf *btf; in btf_new() local 900 btf->strs_data = btf->raw_data + btf->hdr->hdr_len + btf->hdr->str_off; in btf_new() 901 btf->types_data = btf->raw_data + btf->hdr->hdr_len + btf->hdr->type_off; in btf_new() 1135 struct btf *btf; in btf_parse() local 1309 struct btf *btf = (struct btf *)btf_ro; in btf__raw_data() local 1349 struct btf *btf; in btf_get_from_fd() local 1400 struct btf *btf; in btf__load_from_kernel_by_id_split() local 3111 struct btf *btf; member 3229 d->btf = btf; in btf_dedup_new() [all …]
|
A D | relo_core.h | 10 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 D | relo_core.c | 22 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 …]
|
A D | linker.c | 58 struct btf *btf; member 147 struct btf *btf; member 917 struct btf *btf = ctx; in check_btf_type_id() local 927 struct btf *btf = ctx; in check_btf_str_off() local 943 if (!obj->btf) in linker_sanity_check_btf() 967 if (!obj->btf) in linker_sanity_check_btf_ext() 1634 linker->btf, glob_sym->btf_id, obj->btf, btf_id)) in glob_syms_match() 2131 if (!obj->btf) in linker_fixup_btf() 2235 if (!obj->btf) in linker_append_btf() 2284 id = btf__add_type(linker->btf, obj->btf, t); in linker_append_btf() [all …]
|
/linux-6.3-rc2/include/linux/ |
A D | btf.h | 92 struct btf; 124 void btf_get(struct btf *btf); 125 void btf_put(struct btf *btf); 128 int btf_get_info_by_fd(const struct btf *btf, 195 u32 btf_obj_id(const struct btf *btf); 196 bool btf_is_kernel(const struct btf *btf); 197 bool btf_is_module(const struct btf *btf); 198 struct module *btf_try_get_module(const struct btf *btf); 199 u32 btf_nr_types(const struct btf *btf); 491 u32 *btf_kfunc_id_set_contains(const struct btf *btf, [all …]
|
/linux-6.3-rc2/kernel/bpf/ |
A D | btf.c | 1400 struct btf *btf = env->btf; in __btf_verifier_log_type() local 1450 struct btf *btf = env->btf; in btf_verifier_log_member() local 1550 struct btf *btf = env->btf; in btf_add_type() local 1713 struct btf *btf = env->btf; in env_resolve_init() local 1829 struct btf *btf = env->btf; in env_stack_pop_resolved() local 2429 struct btf *btf = env->btf; in btf_modifier_check_member() local 2454 struct btf *btf = env->btf; in btf_modifier_check_kflag_member() local 2551 struct btf *btf = env->btf; in btf_modifier_resolve() local 2593 struct btf *btf = env->btf; in btf_var_resolve() local 2639 struct btf *btf = env->btf; in btf_ptr_resolve() local [all …]
|
/linux-6.3-rc2/tools/testing/selftests/bpf/ |
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);
|
A D | btf_helpers.c | 81 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 …]
|
/linux-6.3-rc2/tools/bpf/bpftool/ |
A D | btf_dumper.c | 27 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() 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 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 [all …]
|
A D | gen.c | 125 struct btf *btf, in codegen_datasec_def() argument 247 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local 296 struct btf *btf = bpf_object__btf(obj); in codegen_subskel_datasecs() local 469 struct btf *btf = bpf_object__btf(obj); in codegen_asserts() local 476 if (!btf) in codegen_asserts() 918 struct btf *btf; in do_skeleton() local 1073 if (btf) { in do_skeleton() 1287 struct btf *btf; in do_subskeleton() local 1801 struct btf *btf = info->src_btf; in btfgen_record_field_relo() local 1864 struct btf *btf = info->src_btf; in btfgen_mark_type_match() local [all …]
|
A D | btf.c | 90 static const char *btf_str(const struct btf *btf, __u32 off) in btf_str() argument 102 static int dump_btf_type(const struct btf *btf, __u32 id, in dump_btf_type() argument 418 static int dump_btf_raw(const struct btf *btf, in dump_btf_raw() argument 436 const struct btf *base; in dump_btf_raw() 463 static int dump_btf_c(const struct btf *btf, in dump_btf_c() argument 511 struct btf *base; in get_vmlinux_btf_from_sysfs() 552 struct btf *btf = NULL, *base = NULL; in do_dump() local 634 if (!btf) { in do_dump() 673 if (!btf) { in do_dump() 681 if (!btf) { in do_dump() [all …]
|
A D | main.h | 85 extern struct btf *base_btf; 112 struct btf; 178 const struct btf *btf, 187 const struct btf *btf, in disasm_print_insn() argument 209 const struct btf *btf; member 224 void btf_dumper_type_only(const struct btf *btf, __u32 func_type_id, 227 void btf_dump_linfo_plain(const struct btf *btf, 230 void btf_dump_linfo_json(const struct btf *btf,
|
/linux-6.3-rc2/tools/perf/util/ |
A D | bpf-event.c | 28 struct btf *btf; in btf__load_from_kernel_by_id() local 161 struct btf *btf) in perf_env__fetch_btf() argument 187 struct btf *btf, in synthesize_bpf_prog_name() argument 201 if (btf) { in synthesize_bpf_prog_name() 240 struct btf *btf = NULL; in perf_event__synthesize_one_bpf_prog() local 368 btf__free(btf); in perf_event__synthesize_one_bpf_prog() 515 struct btf *btf = NULL; in perf_env__add_bpf_info() local 551 if (libbpf_get_error(btf)) { in perf_env__add_bpf_info() 559 btf__free(btf); in perf_env__add_bpf_info() 616 struct btf *btf = NULL; in bpf_event__print_bpf_prog_info() local [all …]
|
/linux-6.3-rc2/kernel/bpf/preload/iterators/ |
A D | iterators.bpf.c | 34 struct btf { struct 46 struct btf *btf; member 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-6.3-rc2/tools/bpf/bpftool/Documentation/ |
A D | bpftool-btf.rst | 4 bpftool-btf 28 | **bpftool** **btf help** 48 **bpftool btf dump** *BTF_SRC* 73 **bpftool btf help** 80 -B, --base-btf *FILE* 96 **# bpftool btf dump id 1226** 151 **$ bpftool btf dump file prog.o** 229 **# bpftool btf dump map id 123** 233 **# bpftool btf dump prog id 456** 240 | **# bpftool btf dump file /sys/kernel/btf/i2c_smbus** [all …]
|