Lines Matching refs:t
893 find_member_by_offset(const struct btf_type *t, __u32 bit_offset) in find_member_by_offset() argument
898 for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) { in find_member_by_offset()
899 if (btf_member_bit_offset(t, i) == bit_offset) in find_member_by_offset()
907 find_member_by_name(const struct btf *btf, const struct btf_type *t, in find_member_by_name() argument
913 for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) { in find_member_by_name()
1611 const struct btf_type *t, *vt; in map_is_mmapable() local
1618 t = btf__type_by_id(obj->btf, map->btf_value_type_id); in map_is_mmapable()
1619 if (!btf_is_datasec(t)) in map_is_mmapable()
1622 vsi = btf_var_secinfos(t); in map_is_mmapable()
1623 for (i = 0, n = btf_vlen(t); i < n; i++, vsi++) { in map_is_mmapable()
2067 const struct btf_type *t = btf__type_by_id(btf, id); in skip_mods_and_typedefs() local
2072 while (btf_is_mod(t) || btf_is_typedef(t)) { in skip_mods_and_typedefs()
2074 *res_id = t->type; in skip_mods_and_typedefs()
2075 t = btf__type_by_id(btf, t->type); in skip_mods_and_typedefs()
2078 return t; in skip_mods_and_typedefs()
2084 const struct btf_type *t; in resolve_func_ptr() local
2086 t = skip_mods_and_typedefs(btf, id, NULL); in resolve_func_ptr()
2087 if (!btf_is_ptr(t)) in resolve_func_ptr()
2090 t = skip_mods_and_typedefs(btf, t->type, res_id); in resolve_func_ptr()
2092 return btf_is_func_proto(t) ? t : NULL; in resolve_func_ptr()
2122 const char *btf_kind_str(const struct btf_type *t) in btf_kind_str() argument
2124 return __btf_kind_str(btf_kind(t)); in btf_kind_str()
2137 const struct btf_type *t = skip_mods_and_typedefs(btf, m->type, NULL); in get_map_field_int() local
2142 if (!btf_is_ptr(t)) { in get_map_field_int()
2144 map_name, name, btf_kind_str(t)); in get_map_field_int()
2148 arr_t = btf__type_by_id(btf, t->type); in get_map_field_int()
2151 map_name, name, t->type); in get_map_field_int()
2203 const struct btf_type *t; in parse_btf_map_def() local
2248 t = btf__type_by_id(btf, m->type); in parse_btf_map_def()
2249 if (!t) { in parse_btf_map_def()
2254 if (!btf_is_ptr(t)) { in parse_btf_map_def()
2256 map_name, btf_kind_str(t)); in parse_btf_map_def()
2259 sz = btf__resolve_size(btf, t->type); in parse_btf_map_def()
2262 map_name, t->type, (ssize_t)sz); in parse_btf_map_def()
2271 map_def->key_type_id = t->type; in parse_btf_map_def()
2288 t = btf__type_by_id(btf, m->type); in parse_btf_map_def()
2289 if (!t) { in parse_btf_map_def()
2294 if (!btf_is_ptr(t)) { in parse_btf_map_def()
2296 map_name, btf_kind_str(t)); in parse_btf_map_def()
2299 sz = btf__resolve_size(btf, t->type); in parse_btf_map_def()
2302 map_name, t->type, (ssize_t)sz); in parse_btf_map_def()
2311 map_def->value_type_id = t->type; in parse_btf_map_def()
2342 t = btf__type_by_id(btf, m->type); in parse_btf_map_def()
2343 if (!t) { in parse_btf_map_def()
2348 if (!btf_is_array(t) || btf_array(t)->nelems) { in parse_btf_map_def()
2353 t = skip_mods_and_typedefs(btf, btf_array(t)->type, NULL); in parse_btf_map_def()
2354 if (!btf_is_ptr(t)) { in parse_btf_map_def()
2356 map_name, desc, btf_kind_str(t)); in parse_btf_map_def()
2359 t = skip_mods_and_typedefs(btf, t->type, NULL); in parse_btf_map_def()
2361 if (!btf_is_func_proto(t)) { in parse_btf_map_def()
2363 map_name, btf_kind_str(t)); in parse_btf_map_def()
2368 if (!btf_is_struct(t)) { in parse_btf_map_def()
2370 map_name, btf_kind_str(t)); in parse_btf_map_def()
2375 err = parse_btf_map_def(inner_map_name, btf, t, strict, inner_def, NULL); in parse_btf_map_def()
2620 const struct btf_type *t; in bpf_object__init_user_btf_maps() local
2638 t = btf__type_by_id(obj->btf, i); in bpf_object__init_user_btf_maps()
2639 if (!btf_is_datasec(t)) in bpf_object__init_user_btf_maps()
2641 name = btf__name_by_offset(obj->btf, t->name_off); in bpf_object__init_user_btf_maps()
2643 sec = t; in bpf_object__init_user_btf_maps()
2720 struct btf_type *t; in bpf_object__sanitize_btf() local
2724 t = (struct btf_type *)btf__type_by_id(btf, i); in bpf_object__sanitize_btf()
2726 if ((!has_datasec && btf_is_var(t)) || (!has_decl_tag && btf_is_decl_tag(t))) { in bpf_object__sanitize_btf()
2728 t->info = BTF_INFO_ENC(BTF_KIND_INT, 0, 0); in bpf_object__sanitize_btf()
2734 t->size = 1; in bpf_object__sanitize_btf()
2735 *(int *)(t + 1) = BTF_INT_ENC(0, 0, 8); in bpf_object__sanitize_btf()
2736 } else if (!has_datasec && btf_is_datasec(t)) { in bpf_object__sanitize_btf()
2738 const struct btf_var_secinfo *v = btf_var_secinfos(t); in bpf_object__sanitize_btf()
2739 struct btf_member *m = btf_members(t); in bpf_object__sanitize_btf()
2743 name = (char *)btf__name_by_offset(btf, t->name_off); in bpf_object__sanitize_btf()
2750 vlen = btf_vlen(t); in bpf_object__sanitize_btf()
2751 t->info = BTF_INFO_ENC(BTF_KIND_STRUCT, 0, vlen); in bpf_object__sanitize_btf()
2760 } else if (!has_func && btf_is_func_proto(t)) { in bpf_object__sanitize_btf()
2762 vlen = btf_vlen(t); in bpf_object__sanitize_btf()
2763 t->info = BTF_INFO_ENC(BTF_KIND_ENUM, 0, vlen); in bpf_object__sanitize_btf()
2764 t->size = sizeof(__u32); /* kernel enforced */ in bpf_object__sanitize_btf()
2765 } else if (!has_func && btf_is_func(t)) { in bpf_object__sanitize_btf()
2767 t->info = BTF_INFO_ENC(BTF_KIND_TYPEDEF, 0, 0); in bpf_object__sanitize_btf()
2768 } else if (!has_func_global && btf_is_func(t)) { in bpf_object__sanitize_btf()
2770 t->info = BTF_INFO_ENC(BTF_KIND_FUNC, 0, 0); in bpf_object__sanitize_btf()
2771 } else if (!has_float && btf_is_float(t)) { in bpf_object__sanitize_btf()
2776 t->name_off = 0; in bpf_object__sanitize_btf()
2777 t->info = BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 0); in bpf_object__sanitize_btf()
2778 } else if (!has_type_tag && btf_is_type_tag(t)) { in bpf_object__sanitize_btf()
2780 t->name_off = 0; in bpf_object__sanitize_btf()
2781 t->info = BTF_INFO_ENC(BTF_KIND_CONST, 0, 0); in bpf_object__sanitize_btf()
2782 } else if (!has_enum64 && btf_is_enum(t)) { in bpf_object__sanitize_btf()
2784 t->info = btf_type_info(btf_kind(t), btf_vlen(t), false); in bpf_object__sanitize_btf()
2785 } else if (!has_enum64 && btf_is_enum64(t)) { in bpf_object__sanitize_btf()
2794 t = (struct btf_type *)btf__type_by_id(btf, i); in bpf_object__sanitize_btf()
2797 m = btf_members(t); in bpf_object__sanitize_btf()
2798 vlen = btf_vlen(t); in bpf_object__sanitize_btf()
2799 t->info = BTF_INFO_ENC(BTF_KIND_UNION, 0, vlen); in bpf_object__sanitize_btf()
2912 struct btf_type *t) in btf_fixup_datasec() argument
2914 __u32 size = 0, i, vars = btf_vlen(t); in btf_fixup_datasec()
2915 const char *sec_name = btf__name_by_offset(btf, t->name_off); in btf_fixup_datasec()
2942 if (t->size == 0) { in btf_fixup_datasec()
2950 t->size = size; in btf_fixup_datasec()
2954 for (i = 0, vsi = btf_var_secinfos(t); i < vars; i++, vsi++) { in btf_fixup_datasec()
3000 qsort(btf_var_secinfos(t), vars, sizeof(*vsi), compare_vsi_off); in btf_fixup_datasec()
3013 struct btf_type *t = btf_type_by_id(obj->btf, i); in bpf_object_fixup_btf() local
3020 if (btf_is_datasec(t)) { in bpf_object_fixup_btf()
3021 err = btf_fixup_datasec(obj, obj->btf, t); in bpf_object_fixup_btf()
3124 struct btf_type *t; in bpf_object__sanitize_and_load_btf() local
3133 t = btf_type_by_id(obj->btf, j); in bpf_object__sanitize_and_load_btf()
3134 if (!btf_is_func(t) || btf_func_linkage(t) != BTF_FUNC_GLOBAL) in bpf_object__sanitize_and_load_btf()
3137 name = btf__str_by_offset(obj->btf, t->name_off); in bpf_object__sanitize_and_load_btf()
3141 t->info = btf_type_info(BTF_KIND_FUNC, BTF_FUNC_STATIC, 0); in bpf_object__sanitize_and_load_btf()
3594 const struct btf_type *t; in find_extern_btf_id() local
3603 t = btf__type_by_id(btf, i); in find_extern_btf_id()
3605 if (!btf_is_var(t) && !btf_is_func(t)) in find_extern_btf_id()
3608 tname = btf__name_by_offset(btf, t->name_off); in find_extern_btf_id()
3612 if (btf_is_var(t) && in find_extern_btf_id()
3613 btf_var(t)->linkage != BTF_VAR_GLOBAL_EXTERN) in find_extern_btf_id()
3616 if (btf_is_func(t) && btf_func_linkage(t) != BTF_FUNC_EXTERN) in find_extern_btf_id()
3627 const struct btf_type *t; in find_extern_sec_btf_id() local
3635 t = btf__type_by_id(btf, i); in find_extern_sec_btf_id()
3637 if (!btf_is_datasec(t)) in find_extern_sec_btf_id()
3640 vs = btf_var_secinfos(t); in find_extern_sec_btf_id()
3641 for (j = 0; j < btf_vlen(t); j++, vs++) { in find_extern_sec_btf_id()
3653 const struct btf_type *t; in find_kcfg_type() local
3656 t = skip_mods_and_typedefs(btf, id, NULL); in find_kcfg_type()
3657 name = btf__name_by_offset(btf, t->name_off); in find_kcfg_type()
3661 switch (btf_kind(t)) { in find_kcfg_type()
3663 int enc = btf_int_encoding(t); in find_kcfg_type()
3666 return t->size == 1 ? KCFG_BOOL : KCFG_UNKNOWN; in find_kcfg_type()
3669 if (t->size == 1) in find_kcfg_type()
3671 if (t->size < 1 || t->size > 8 || (t->size & (t->size - 1))) in find_kcfg_type()
3676 if (t->size != 4) in find_kcfg_type()
3686 if (btf_array(t)->nelems == 0) in find_kcfg_type()
3688 if (find_kcfg_type(btf, btf_array(t)->type, NULL) != KCFG_CHAR) in find_kcfg_type()
3719 const struct btf_type *t; in find_int_btf_id() local
3724 t = btf__type_by_id(btf, i); in find_int_btf_id()
3726 if (btf_is_int(t) && btf_int_bits(t) == 32) in find_int_btf_id()
3775 const struct btf_type *t; in bpf_object__collect_externs() local
3824 t = btf__type_by_id(obj->btf, ext->btf_id); in bpf_object__collect_externs()
3825 ext->name = btf__name_by_offset(obj->btf, t->name_off); in bpf_object__collect_externs()
3847 if (btf_is_func(t)) { in bpf_object__collect_externs()
3854 ext->kcfg.sz = btf__resolve_size(obj->btf, t->type); in bpf_object__collect_externs()
3860 ext->kcfg.align = btf__align_of(obj->btf, t->type); in bpf_object__collect_externs()
3866 ext->kcfg.type = find_kcfg_type(obj->btf, t->type, in bpf_object__collect_externs()
3875 skip_mods_and_typedefs(obj->btf, t->type, in bpf_object__collect_externs()
3976 t = btf__type_by_id(obj->btf, vs->type); in bpf_object__collect_externs()
3977 ext_name = btf__name_by_offset(obj->btf, t->name_off); in bpf_object__collect_externs()
3984 btf_var(t)->linkage = BTF_VAR_GLOBAL_ALLOCATED; in bpf_object__collect_externs()
5463 const struct btf_type *t, *local_t; in bpf_core_add_cands() local
5473 t = btf__type_by_id(targ_btf, i); in bpf_core_add_cands()
5474 if (!btf_kind_core_compat(t, local_t)) in bpf_core_add_cands()
5477 targ_name = btf__name_by_offset(targ_btf, t->name_off); in bpf_core_add_cands()
5490 local_name, i, btf_kind_str(t), targ_name, in bpf_core_add_cands()
7566 const struct btf_type *t; in kallsyms_cb() local
7573 t = btf__type_by_id(obj->btf, ext->btf_id); in kallsyms_cb()
7574 if (!btf_is_var(t)) in kallsyms_cb()
7756 const struct btf_type *t; in bpf_object__resolve_ksyms_btf_id() local
7771 t = btf__type_by_id(obj->btf, ext->btf_id); in bpf_object__resolve_ksyms_btf_id()
7772 if (btf_is_var(t)) in bpf_object__resolve_ksyms_btf_id()
9076 const char *libbpf_bpf_attach_type_str(enum bpf_attach_type t) in libbpf_bpf_attach_type_str() argument
9078 if (t < 0 || t >= ARRAY_SIZE(attach_type_name)) in libbpf_bpf_attach_type_str()
9081 return attach_type_name[t]; in libbpf_bpf_attach_type_str()
9084 const char *libbpf_bpf_link_type_str(enum bpf_link_type t) in libbpf_bpf_link_type_str() argument
9086 if (t < 0 || t >= ARRAY_SIZE(link_type_name)) in libbpf_bpf_link_type_str()
9089 return link_type_name[t]; in libbpf_bpf_link_type_str()
9092 const char *libbpf_bpf_map_type_str(enum bpf_map_type t) in libbpf_bpf_map_type_str() argument
9094 if (t < 0 || t >= ARRAY_SIZE(map_type_name)) in libbpf_bpf_map_type_str()
9097 return map_type_name[t]; in libbpf_bpf_map_type_str()
9100 const char *libbpf_bpf_prog_type_str(enum bpf_prog_type t) in libbpf_bpf_prog_type_str() argument
9102 if (t < 0 || t >= ARRAY_SIZE(prog_type_name)) in libbpf_bpf_prog_type_str()
9105 return prog_type_name[t]; in libbpf_bpf_prog_type_str()