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

From: Francis Laniel
Date: Tue Jul 12 2022 - 14:46:19 EST


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
--
2.25.1