aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/main.h
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2017-10-24 20:11:28 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-26 17:52:59 +0900
commit3fc27b71b894f5e2ad611297d5817b6092c96626 (patch)
tree874ab256c51d7e7372d05a4a81f5eed6c85eb5a6 /tools/bpf/bpftool/main.h
parenttipc: fix a dangling pointer (diff)
downloadlinux-dev-3fc27b71b894f5e2ad611297d5817b6092c96626.tar.xz
linux-dev-3fc27b71b894f5e2ad611297d5817b6092c96626.zip
tools: bpftool: try to mount bpffs if required for pinning objects
One possible cause of failure for `bpftool {prog|map} pin * file FILE` is the FILE not being in an eBPF virtual file system (bpffs). In this case, make bpftool attempt to mount bpffs on the parent directory of the FILE. Then, if this operation is successful, try again to pin the object. The code for mnt_bpffs() is a copy of function bpf_mnt_fs() from iproute2 package (under lib/bpf.c, taken at commit 4b73d52f8a81), with modifications regarding handling of error messages. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--tools/bpf/bpftool/main.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index 2f94bed03a8d..d315d01be645 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -51,6 +51,8 @@
#define NEXT_ARGP() ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); })
#define BAD_ARG() ({ p_err("what is '%s'?\n", *argv); -1; })
+#define ERR_MAX_LEN 1024
+
#define BPF_TAG_FMT "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
#define HELP_SPEC_PROGRAM \