veristat: relicense veristat.c as dual GPL-2.0-only or BSD-2-Clause licensed
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/2 veristat: relicense veristat.c as dual GPL-2.0-only or BSD-2-Clause licensed
Dual-license veristat.c to dual GPL-2.0-only or BSD-2-Clause license. This is needed to mirror it to Github to make it convenient for distro packagers to package veristat as a separate package.
Veristat grew into a useful tool by itself, and there are already a bunch of users relying on veristat as generic BPF loading and verification helper tool. So making it easy to packagers by providing Github mirror just like we do for bpftool and libbpf is the next step to get veristat into the hands of users.
Apart from few typo fixes, I'm the sole contributor to veristat.c so far, so no extra Acks should be needed for relicensing.
--- tools/testing/selftests/bpf/veristat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/veristat.c +1 -1
@@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #define _GNU_SOURCE#include <argp.h>
Signature · 1 line
2.34.1
Andrii Nakryiko
maintainerPATCH 2/2 veristat: improve version reporting
For packaging version of the tool is important, so add a simple way to specify veristat version for upstream mirror at Github.
--- tools/testing/selftests/bpf/veristat.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/veristat.c +17 -2
@@ -140,6 +140,7 @@ static struct env {bool quiet;int log_level;enum resfmt out_fmt; +bool show_version;bool comparison_mode;bool replay_mode;
@@ -176,16 +177,22 @@ static int libbpf_print_fn(enum libbpf_print_level level, const char *format, vareturn vfprintf (stderr, format, args); } -const char *argp_program_version ="veristat" ; +#ifndef VERISTAT_VERSION +#define VERISTAT_VERSION "<kernel>" +#endif + +const char *argp_program_version ="veristat v" VERISTAT_VERSION ;const char *argp_program_bug_address ="<[email protected]>" ;const char argp_program_doc[] ="veristat BPF verifier stats collection and comparison tool.\n" "\n" "USAGE: veristat <obj-file> [<obj-file>...]\n" -" OR: veristat -C <baseline.csv> <comparison.csv>\n" ; +" OR: veristat -C <baseline.csv> <comparison.csv>\n" +" OR: veristat -R <results.csv>\n" ;static const struct argp_option opts[] = { {NULL ,'h' ,NULL ,OPTION_HIDDEN ,"Show the full help" }, + {"version" ,'V' ,NULL ,0 ,"Print version" }, {"verbose" ,'v' ,NULL ,0 ,"Verbose mode" }, {"log-level" ,'l' ,"LEVEL" ,0 ,"Verifier log level (default 0 for normal mode, 1 for verbose mode)" }, {"debug" ,'d' ,NULL ,0 ,"Debug mode (turns on libbpf debug logging)" },
@@ -212,6 +219,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)case 'h' :argp_state_help (state, stderr,ARGP_HELP_STD_HELP );break ; +case 'V' : + env.show_version = true; +break ;case 'v' : env.verbose = true;break ;
@@ -1991,6 +2001,11 @@ int main(int argc, char **argv)if (argp_parse (&argp, argc, argv,0 ,NULL ,NULL ))return 1 ; +if (env.show_version) { +printf ("%s\n" , argp_program_version); +return 0 ; + } +if (env.verbose && env.quiet) {fprintf (stderr,"Verbose and quiet modes are incompatible, please specify just one or neither!\n\n" );argp_help (&argp, stderr,ARGP_HELP_USAGE ,"veristat" );
Signature · 1 line
2.34.1