]> git.baikalelectronics.ru Git - kernel.git/commit
tools: bpftool: try to mount bpffs if required for pinning objects
authorQuentin Monnet <quentin.monnet@netronome.com>
Wed, 25 Oct 2017 03:11:28 +0000 (20:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Oct 2017 08:52:59 +0000 (17:52 +0900)
commit156aa8c1bcfd35726fa099b2f11d0e396ae76215
tree874ab256c51d7e7372d05a4a81f5eed6c85eb5a6
parent42eb564d0da365a9a96d84cd2698c515f7dbd4ea
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>
tools/bpf/bpftool/common.c
tools/bpf/bpftool/main.h