diff options
author | Jiri Olsa <jolsa@kernel.org> | 2020-08-25 21:21:17 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-08-25 15:37:41 -0700 |
commit | 1c6d28a6ac56de5b0af9239a1b02aea4c3011ea3 (patch) | |
tree | 26bb496869f662a2a271ad0a81028b309fb72ce5 /tools/testing/selftests/bpf/prog_tests/global_data_init.c | |
parent | dafe58fc1917a96c657a0f56a12f262e5d9fb324 (diff) |
bpf: Factor btf_struct_access function
Adding btf_struct_walk function that walks through the
struct type + given offset and returns following values:
enum bpf_struct_walk_result {
/* < 0 error */
WALK_SCALAR = 0,
WALK_PTR,
WALK_STRUCT,
};
WALK_SCALAR - when SCALAR_VALUE is found
WALK_PTR - when pointer value is found, its ID is stored
in 'next_btf_id' output param
WALK_STRUCT - when nested struct object is found, its ID is stored
in 'next_btf_id' output param
It will be used in following patches to get all nested
struct objects for given type and offset.
The btf_struct_access now calls btf_struct_walk function,
as long as it gets nested structs as return value.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200825192124.710397-8-jolsa@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/global_data_init.c')
0 files changed, 0 insertions, 0 deletions