libbpf: Allow version suffixes (___smth) for struct_ops types
authorEduard Zingerman <eddyz87@gmail.com>
Wed, 6 Mar 2024 10:45:15 +0000 (12:45 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 6 Mar 2024 23:18:15 +0000 (15:18 -0800)
commita2a5172cf1eb39472bd2038079f65c6f676906a5
tree8fa10eaa502c527a8572b6c89958e9e06d1fd0e9
parent0f79bb8987a5c483362dc12d58b221a1a1c45578
libbpf: Allow version suffixes (___smth) for struct_ops types

E.g. allow the following struct_ops definitions:

    struct bpf_testmod_ops___v1 { int (*test)(void); };
    struct bpf_testmod_ops___v2 { int (*test)(void); };

    SEC(".struct_ops.link")
    struct bpf_testmod_ops___v1 a = { .test = ... }
    SEC(".struct_ops.link")
    struct bpf_testmod_ops___v2 b = { .test = ... }

Where both bpf_testmod_ops__v1 and bpf_testmod_ops__v2 would be
resolved as 'struct bpf_testmod_ops' from kernel BTF.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: David Vernet <void@manifault.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240306104529.6453-2-eddyz87@gmail.com
tools/lib/bpf/libbpf.c