bpftool: Generalize light skeleton generation.
authorAlexei Starovoitov <ast@kernel.org>
Wed, 9 Feb 2022 23:19:59 +0000 (15:19 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 10 Feb 2022 22:31:51 +0000 (23:31 +0100)
commit28d743f671272d7a5f676669c84438b0f9600936
tree86891c77ace34b50a56a477498b942b9f23244ce
parent6fe65f1b4db3fff305896e997c2804b7b42236ce
bpftool: Generalize light skeleton generation.

Generealize light skeleton by hiding mmap details in skel_internal.h
In this form generated lskel.h is usable both by user space and by the kernel.

Note that previously #include <bpf/bpf.h> was in *.lskel.h file.
To avoid #ifdef-s in a generated lskel.h the include of bpf.h is moved
to skel_internal.h, but skel_internal.h is also used by gen_loader.c
which is part of libbpf. Therefore skel_internal.h does #include "bpf.h"
in case of user space, so gen_loader.c and lskel.h have necessary definitions.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220209232001.27490-4-alexei.starovoitov@gmail.com
tools/bpf/bpftool/gen.c