]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Make btf_find_field more generic
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Fri, 15 Apr 2022 16:03:42 +0000 (21:33 +0530)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 21 Apr 2022 14:31:10 +0000 (16:31 +0200)
commit863db08494271a56818c1a74f6edd41fd6601165
treee89277c0f83b906d8dee3457346e962c4f789cb8
parent3124428daa9691b1c83e2dec25c9680132b8a7fa
bpf: Make btf_find_field more generic

Next commit introduces field type 'kptr' whose kind will not be struct,
but pointer, and it will not be limited to one offset, but multiple
ones. Make existing btf_find_struct_field and btf_find_datasec_var
functions amenable to use for finding kptrs in map value, by moving
spin_lock and timer specific checks into their own function.

The alignment, and name are checked before the function is called, so it
is the last point where we can skip field or return an error before the
next loop iteration happens. Size of the field and type is meant to be
checked inside the function.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220415160354.1050687-2-memxor@gmail.com
kernel/bpf/btf.c