tools: bpftool: optionally show filenames of pinned objects
Making it optional to show file names of pinned objects because it scans complete bpf-fs filesystem which is costly. Added option -f|--bpffs. Documentation updated. Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
4990f1f461
commit
c541b73466
@@ -54,6 +54,7 @@ static int (*last_do_help)(int argc, char **argv);
|
||||
json_writer_t *json_wtr;
|
||||
bool pretty_output;
|
||||
bool json_output;
|
||||
bool show_pinned;
|
||||
struct pinned_obj_table prog_table;
|
||||
struct pinned_obj_table map_table;
|
||||
|
||||
@@ -265,6 +266,7 @@ int main(int argc, char **argv)
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "pretty", no_argument, NULL, 'p' },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "bpffs", no_argument, NULL, 'f' },
|
||||
{ 0 }
|
||||
};
|
||||
int opt, ret;
|
||||
@@ -272,12 +274,13 @@ int main(int argc, char **argv)
|
||||
last_do_help = do_help;
|
||||
pretty_output = false;
|
||||
json_output = false;
|
||||
show_pinned = false;
|
||||
bin_name = argv[0];
|
||||
|
||||
hash_init(prog_table.table);
|
||||
hash_init(map_table.table);
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "Vhpj",
|
||||
while ((opt = getopt_long(argc, argv, "Vhpjf",
|
||||
options, NULL)) >= 0) {
|
||||
switch (opt) {
|
||||
case 'V':
|
||||
@@ -290,6 +293,9 @@ int main(int argc, char **argv)
|
||||
case 'j':
|
||||
json_output = true;
|
||||
break;
|
||||
case 'f':
|
||||
show_pinned = true;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@@ -316,8 +322,10 @@ int main(int argc, char **argv)
|
||||
if (json_output)
|
||||
jsonw_destroy(&json_wtr);
|
||||
|
||||
delete_pinned_obj_table(&prog_table);
|
||||
delete_pinned_obj_table(&map_table);
|
||||
if (show_pinned) {
|
||||
delete_pinned_obj_table(&prog_table);
|
||||
delete_pinned_obj_table(&map_table);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user