Lines Matching refs:btf
43 struct btf *btf; member
87 extern struct btf *btf_vmlinux;
89 static bool is_valid_value_type(struct btf *btf, s32 value_id, in is_valid_value_type() argument
97 vt = btf_type_by_id(btf, value_id); in is_valid_value_type()
104 mt = btf_type_by_id(btf, member->type); in is_valid_value_type()
113 mt = btf_type_by_id(btf, member->type); in is_valid_value_type()
116 value_name, btf_name_by_offset(btf, type->name_off)); in is_valid_value_type()
171 static int prepare_arg_info(struct btf *btf, in prepare_arg_info() argument
196 stub_func_id = btf_find_by_name_kind(btf, stub_fname, BTF_KIND_FUNC); in prepare_arg_info()
202 stub_func_proto = btf_type_by_id(btf, stub_func_id); in prepare_arg_info()
203 stub_func_proto = btf_type_by_id(btf, stub_func_proto->type); in prepare_arg_info()
231 is_nullable = btf_param_match_suffix(btf, &stub_args[arg_no], in prepare_arg_info()
233 is_refcounted = btf_param_match_suffix(btf, &stub_args[arg_no], in prepare_arg_info()
244 pointed_type = btf_type_resolve_ptr(btf, in prepare_arg_info()
254 offset = btf_ctx_arg_offset(btf, func_proto, arg_no); in prepare_arg_info()
269 info->btf = btf; in prepare_arg_info()
310 static bool is_module_member(const struct btf *btf, u32 id) in is_module_member() argument
314 t = btf_type_resolve_ptr(btf, id, NULL); in is_module_member()
321 return !strcmp(btf_name_by_offset(btf, t->name_off), "module"); in is_module_member()
332 struct btf *btf, in bpf_struct_ops_desc_init() argument
357 type_id = btf_find_by_name_kind(btf, st_ops->name, in bpf_struct_ops_desc_init()
361 st_ops->name, btf_get_name(btf)); in bpf_struct_ops_desc_init()
364 t = btf_type_by_id(btf, type_id); in bpf_struct_ops_desc_init()
371 value_id = btf_find_by_name_kind(btf, value_name, in bpf_struct_ops_desc_init()
375 value_name, btf_get_name(btf)); in bpf_struct_ops_desc_init()
378 if (!is_valid_value_type(btf, value_id, t, value_name)) in bpf_struct_ops_desc_init()
389 st_ops_desc->value_type = btf_type_by_id(btf, value_id); in bpf_struct_ops_desc_init()
397 mname = btf_name_by_offset(btf, member->name_off); in bpf_struct_ops_desc_init()
412 if (!st_ops_ids[IDX_MODULE_ID] && is_module_member(btf, member->type)) { in bpf_struct_ops_desc_init()
419 func_proto = btf_type_resolve_func_ptr(btf, in bpf_struct_ops_desc_init()
430 ret_type = btf_type_resolve_ptr(btf, func_proto->type, NULL); in bpf_struct_ops_desc_init()
439 if (btf_distill_func_proto(log, btf, in bpf_struct_ops_desc_init()
449 err = prepare_arg_info(btf, st_ops->name, mname, in bpf_struct_ops_desc_init()
456 if (st_ops->init(btf)) { in bpf_struct_ops_desc_init()
555 static int check_zero_holes(const struct btf *btf, const struct btf_type *t, void *data) in check_zero_holes() argument
567 mtype = btf_type_by_id(btf, member->type); in check_zero_holes()
568 mtype = btf_resolve_size(btf, mtype, &msize); in check_zero_holes()
711 err = check_zero_holes(st_map->btf, st_ops_desc->value_type, value); in bpf_struct_ops_map_update_elem()
716 err = check_zero_holes(st_map->btf, t, uvalue->data); in bpf_struct_ops_map_update_elem()
744 tname = btf_name_by_offset(st_map->btf, t->name_off); in bpf_struct_ops_map_update_elem()
754 mname = btf_name_by_offset(st_map->btf, member->name_off); in bpf_struct_ops_map_update_elem()
755 ptype = btf_type_resolve_ptr(st_map->btf, member->type, NULL); in bpf_struct_ops_map_update_elem()
780 mtype = btf_type_by_id(st_map->btf, member->type); in bpf_struct_ops_map_update_elem()
781 mtype = btf_resolve_size(st_map->btf, mtype, &msize); in bpf_struct_ops_map_update_elem()
961 btf_type_seq_show(st_map->btf, in bpf_struct_ops_map_seq_show_elem()
993 if (btf_is_module(st_map->btf)) in bpf_struct_ops_map_free()
1029 static u32 count_func_ptrs(const struct btf *btf, const struct btf_type *t) in count_func_ptrs() argument
1037 if (btf_type_resolve_func_ptr(btf, member->type, NULL)) in count_func_ptrs()
1050 struct btf *btf; in bpf_struct_ops_map_alloc() local
1055 btf = btf_get_by_fd(attr->value_type_btf_obj_fd); in bpf_struct_ops_map_alloc()
1056 if (IS_ERR(btf)) in bpf_struct_ops_map_alloc()
1057 return ERR_CAST(btf); in bpf_struct_ops_map_alloc()
1058 if (!btf_is_module(btf)) { in bpf_struct_ops_map_alloc()
1059 btf_put(btf); in bpf_struct_ops_map_alloc()
1063 mod = btf_try_get_module(btf); in bpf_struct_ops_map_alloc()
1067 btf_put(btf); in bpf_struct_ops_map_alloc()
1071 btf = bpf_get_btf_vmlinux(); in bpf_struct_ops_map_alloc()
1072 if (IS_ERR(btf)) in bpf_struct_ops_map_alloc()
1073 return ERR_CAST(btf); in bpf_struct_ops_map_alloc()
1074 if (!btf) in bpf_struct_ops_map_alloc()
1078 st_ops_desc = bpf_struct_ops_find_value(btf, attr->btf_vmlinux_value_type_id); in bpf_struct_ops_map_alloc()
1108 st_map->funcs_cnt = count_func_ptrs(btf, t); in bpf_struct_ops_map_alloc()
1120 st_map->btf = btf; in bpf_struct_ops_map_alloc()
1490 info->btf_vmlinux_id = btf_obj_id(st_map->btf); in bpf_map_struct_ops_info_fill()