Enables header guards generation for BTF dumps in C format, e.g. vmlinux.h would be printed as follows: ... #ifndef _UAPI_LINUX_TCP_H enum { TCP_NO_QUEUE = 0, TCP_RECV_QUEUE = 1, TCP_SEND_QUEUE = 2, TCP_QUEUES_NR = 3, }; #endif /* _UAPI_LINUX_TCP_H */ ... Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx> --- tools/bpf/bpftool/btf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index 68a70ac03c80..f8e8946b61a7 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -466,7 +466,9 @@ static int dump_btf_c(const struct btf *btf, struct btf_dump *d; int err = 0, i; - d = btf_dump__new(btf, btf_dump_printf, NULL, NULL); + LIBBPF_OPTS(btf_dump_opts, opts); + opts.emit_header_guards = true; + d = btf_dump__new(btf, btf_dump_printf, NULL, &opts); err = libbpf_get_error(d); if (err) return err; -- 2.34.1