lkml.org 
[lkml]   [2019]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH bpf-next v1 7/7] tools: bpftool: add error message on map pinning failure
Date
From: Alban Crequy <alban@kinvolk.io>

Symptoms, when "dir" does not exist:

$ sudo bpftool map create /sys/fs/bpf/dir/fooB type hash key 8 value 8 entries 8 name fooB flags 1
$ echo $?
255

This patch prints an error message when the map pinning fails.

Signed-off-by: Alban Crequy <alban@kinvolk.io>
---
tools/bpf/bpftool/map.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 9befcabc299d..c825eb1bbf8f 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -1305,8 +1305,10 @@ static int do_create(int argc, char **argv)

err = do_pin_fd(fd, pinfile);
close(fd);
- if (err)
+ if (err) {
+ p_err("failed to pin map to %s", pinfile);
return err;
+ }

if (json_output)
jsonw_null(json_wtr);
--
2.20.1
\
 
 \ /
  Last update: 2019-03-20 18:36    [W:0.094 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site