aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/main.h
diff options
context:
space:
mode:
authorQuentin Monnet <quentin@isovalent.com>2020-05-11 17:15:33 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2020-05-11 21:20:46 +0200
commit6e7e034e88e8e22cb14765c86da92416017e45b8 (patch)
treea51838934255b07523f0eaf6517713ff7c92a99f /tools/bpf/bpftool/main.h
parentbpf, libbpf: Replace zero-length array with flexible-array (diff)
downloadlinux-dev-6e7e034e88e8e22cb14765c86da92416017e45b8.tar.xz
linux-dev-6e7e034e88e8e22cb14765c86da92416017e45b8.zip
tools, bpftool: Poison and replace kernel integer typedefs
Replace the use of kernel-only integer typedefs (u8, u32, etc.) by their user space counterpart (__u8, __u32, etc.). Similarly to what libbpf does, poison the typedefs to avoid introducing them again in the future. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200511161536.29853-2-quentin@isovalent.com
Diffstat (limited to 'tools/bpf/bpftool/main.h')
-rw-r--r--tools/bpf/bpftool/main.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index a41cefabccaf..f89ac70ef973 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -18,6 +18,9 @@
#include "json_writer.h"
+/* Make sure we do not use kernel-only integer typedefs */
+#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
+
#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
#define NEXT_ARG() ({ argc--; argv++; if (argc < 0) usage(); })