函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Called from syscall or from eBPF program

函数原型:static int array_map_update_elem(struct bpf_map *map, void *key, void *value, u64 map_flags)

返回类型:int

参数:

类型参数名称
struct bpf_map *map
void *key
void *value
u64map_flags
301  array等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(map, structbpf_array, map)
302  index等于key
305  如果此条件成立可能性小(为编译器优化)((map_flags & ~spin_lock-ed map_lookup/map_update ) > update existing element )则返回:负EINVAL
309  如果此条件成立可能性小(为编译器优化)(index >= max_entries)则返回:负E2BIG
313  如果此条件成立可能性小(为编译器优化)(map_flags & create new element if it didn't exist )则返回:负EEXIST
317  如果此条件成立可能性小(为编译器优化)((map_flags & spin_lock-ed map_lookup/map_update ) && !map_value_has_spin_lock(map))则返回:负EINVAL
321  如果map_type恒等于BPF_MAP_TYPE_PERCPU_ARRAY
322  内存复制(this_cpu_ptr(pptrs[index & index_mask]), value, value_size)
324  否则
325  val等于valueelem_sizeindex按位与index_mask的值
327  如果map_flags按位与spin_lock-ed map_lookup/map_update copy_map_value_locked(map, val, value, false)
329  否则py everything but bpf_spin_lock
332  返回:0