-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpftool: btf: Support dumping a single type from file #4758
base: bpf-next_base
Are you sure you want to change the base?
bpftool: btf: Support dumping a single type from file #4758
Conversation
Upstream branch: d6212d8 |
Upstream branch: d6212d8 |
7d814f8
to
5edb9b2
Compare
e788156
to
6f73df7
Compare
Upstream branch: 442bc81 |
5edb9b2
to
6fa87b2
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=915643 expired. Closing PR. |
Upstream branch: 4d33dc1 |
6fa87b2
to
4e8a046
Compare
05fce66
to
e666082
Compare
Upstream branch: 6e8ba49 |
The command description was missing the optional argument. Add it there for consistency with the rest of the commands. Signed-off-by: Daniel Xu <[email protected]>
Handle invalid root_type_ids early, as an invalid ID will cause dumpers to half-emit valid boilerplate and then bail with an unclean exit. This is ugly and possibly confusing for users, so preemptively handle the common error case before any dumping begins. Signed-off-by: Daniel Xu <[email protected]>
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 single type by providing an optional root_id argument. 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 <[email protected]>
This commit updates the bash completion script with the new root_id argument. Signed-off-by: Daniel Xu <[email protected]>
4e8a046
to
81a9bab
Compare
Pull request for series with
subject: bpftool: btf: Support dumping a single type from file
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=915544