diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-10-09 20:30:13 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-10 22:30:16 +0300 |
commit | c9c35995bcf812ee8136f634c25bc6ccc3021d4c (patch) | |
tree | a27745367592357b7ff46ac3253d989f5a3e8129 /tools/bpf/bpftool/main.h | |
parent | f4ac7e0b5cc8d16004ac57ff679266d573f30f77 (diff) | |
download | linux-c9c35995bcf812ee8136f634c25bc6ccc3021d4c.tar.xz |
tools: bpftool: use the kernel's instruction printer
Compile the instruction printer from kernel/bpf and use it
for disassembling "translated" eBPF code.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/bpf/bpftool/main.h')
-rw-r--r-- | tools/bpf/bpftool/main.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h index 85d2d7870a58..8e809b2bb311 100644 --- a/tools/bpf/bpftool/main.h +++ b/tools/bpf/bpftool/main.h @@ -36,11 +36,12 @@ #ifndef __BPF_TOOL_H #define __BPF_TOOL_H +/* BFD and kernel.h both define GCC_VERSION, differently */ +#undef GCC_VERSION #include <stdbool.h> #include <stdio.h> #include <linux/bpf.h> - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) +#include <linux/kernel.h> #define err(msg...) fprintf(stderr, "Error: " msg) #define warn(msg...) fprintf(stderr, "Warning: " msg) @@ -48,11 +49,6 @@ #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) -#define min(a, b) \ - ({ typeof(a) _a = (a); typeof(b) _b = (b); _a > _b ? _b : _a; }) -#define max(a, b) \ - ({ typeof(a) _a = (a); typeof(b) _b = (b); _a < _b ? _b : _a; }) - #define NEXT_ARG() ({ argc--; argv++; if (argc < 0) usage(); }) #define NEXT_ARGP() ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); }) #define BAD_ARG() ({ err("what is '%s'?\n", *argv); -1; }) |