Skip to contentSkip to conversation

bpftool: Align dumped file headers with skeletons

RFC PATCH Superseded Francis Laniel 2 participants 4 messages Jul 13, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover bpftool: Align dumped file headers with skeletons

Hi.

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

In this patch, I aligned dumped C file headers with that of skeletons, so the first lines of C dumped files are the following:
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
/* THIS FILE IS AUTOGENERATED BY BPFTOOL! */
#ifndef __VMLINUX_H__
#define __VMLINUX_H__

The goal is to warn users this file must not be edited as it was automatically generated.
Indeed, skeletons also contain the same message.

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.

Change since:
v1:
* Drop command used to generate the file and use the same warning message as skeletons.
* Add SPDX license.

Francis Laniel (1):
bpftool: Align dumped file generated header with skeletons.

 tools/bpf/bpftool/btf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH v2 1/1 bpftool: Align dumped file headers with skeletons.

This commit adds the following lines to file generated by dump:
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ /* THIS FILE IS AUTOGENERATED BY BPFTOOL! */
Hence, the dumped file headers follows that of skeletons.

---
 tools/bpf/bpftool/btf.c | 2 ++
 1 file changed, 2 insertions(+)
tools/bpf/bpftool/btf.c +2 -0
index 7e6accb9d9f7..066a0acd0ecd 100644
@@ -425,6 +425,8 @@ static int dump_btf_c(const struct btf *btf,
 	if (err)
 		return err;
 
+	printf("/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */\n");
+	printf("/* THIS FILE IS AUTOGENERATED BY BPFTOOL! */\n");
 	printf("#ifndef __VMLINUX_H__\n");
 	printf("#define __VMLINUX_H__\n");
 	printf("\n");
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#2 lore raw

Re: [RFC PATCH v2 1/1] bpftool: Align dumped file headers with skeletons.

Quoted 15 lines · Francis Laniel

This commit adds the following lines to file generated by dump:
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ /* THIS FILE IS AUTOGENERATED BY BPFTOOL! */
Hence, the dumped file headers follows that of skeletons.

---
 tools/bpf/bpftool/btf.c | 2 ++
 1 file changed, 2 insertions(+)
tools/bpf/bpftool/btf.c +0 -0
index 7e6accb9d9f7..066a0acd0ecd 100644

tools/bpf/bpftool/btf.c static int dump_btf_c(const struct btf *btf, · line 432

Quoted 8 lines
tools/bpf/bpftool/btf.c +2 -0
@@ -425,6 +425,8 @@ static int dump_btf_c(const struct btf *btf,
 	if (err)
 		return err;
 
+	printf("/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */\n");
+	printf("/* THIS FILE IS AUTOGENERATED BY BPFTOOL! */\n");
 	printf("#ifndef __VMLINUX_H__\n");
 	printf("#define __VMLINUX_H__\n");
 	printf("\n");

Looks good, simpler than v1, thank you!

#3 lore raw

Re: [RFC PATCH v2 1/1] bpftool: Align dumped file headers with skeletons.

Quoted 25 lines · Le mercredi 13 juillet 2022, 15:57:13 CEST Quentin Monnet a écrit :
Quoted 24 lines · Francis Laniel

This commit adds the following lines to file generated by dump:
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ /* THIS FILE IS AUTOGENERATED BY BPFTOOL! */
Hence, the dumped file headers follows that of skeletons.

---

 tools/bpf/bpftool/btf.c | 2 ++
 1 file changed, 2 insertions(+)
tools/bpf/bpftool/btf.c +2 -0
index 7e6accb9d9f7..066a0acd0ecd 100644
@@ -425,6 +425,8 @@ static int dump_btf_c(const struct btf *btf,
 
 	if (err)
 
 		return err;
 
+	printf("/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */\n");
+	printf("/* THIS FILE IS AUTOGENERATED BY BPFTOOL! */\n");
 
Quoted 7 lines

tools/bpf/bpftool/btf.c static int dump_btf_c(const struct btf *btf, · line 432

Quoted 3 lines
tools/bpf/bpftool/btf.c +0 -0
 	printf("#ifndef __VMLINUX_H__\n");
 	printf("#define __VMLINUX_H__\n");
 	printf("\n");

Looks good, simpler than v1, thank you!

Thank you for the review!