selftests/bpf: add __uint and __type macro for BTF-defined maps
authorAndrii Nakryiko <andriin@fb.com>
Fri, 5 Jul 2019 15:50:10 +0000 (08:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 5 Jul 2019 20:52:25 +0000 (22:52 +0200)
Add simple __uint and __type macro that hide details of how type and
integer values are captured in BTF-defined maps.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/bpf_helpers.h

index 1a5b1ac..5a3d92c 100644 (file)
@@ -8,6 +8,9 @@
  */
 #define SEC(NAME) __attribute__((section(NAME), used))
 
+#define __uint(name, val) int (*name)[val]
+#define __type(name, val) val *name
+
 /* helper macro to print out debug messages */
 #define bpf_printk(fmt, ...)                           \
 ({                                                     \