**bpftool** [*OPTIONS*] **map** *COMMAND*
- *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] }
+ *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } }
*COMMANDS* :=
{ **show** | **dump** | **update** | **lookup** | **getnext** | **delete**
-p, --pretty
Generate human-readable JSON output. Implies **-j**.
+ -f, --bpffs
+ Show file names of pinned maps.
+
EXAMPLES
========
**# bpftool map show**
**bpftool** [*OPTIONS*] **prog** *COMMAND*
- *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] }
+ *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } }
*COMMANDS* :=
{ **show** | **dump xlated** | **dump jited** | **pin** | **help** }
-p, --pretty
Generate human-readable JSON output. Implies **-j**.
+ -f, --bpffs
+ Show file names of pinned programs.
+
EXAMPLES
========
**# bpftool prog show**
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;
{ "help", no_argument, NULL, 'h' },
{ "pretty", no_argument, NULL, 'p' },
{ "version", no_argument, NULL, 'V' },
+ { "bpffs", no_argument, NULL, 'f' },
{ 0 }
};
int opt, ret;
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':
case 'j':
json_output = true;
break;
+ case 'f':
+ show_pinned = true;
+ break;
default:
usage();
}
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;
}
#define HELP_SPEC_PROGRAM \
"PROG := { id PROG_ID | pinned FILE | tag PROG_TAG }"
#define HELP_SPEC_OPTIONS \
- "OPTIONS := { {-j|--json} [{-p|--pretty}] }"
+ "OPTIONS := { {-j|--json} [{-p|--pretty}] | {-f|--bpffs} }"
enum bpf_obj_type {
BPF_OBJ_UNKNOWN,
extern json_writer_t *json_wtr;
extern bool json_output;
+extern bool show_pinned;
extern struct pinned_obj_table prog_table;
extern struct pinned_obj_table map_table;
int err;
int fd;
- build_pinned_obj_table(&map_table, BPF_OBJ_MAP);
+ if (show_pinned)
+ build_pinned_obj_table(&map_table, BPF_OBJ_MAP);
if (argc == 2) {
fd = map_parse_fd_and_info(&argc, &argv, &info, &len);
int err;
int fd;
- build_pinned_obj_table(&prog_table, BPF_OBJ_PROG);
+ if (show_pinned)
+ build_pinned_obj_table(&prog_table, BPF_OBJ_PROG);
if (argc == 2) {
fd = prog_parse_fd(&argc, &argv);