Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Check that given struct member is a regular int with expected* offset and size.

Proto:bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s, const struct btf_member *m, u32 expected_offset, u32 expected_size)

Type:bool

Parameter:

TypeParameterName
const struct btf *btf
const struct btf_type *s
const struct btf_member *m
u32expected_offset
u32expected_size
620  id = type
621  t = btf_type_id_size(btf, & id, NULL)
622  If Not t || Not btf_type_is_int(t) Then Return false
625  int_data = btf_type_int(t)
626  nr_bits = BTF_INT_BITS(int_data)
627  If btf_type_kflag(s) Then
628  bitfield_size = If the struct/union type info kind_flag is set, the* following two macros are used to access bitfield_size* and bit_offset from btf_member.offset.(If the type info kind_flag is set, the btf_member offset* contains both member bitfield size and bit offset. The* bitfield size is set for bitfield members. If the type* info kind_flag is not set, the offset contains only bit* offset.)
629  bit_offset = BTF_MEMBER_BIT_OFFSET(If the type info kind_flag is set, the btf_member offset* contains both member bitfield size and bit offset. The* bitfield size is set for bitfield members. If the type* info kind_flag is not set, the offset contains only bit* offset.)
634  Return Not bitfield_size && BITS_ROUNDUP_BYTES(bit_offset) == expected_offset && BITS_ROUNDUP_BYTES(nr_bits) == expected_size
639  If BTF_INT_OFFSET(int_data) || BITS_PER_BYTE_MASKED(If the type info kind_flag is set, the btf_member offset* contains both member bitfield size and bit offset. The* bitfield size is set for bitfield members. If the type* info kind_flag is not set, the offset contains only bit* offset.) || BITS_ROUNDUP_BYTES(If the type info kind_flag is set, the btf_member offset* contains both member bitfield size and bit offset. The* bitfield size is set for bitfield members. If the type* info kind_flag is not set, the offset contains only bit* offset.) != expected_offset || BITS_PER_BYTE_MASKED(nr_bits) || BITS_ROUNDUP_BYTES(nr_bits) != expected_size Then Return false
646  Return true
Caller
NameDescribe
cgroup_storage_check_btf