2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/tools/bpf/bpftool/Documentation
Daniel Xu a812d92ed2 bpftool: btf: Support dumping a specific types from file
Some projects, for example xdp-tools [0], prefer to check in a minimized
vmlinux.h rather than the complete file which can get rather large.

However, when you try to add a minimized version of a complex struct (eg
struct xfrm_state), things can get quite complex if you're trying to
manually untangle and deduplicate the dependencies.

This commit teaches bpftool to do a minimized dump of a specific types by
providing a optional root_id argument(s).

Example usage:

    $ ./bpftool btf dump file ~/dev/linux/vmlinux | rg "STRUCT 'xfrm_state'"
    [12643] STRUCT 'xfrm_state' size=912 vlen=58

    $ ./bpftool btf dump file ~/dev/linux/vmlinux root_id 12643 format c
    #ifndef __VMLINUX_H__
    #define __VMLINUX_H__

    [..]

    struct xfrm_type_offload;

    struct xfrm_sec_ctx;

    struct xfrm_state {
            possible_net_t xs_net;
            union {
                    struct hlist_node gclist;
                    struct hlist_node bydst;
            };
            union {
                    struct hlist_node dev_gclist;
                    struct hlist_node bysrc;
            };
            struct hlist_node byspi;
    [..]

[0]: https://github.com/xdp-project/xdp-tools/blob/master/headers/bpf/vmlinux.h

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/04feb860c0a56a7da66f923551484e1483a72074.1734119028.git.dxu@dxuuu.xyz
2024-12-13 14:35:42 -08:00
..
bpftool-btf.rst bpftool: btf: Support dumping a specific types from file 2024-12-13 14:35:42 -08:00
bpftool-cgroup.rst bpftool: Update documentation where progs/maps can be passed by name 2024-04-16 17:58:25 +02:00
bpftool-feature.rst bpftool: Remove useless emphasis on command description in man pages 2024-04-02 15:50:23 +02:00
bpftool-gen.rst bpftool: Fix typos 2024-09-09 15:57:52 -07:00
bpftool-iter.rst bpftool: Clean-up typos, punctuation, list formatting in docs 2024-04-02 15:50:23 +02:00
bpftool-link.rst bpftool: Remove useless emphasis on command description in man pages 2024-04-02 15:50:23 +02:00
bpftool-map.rst bpftool: Remove useless emphasis on command description in man pages 2024-04-02 15:50:23 +02:00
bpftool-net.rst bpftool: Add missing blank lines in bpftool-net doc example 2024-09-02 18:25:16 +02:00
bpftool-perf.rst bpftool: Remove useless emphasis on command description in man pages 2024-04-02 15:50:23 +02:00
bpftool-prog.rst bpftool: Update documentation where progs/maps can be passed by name 2024-04-16 17:58:25 +02:00
bpftool-struct_ops.rst bpftool: Remove useless emphasis on command description in man pages 2024-04-02 15:50:23 +02:00
bpftool.rst bpftool: Use simpler indentation in source rST for documentation 2024-04-02 15:50:23 +02:00
common_options.rst bpftool: Use simpler indentation in source rST for documentation 2024-04-02 15:50:23 +02:00
Makefile bpftool: Use simpler indentation in source rST for documentation 2024-04-02 15:50:23 +02:00
substitutions.rst bpftool: remove support of --legacy option for bpftool 2022-11-20 16:17:46 -08:00