diff options
author | Joe Stringer <joe@ovn.org> | 2017-01-22 20:11:25 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-01-26 09:42:58 -0500 |
commit | e28ff1a8382ee02b10cf11cf3b48541dc3d14a58 (patch) | |
tree | 7b2e4fbf719f7c62f506e2d19f5aca86597d0337 /tools/lib/bpf/libbpf.h | |
parent | 7803ba73099867d1f6ca866857277d92e0da4080 (diff) |
tools lib bpf: Add libbpf_get_error()
This function will turn a libbpf pointer into a standard error code (or
0 if the pointer is valid).
This also allows removal of the dependency on linux/err.h in the public
header file, which causes problems in userspace programs built against
libbpf.
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20170123011128.26534-5-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
-rw-r--r-- | tools/lib/bpf/libbpf.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index 2188ccdc0e2d..4014d1ba5e3d 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #define __BPF_LIBBPF_H | 22 | #define __BPF_LIBBPF_H |
23 | 23 | ||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <stdint.h> | ||
25 | #include <stdbool.h> | 26 | #include <stdbool.h> |
26 | #include <linux/err.h> | ||
27 | #include <sys/types.h> // for size_t | 27 | #include <sys/types.h> // for size_t |
28 | 28 | ||
29 | enum libbpf_errno { | 29 | enum libbpf_errno { |
@@ -234,4 +234,6 @@ int bpf_map__set_priv(struct bpf_map *map, void *priv, | |||
234 | bpf_map_clear_priv_t clear_priv); | 234 | bpf_map_clear_priv_t clear_priv); |
235 | void *bpf_map__priv(struct bpf_map *map); | 235 | void *bpf_map__priv(struct bpf_map *map); |
236 | 236 | ||
237 | long libbpf_get_error(const void *ptr); | ||
238 | |||
237 | #endif | 239 | #endif |