bpf: Refactor map->off_arr handling
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 3 Nov 2022 19:09:57 +0000 (00:39 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Nov 2022 06:09:40 +0000 (23:09 -0700)
commitf71b2f64177a199d5b1d2047e155d45fd98f564a
treefe7cc4acbb4c5430be7b0dd16f129a2714be36a2
parentdb559117828d2448fe81ada051c60bcf39f822e9
bpf: Refactor map->off_arr handling

Refactor map->off_arr handling into generic functions that can work on
their own without hardcoding map specific code. The btf_fields_offs
structure is now returned from btf_parse_field_offs, which can be reused
later for types in program BTF.

All functions like copy_map_value, zero_map_value call generic
underlying functions so that they can also be reused later for copying
to values allocated in programs which encode specific fields.

Later, some helper functions will also require access to this
btf_field_offs structure to be able to skip over special fields at
runtime.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20221103191013.1236066-9-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
include/linux/btf.h
kernel/bpf/btf.c
kernel/bpf/syscall.c