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()
390 st_ops_desc->value_type = btf_type_by_id(btf, value_id); in bpf_struct_ops_desc_init()
398 mname = btf_name_by_offset(btf, member->name_off); in bpf_struct_ops_desc_init()
413 if (!st_ops_ids[IDX_MODULE_ID] && is_module_member(btf, member->type)) { in bpf_struct_ops_desc_init()
420 func_proto = btf_type_resolve_func_ptr(btf, in bpf_struct_ops_desc_init()
431 ret_type = btf_type_resolve_ptr(btf, func_proto->type, NULL); in bpf_struct_ops_desc_init()
440 if (btf_distill_func_proto(log, btf, in bpf_struct_ops_desc_init()
450 err = prepare_arg_info(btf, st_ops->name, mname, in bpf_struct_ops_desc_init()
457 if (st_ops->init(btf)) { in bpf_struct_ops_desc_init()
545 static int check_zero_holes(const struct btf *btf, const struct btf_type *t, void *data) in check_zero_holes() argument
557 mtype = btf_type_by_id(btf, member->type); in check_zero_holes()
558 mtype = btf_resolve_size(btf, mtype, &msize); in check_zero_holes()
701 err = check_zero_holes(st_map->btf, st_ops_desc->value_type, value); in bpf_struct_ops_map_update_elem()
706 err = check_zero_holes(st_map->btf, t, uvalue->data); in bpf_struct_ops_map_update_elem()
734 tname = btf_name_by_offset(st_map->btf, t->name_off); in bpf_struct_ops_map_update_elem()
744 mname = btf_name_by_offset(st_map->btf, member->name_off); in bpf_struct_ops_map_update_elem()
745 ptype = btf_type_resolve_ptr(st_map->btf, member->type, NULL); in bpf_struct_ops_map_update_elem()
770 mtype = btf_type_by_id(st_map->btf, member->type); in bpf_struct_ops_map_update_elem()
771 mtype = btf_resolve_size(st_map->btf, mtype, &msize); in bpf_struct_ops_map_update_elem()
948 btf_type_seq_show(st_map->btf, in bpf_struct_ops_map_seq_show_elem()
980 if (btf_is_module(st_map->btf)) in bpf_struct_ops_map_free()
1014 static u32 count_func_ptrs(const struct btf *btf, const struct btf_type *t) in count_func_ptrs() argument
1022 if (btf_type_resolve_func_ptr(btf, member->type, NULL)) in count_func_ptrs()
1035 struct btf *btf; in bpf_struct_ops_map_alloc() local
1040 btf = btf_get_by_fd(attr->value_type_btf_obj_fd); in bpf_struct_ops_map_alloc()
1041 if (IS_ERR(btf)) in bpf_struct_ops_map_alloc()
1042 return ERR_CAST(btf); in bpf_struct_ops_map_alloc()
1043 if (!btf_is_module(btf)) { in bpf_struct_ops_map_alloc()
1044 btf_put(btf); in bpf_struct_ops_map_alloc()
1048 mod = btf_try_get_module(btf); in bpf_struct_ops_map_alloc()
1052 btf_put(btf); in bpf_struct_ops_map_alloc()
1056 btf = bpf_get_btf_vmlinux(); in bpf_struct_ops_map_alloc()
1057 if (IS_ERR(btf)) in bpf_struct_ops_map_alloc()
1058 return ERR_CAST(btf); in bpf_struct_ops_map_alloc()
1059 if (!btf) in bpf_struct_ops_map_alloc()
1063 st_ops_desc = bpf_struct_ops_find_value(btf, attr->btf_vmlinux_value_type_id); in bpf_struct_ops_map_alloc()
1093 st_map->funcs_cnt = count_func_ptrs(btf, t); in bpf_struct_ops_map_alloc()
1105 st_map->btf = btf; in bpf_struct_ops_map_alloc()
1388 info->btf_vmlinux_id = btf_obj_id(st_map->btf); in bpf_map_struct_ops_info_fill()