Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\btf.c Create Date:2022-07-28 13:17:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Resolve the size of a passed-in "type"* return type: type "u32[x][y]", i.e. BTF_KIND_ARRAY,* *type_size: (x * y * sizeof(u32)). Hence, *type_size always* corresponds to the return type.* *elem_type: u32* *total_nelems: (x * y)

Proto:static const struct btf_type *btf_resolve_size(const struct btf *btf, const struct btf_type *type, u32 *type_size, const struct btf_type **elem_type, u32 *total_nelems)

Type:struct btf_type

Parameter:

TypeParameterName
const struct btf *btf
const struct btf_type *type is an array (e.g. u32 array[x][y])
u32 *type_size
const struct btf_type **elem_type
u32 *total_nelems
1065  const struct btf_type * array_type = NULL
1067  nelems = 1
1069  When i < MAX_RESOLVE_DEPTH cycle
1072  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Integer
1073  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Struct
1074  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Union
1076  size = size
1077  Go to resolved
1080  size = size of *
1081  Go to resolved
1084  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Typedef
1085  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Volatile
1086  Case BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Const
1089  Break
1095  If nelems && nelems > U32_MAX / nelems Then Return ERR_PTR( - EINVAL)
1097  nelems *= nelems
1099  Break
1102  Default
1103  Return ERR_PTR( - EINVAL)
1107  Return ERR_PTR( - EINVAL)
1109  resolved :
1110  If nelems && size > U32_MAX / nelems Then Return ERR_PTR( - EINVAL)
1113  type_size = nelems * size
1114  total_nelems = nelems
1115  elem_type = is an array (e.g. u32 array[x][y])
1117  Return If array_type Else is an array (e.g. u32 array[x][y])
Caller
NameDescribe
btf_struct_access