函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\cgroup.c Create Date:2022-07-27 14:45:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: parent has non-overridable prog attached,* disallow attaching new programs to the descendent cgroup.* if parent has overridable or multi-prog, allow attaching

函数原型:static bool hierarchy_allows_attach(struct cgroup *cgrp, enum bpf_attach_type type, u32 new_flags)

返回类型:bool

参数:

类型参数名称
struct cgroup *cgrp
enum bpf_attach_typetype
u32new_flags
114  p等于cgroup_parent(cgrp)
115  如果非p则返回:true
117  循环
118  flags等于flags[type]
121  如果flags按位与BPF_F_ALLOW_MULTI则返回:true
123  cnt等于 number of elements in the list.* it's slow but the list cannot be long
124  WARN_ON_ONCE(cnt > 1)
125  如果cnt恒等于1则返回:非非flags按位与cgroup-bpf attach flags used in BPF_PROG_ATTACH command* NONE(default): No further bpf programs allowed in the subtree的值
127  p等于cgroup_parent(p)
128 p循环
129  返回:true
调用者
名称描述
__cgroup_bpf_attach__cgroup_bpf_attach() - Attach the program to a cgroup, and* propagate the change to descendants*@cgrp: The cgroup which descendants to traverse*@prog: A program to attach*@type: Type of attach operation*@flags: Option flags