Function report |
Source Code:kernel\bpf\syscall.c |
Create Date:2022-07-28 12:52:28 |
Last Modify:2022-05-19 18:06:12 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:map_lookup_elem
Proto:static int map_lookup_elem(union bpf_attr *attr)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
union bpf_attr * | attr |
814 | __user * ukey = u64_to_user_ptr(key) |
815 | __user * uvalue = u64_to_user_ptr(value) |
823 | If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_LOOKUP_ELEM) Then Return -EINVAL |
826 | If flags & ~spin_lock-ed map_lookup/map_update Then Return -EINVAL |
830 | map = error is returned, fd is released.* On success caller should complete fd access with matching fdput() |
833 | If Not (map_get_sys_perms(map, f) & Has read method(s) ) Then |
838 | If flags & spin_lock-ed map_lookup/map_update && Not map_value_has_spin_lock(map) Then |
844 | key = __bpf_copy_key(ukey, key_size) |
855 | Else if IS_FD_MAP(map) Then value_size = sizeof(u32) |
857 | Else value_size = value_size |
861 | value = Allocation memory |
865 | If bpf_map_is_dev_bound(map) Then |
872 | If map_type == BPF_MAP_TYPE_PERCPU_HASH || map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH Then |
874 | err = bpf_percpu_hash_copy(map, key, value) |
875 | Else if map_type == BPF_MAP_TYPE_PERCPU_ARRAY Then |
876 | err = bpf_percpu_array_copy(map, key, value) |
877 | Else if map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE Then |
878 | err = bpf_percpu_cgroup_storage_copy(map, key, value) |
879 | Else if map_type == BPF_MAP_TYPE_STACK_TRACE Then |
880 | err = bpf_stackmap_copy(map, key, value) |
881 | Else if IS_FD_ARRAY(map) || IS_FD_PROG_ARRAY(map) Then |
882 | err = ly called from syscall |
883 | Else if IS_FD_HASH(map) Then |
884 | err = ly called from syscall |
885 | Else if map_type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY Then |
886 | err = bpf_fd_reuseport_array_lookup_elem(map, key, value) |
887 | Else if map_type == BPF_MAP_TYPE_QUEUE || map_type == BPF_MAP_TYPE_STACK Then |
889 | err = map_peek_elem(map, value) |
890 | Else |
892 | If map_lookup_elem_sys_only Then ptr = map_lookup_elem_sys_only(map, key) |
894 | Else ptr = map_lookup_elem(map, key) |
898 | Else if Not ptr Then |
900 | Else |
901 | err = 0 |
902 | If flags & spin_lock-ed map_lookup/map_update Then copy_map_value_locked(map, value, ptr, true) |
905 | Else py everything but bpf_spin_lock |
908 | check_and_init_map_lock(map, value) |
913 | preempt_enable() |
915 | done : |
916 | If err Then Go to free_value |
920 | If copy_to_user(uvalue, value, value_size) != 0 Then Go to free_value |
923 | err = 0 |
925 | free_value : |
927 | free_key : |
929 | err_put : |
931 | 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 |