tools: bpftool: fix plain output and doc for --bpffs option
authorQuentin Monnet <quentin.monnet@netronome.com>
Thu, 8 Nov 2018 11:52:26 +0000 (11:52 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 9 Nov 2018 07:20:52 +0000 (08:20 +0100)
Edit the documentation of the -f|--bpffs option to make it explicit that
it dumps paths of pinned programs when bpftool is used to list the
programs only, so that users do not believe they will see the name of
the newly pinned program with "bpftool prog pin" or "bpftool prog load".

Also fix the plain output: do not add a blank line after each program
block, in order to remain consistent with what bpftool does when the
option is not passed.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/Documentation/bpftool-prog.rst
tools/bpf/bpftool/prog.c

index ac4e904b10fbd9b4b504d943f62aef0be68f0829..81fb97acfaeb4be8a8b8d3d0e620f22351617105 100644 (file)
@@ -124,7 +124,8 @@ OPTIONS
                  Generate human-readable JSON output. Implies **-j**.
 
        -f, --bpffs
-                 Show file names of pinned programs.
+                 When showing BPF programs, show file names of pinned
+                 programs.
 
 EXAMPLES
 ========
index 5302ee282409eb039458447ad40215f24516c48a..9785244acc7bea415c7729a70179d40e64347081 100644 (file)
@@ -357,10 +357,9 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
        if (!hash_empty(prog_table.table)) {
                struct pinned_obj *obj;
 
-               printf("\n");
                hash_for_each_possible(prog_table.table, obj, hash, info->id) {
                        if (obj->id == info->id)
-                               printf("\tpinned %s\n", obj->path);
+                               printf("\n\tpinned %s", obj->path);
                }
        }