Skip to content

RFC bpftool: Add generating command to C dumped file.

Francis Laniel bpf lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1bpftool: Add generating command to C dumped file.tools/bpf/bpftool/btf.c+14 -22 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH v1 0/1] bpftool: Add generating command to C dumped file.

Hi.

First, I hope you are fine and the same for your relatives.

In this patch, I added the command used to generate a BTF dump at the top of the dump when outputting to C:
/*
* File generated by bpftool using:
* bpftool btf dump file /sys/kernel/btf/vmlinux format c
* DO NOT EDIT.
*/

The goal of this is to first warn users this file must not be edited and also to document the command used to get it.
The idea was gathered from a message posted on iovisor/bcc repository and from message written by bpf2go when it generates a file [1, 2].

This patch is clearly not a big change which impacts the future of bpftool but I think it could be welcomed.
If you see any way to improve it or have any question, feel free to ask.

Francis Laniel (1):
bpftool: Add generating command to dumped file.

 tools/bpf/bpftool/btf.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Best regards and thank you in advance.
---
[1] https://github.com/iovisor/bcc/pull/4088#pullrequestreview-1032543916
[2] https://github.com/cilium/ebpf/blob/951bb28908d23e50fca063a2d51098ca028352bf/cmd/bpf2go/output.go#L21

Signature · 1 line
2.25.1