函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__cgroup_bpf_detach() - Detach the program from a cgroup, and* propagate the change to descendants*@cgrp: The cgroup which descendants to traverse*@prog: A program to detach or NULL*@type: Type of detach operation* Must be called with cgroup_mutex held.

函数原型:int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, enum bpf_attach_type type)

返回类型:int

参数:

类型参数名称
struct cgroup *cgrp
struct bpf_prog *prog
enum bpf_attach_typetype
430  progs等于 attached progs to this cgroup and attach flags * when flags == 0 or BPF_F_ALLOW_OVERRIDE the progs list will * have either zero or one element * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS[type]
432  flags等于flags[type]
433  struct bpf_prog * old_prog = NULL
437  如果flags按位与BPF_F_ALLOW_MULTI
438  如果非prog则返回:负EINVAL
443  否则
444  如果链表为空则返回:负ENOENT
449  如果flags按位与BPF_F_ALLOW_MULTI
452  如果prog不等于prog则继续下一循环
454  old_prog等于prog
458  prog = NULL
459  退出
461  如果非old_prog则返回:负ENOENT
463  否则
467  pl等于list_first_entry - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.* Note, that list is expected to be not empty.(progs, typeof( * pl), node)
468  old_prog等于prog
469  prog = NULL
472  err等于update_effective_progs(cgrp, type)
473  如果err则转到:cleanup
477  删除链表项
479  bpf_cgroup_storage_unlink(storage[stype])
480  bpf_cgroup_storage_free(storage[stype])
482  kfree(pl)
483  如果链表为空flags[type]等于0
487  bpf_prog_put(old_prog)
488  static_branch_dec( & cgroup_bpf_enabled_key)
489  返回:0
491  cleanup :
493  prog等于old_prog
494  返回:err
调用者
名称描述
cgroup_bpf_detach