On Tue, Feb 8, 2022 at 9:43 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > Prepare light skeleton to be used in the kernel module and in the user space. > The look and feel of lskel.h is mostly the same with the difference that for > user space the skel->rodata is the same pointer before and after skel_load > operation, while in the kernel the skel->rodata after skel_open and the > skel->rodata after skel_load are different pointers. > Typical usage of skeleton remains the same for kernel and user space: > skel = my_bpf__open(); > skel->rodata->my_global_var = init_val; > err = my_bpf__load(skel); > err = my_bpf__attach(skel); > // access skel->rodata->my_global_var; > // access skel->bss->another_var; > > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> > --- I like Yonghong's suggestion to remove unnecessary function, but LGTM either way Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > tools/lib/bpf/gen_loader.c | 15 ++- > tools/lib/bpf/skel_internal.h | 195 ++++++++++++++++++++++++++++++---- > 2 files changed, 189 insertions(+), 21 deletions(-) > [...]