Lines Matching refs:btf

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, var->name_off); in codegen_datasec_def()
187 align = btf__align_of(btf, var->type); in codegen_datasec_def()
235 static const struct btf_type *find_type_for_map(struct btf *btf, const char *map_ident) in find_type_for_map() argument
237 int n = btf__type_cnt(btf), i; in find_type_for_map()
241 const struct btf_type *t = btf__type_by_id(btf, i); in find_type_for_map()
247 name = btf__str_by_offset(btf, t->name_off); in find_type_for_map()
277 struct btf *btf = bpf_object__btf(obj); in codegen_datasecs() local
284 d = btf_dump__new(btf, codegen_btf_dump_printf, NULL, NULL); in codegen_datasecs()
293 sec = find_type_for_map(btf, map_ident); in codegen_datasecs()
306 err = codegen_datasec_def(obj, btf, d, sec, obj_name); in codegen_datasecs()
318 static bool btf_is_ptr_to_func_proto(const struct btf *btf, in btf_is_ptr_to_func_proto() argument
321 return btf_is_ptr(v) && btf_is_func_proto(btf__type_by_id(btf, v->type)); in btf_is_ptr_to_func_proto()
326 struct btf *btf = bpf_object__btf(obj); in codegen_subskel_datasecs() local
337 d = btf_dump__new(btf, codegen_btf_dump_printf, NULL, NULL); in codegen_subskel_datasecs()
346 sec = find_type_for_map(btf, map_ident); in codegen_subskel_datasecs()
350 sec_name = btf__name_by_offset(btf, sec->name_off); in codegen_subskel_datasecs()
367 var = btf__type_by_id(btf, sec_var->type); in codegen_subskel_datasecs()
368 var_name = btf__name_by_offset(btf, var->name_off); in codegen_subskel_datasecs()
378 var = skip_mods_and_typedefs(btf, var->type, NULL); in codegen_subskel_datasecs()
387 needs_typeof = btf_is_array(var) || btf_is_ptr_to_func_proto(btf, var); in codegen_subskel_datasecs()
499 struct btf *btf = bpf_object__btf(obj); in codegen_asserts() local
506 if (!btf) in codegen_asserts()
523 sec = find_type_for_map(btf, map_ident); in codegen_asserts()
533 const struct btf_type *var = btf__type_by_id(btf, sec_var->type); in codegen_asserts()
534 const char *var_name = btf__name_by_offset(btf, var->name_off); in codegen_asserts()
541 var_size = btf__resolve_size(btf, var->type); in codegen_asserts()
963 static int walk_st_ops_shadow_vars(struct btf *btf, const char *ident, in walk_st_ops_shadow_vars() argument
976 d = btf_dump__new(btf, codegen_btf_dump_printf, NULL, NULL); in walk_st_ops_shadow_vars()
982 member_type = skip_mods_and_typedefs(btf, m->type, &member_type_id); in walk_st_ops_shadow_vars()
983 member_name = btf__name_by_offset(btf, m->name_off); in walk_st_ops_shadow_vars()
1004 size = btf__resolve_size(btf, member_type_id); in walk_st_ops_shadow_vars()
1015 if (resolve_func_ptr(btf, m->type, NULL)) { in walk_st_ops_shadow_vars()
1039 size = btf__resolve_size(btf, member_type_id); in walk_st_ops_shadow_vars()
1053 size = btf__resolve_size(btf, map_type_id); in walk_st_ops_shadow_vars()
1078 static int gen_st_ops_shadow_type(const char *obj_name, struct btf *btf, const char *ident, in gen_st_ops_shadow_type() argument
1089 map_type = btf__type_by_id(btf, map_type_id); in gen_st_ops_shadow_type()
1093 type_name = btf__name_by_offset(btf, map_type->name_off); in gen_st_ops_shadow_type()
1097 err = walk_st_ops_shadow_vars(btf, ident, map_type, map_type_id); in gen_st_ops_shadow_type()
1106 static int gen_st_ops_shadow(const char *obj_name, struct btf *btf, struct bpf_object *obj) in gen_st_ops_shadow() argument
1112 if (!btf) in gen_st_ops_shadow()
1128 err = gen_st_ops_shadow_type(obj_name, btf, ident, map); in gen_st_ops_shadow()
1140 static void gen_st_ops_shadow_init(struct btf *btf, struct bpf_object *obj) in gen_st_ops_shadow_init() argument
1145 if (!btf) in gen_st_ops_shadow_init()
1177 struct btf *btf; in do_skeleton() local
1314 btf = bpf_object__btf(obj); in do_skeleton()
1315 err = gen_st_ops_shadow(obj_name, btf, obj); in do_skeleton()
1358 if (btf) { in do_skeleton()
1417 gen_st_ops_shadow_init(btf, obj); in do_skeleton()
1582 struct btf *btf; in do_subskeleton() local
1659 btf = bpf_object__btf(obj); in do_subskeleton()
1660 if (!btf) { in do_subskeleton()
1689 map_type = btf__type_by_id(btf, map_type_id); in do_subskeleton()
1694 var_type = btf__type_by_id(btf, var->type); in do_subskeleton()
1731 err = gen_st_ops_shadow(obj_name, btf, obj); in do_subskeleton()
1812 map_type = btf__type_by_id(btf, map_type_id); in do_subskeleton()
1816 var_type = btf__type_by_id(btf, var->type); in do_subskeleton()
1817 var_name = btf__name_by_offset(btf, var_type->name_off); in do_subskeleton()
1849 gen_st_ops_shadow_init(btf, obj); in do_subskeleton()
1940 static int btf_save_raw(const struct btf *btf, const char *path) in btf_save_raw() argument
1947 data = btf__raw_data(btf, &data_sz); in btf_save_raw()
1963 struct btf *src_btf;
1964 struct btf *marked_btf; /* btf structure used to mark used types */
2107 struct btf *btf = info->src_btf; in btfgen_record_field_relo() local
2115 btf_type = btf__type_by_id(btf, type_id); in btfgen_record_field_relo()
2125 btf_type = btf__type_by_id(btf, type_id); in btfgen_record_field_relo()
2139 btf_type = btf__type_by_id(btf, type_id); in btfgen_record_field_relo()
2147 btf_type = btf__type_by_id(btf, type_id); in btfgen_record_field_relo()
2170 struct btf *btf = info->src_btf; in btfgen_mark_type_match() local
2177 btf_type = btf__type_by_id(btf, type_id); in btfgen_mark_type_match()
2302 btfgen_find_cands(const struct btf *local_btf, const struct btf *targ_btf, __u32 local_id) in btfgen_find_cands()
2311 local_cand.btf = local_btf; in btfgen_find_cands()
2353 struct btf *btf = NULL; in btfgen_record_obj() local
2357 btf = btf__parse(obj_path, &btf_ext); in btfgen_record_obj()
2358 if (!btf) { in btfgen_record_obj()
2388 const char *sec_name = btf__name_by_offset(btf, sec->sec_name_off); in btfgen_record_obj()
2392 cands = btfgen_find_cands(btf, info->src_btf, relo->type_id); in btfgen_record_obj()
2404 err = bpf_core_calc_relo_insn(sec_name, relo, relo_idx, btf, cands, in btfgen_record_obj()
2417 btf__free(btf); in btfgen_record_obj()
2431 static struct btf *btfgen_get_btf(struct btfgen_info *info) in btfgen_get_btf()
2433 struct btf *btf_new = NULL; in btfgen_get_btf()
2556 struct btf *btf_new = NULL; in minimize_btf()