Function report |
Source Code:kernel\bpf\syscall.c |
Create Date:2022-07-28 12:52:38 |
Last Modify:2022-05-19 18:06:12 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:map_update_elem
Proto:static int map_update_elem(union bpf_attr *attr)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
union bpf_attr * | attr |
949 | __user * ukey = u64_to_user_ptr(key) |
950 | __user * uvalue = u64_to_user_ptr(value) |
958 | If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_UPDATE_ELEM) Then Return -EINVAL |
962 | map = error is returned, fd is released.* On success caller should complete fd access with matching fdput() |
965 | If Not (map_get_sys_perms(map, f) & Has write method(s) ) Then |
970 | If flags & spin_lock-ed map_lookup/map_update && Not map_value_has_spin_lock(map) Then |
976 | key = __bpf_copy_key(ukey, key_size) |
987 | Else value_size = value_size |
991 | value = Allocation memory |
996 | If copy_from_user(value, uvalue, value_size) != 0 Then Go to free_value |
1000 | If bpf_map_is_dev_bound(map) Then |
1003 | Else if map_type == BPF_MAP_TYPE_CPUMAP || map_type == BPF_MAP_TYPE_SOCKHASH || map_type == BPF_MAP_TYPE_SOCKMAP Then |
1008 | Else if IS_FD_PROG_ARRAY(map) Then |
1009 | err = ly called from syscall |
1011 | Go to out |
1019 | If map_type == BPF_MAP_TYPE_PERCPU_HASH || map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH Then |
1022 | Else if map_type == BPF_MAP_TYPE_PERCPU_ARRAY Then |
1024 | Else if map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE Then |
1027 | Else if IS_FD_ARRAY(map) Then |
1029 | err = ly called from syscall |
1032 | Else if map_type == BPF_MAP_TYPE_HASH_OF_MAPS Then |
1034 | err = ly called from syscall |
1037 | Else if map_type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY Then |
1041 | Else if map_type == BPF_MAP_TYPE_QUEUE || map_type == BPF_MAP_TYPE_STACK Then |
1043 | err = map_push_elem(map, value, flags) |
1044 | Else |
1050 | preempt_enable() |
1051 | maybe_wait_bpf_programs(map) |
1052 | out : |
1053 | free_value : |
1055 | free_key : |
1057 | err_put : |
1059 | Return err |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |