Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:btf_get_prog_ctx_type

Proto:static const struct btf_member *btf_get_prog_ctx_type(struct bpf_verifier_log *log, struct btf *btf, const struct btf_type *t, enum bpf_prog_type prog_type)

Type:struct btf_member

Parameter:

TypeParameterName
struct bpf_verifier_log *log
struct btf *btf
const struct btf_type *t
enum bpf_prog_typeprog_type
3486  conv_struct = 't' is written once under lock. Read many times.
3487  If Not conv_struct Then
3488  bpf_log(log, "btf_vmlinux is malformed\n")
3489  Return NULL
3491  t = btf_type_by_id(btf, type)
3492  When btf_type_is_modifier(t) cycle
3493  t = btf_type_by_id(btf, type)
3494  If Not is only a special case of struct:* all its offsetof(member) == 0 Then
3500  bpf_log(log, "BPF program ctx type is not a struct\n")
3501  Return NULL
3503  tname = btf_name_by_offset(btf, name_off)
3504  If Not tname Then
3505  bpf_log(log, "BPF program ctx struct doesn't have a name\n")
3506  Return NULL
3509  ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2
3513  ctx_struct = btf_type_by_id(btf_vmlinux, type)
3514  If Not ctx_struct Then Return NULL
3517  ctx_tname = btf_name_by_offset(btf_vmlinux, name_off)
3518  If Not ctx_tname Then
3520  bpf_log(log, "Please fix kernel include/linux/bpf_types.h\n")
3521  Return NULL
3530  If strcmp(ctx_tname, tname) Then Return NULL
3532  Return ctx_type
Caller
NameDescribe
btf_translate_to_vmlinux
btf_check_func_arg_match