函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\hashtab.c Create Date:2022-07-27 14:25:57
Last Modify:2022-05-23 09:15:29 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

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

函数原型:static int htab_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
822  htab等于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_htab, map)
823  l_new等于NULL
830  如果此条件成立可能性小(为编译器优化)((map_flags & ~spin_lock-ed map_lookup/map_update ) > update existing element )则返回:负EINVAL
834  WARN_ON_ONCE(!_read_lock_held() - might we be in RCU read-side critical section?* If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU* read-side critical section)
836  key_size等于key_size
838  hash等于htab_map_hash(key, key_size, hashrnd)
840  b等于__select_bucket(htab, hash)
841  head等于head
843  如果此条件成立可能性小(为编译器优化)(map_flags & spin_lock-ed map_lookup/map_update )则
844  如果此条件成立可能性小(为编译器优化)(!map_value_has_spin_lock(map))则返回:负EINVAL
847  l_old等于an be called without bucket lock. it will repeat the loop in* the unlikely event when elements moved from one bucket into another* while link list is being walked
849  ret等于check_flags(htab, l_old, map_flags)
850  如果ret则返回:ret
852  如果l_old
857  返回:0
866  raw_spin_lock_irqsave( & lock, flags)
868  l_old等于his lookup function can only be called with bucket lock taken
870  ret等于check_flags(htab, l_old, map_flags)
871  如果ret则转到:err
874  如果此条件成立可能性小(为编译器优化)(l_old && (map_flags & spin_lock-ed map_lookup/map_update ))则
881  copy_map_value_locked(map, key + und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(key_size, 8), value, false)
884  ret等于0
885  转到:err
888  l_new等于alloc_htab_elem(htab, key, value, key_size, hash, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., l_old)
890  如果是错误
892  ret等于错误
893  转到:err
899  hlist_nulls_add_head_rcu*@n: the element to add to the hash list
900  如果l_old
901  hlist_nulls_del_rcu - deletes entry from hash list without re-initialization*@n: the element to delete from the hash list.* Note: hlist_nulls_unhashed() on entry does not return true after this,* the entry is in an undefined state
902  如果非htab_is_prealloc(htab)则free_htab_elem(htab, l_old)
905  ret等于0
906  err :
907  raw_spin_unlock_irqrestore( & lock, flags)
908  返回:ret
调用者
名称描述
bpf_fd_htab_map_update_elemly called from syscall