summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/Documentation/bpftool-gen.rst
diff options
context:
space:
mode:
authorKui-Feng Lee <thinker.li@gmail.com>2024-02-29 09:45:21 +0300
committerAndrii Nakryiko <andrii@kernel.org>2024-03-01 01:23:53 +0300
commita7b0fa352eafef95bd0d736ca94965d3f884ad18 (patch)
treeed6217fb23ed793a284adf35e6b749505e0acdea /tools/bpf/bpftool/Documentation/bpftool-gen.rst
parent69e4a9d2b3f5adf5af4feeab0a9f505da971265a (diff)
downloadlinux-a7b0fa352eafef95bd0d736ca94965d3f884ad18.tar.xz
bpftool: Generated shadow variables for struct_ops maps.
Declares and defines a pointer of the shadow type for each struct_ops map. The code generator will create an anonymous struct type as the shadow type for each struct_ops map. The shadow type is translated from the original struct type of the map. The user of the skeleton use pointers of them to access the values of struct_ops maps. However, shadow types only supports certain types of fields, including scalar types and function pointers. Any fields of unsupported types are translated into an array of characters to occupy the space of the original field. Function pointers are translated into pointers of the struct bpf_program. Additionally, padding fields are generated to occupy the space between two consecutive fields. The pointers of shadow types of struct_osp maps are initialized when *__open_opts() in skeletons are called. For a map called FOO, the user can access it through the pointer at skel->struct_ops.FOO. Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/bpf/20240229064523.2091270-4-thinker.li@gmail.com
Diffstat (limited to 'tools/bpf/bpftool/Documentation/bpftool-gen.rst')
0 files changed, 0 insertions, 0 deletions