aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-07-05 08:50:11 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2019-07-05 22:52:25 +0200
commitbc7430cc8bfb51577e466a8ca02ad87375a70bde (patch)
treec56b050f3bb07c491da3f0fa082e651dbfe6d993 /tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
parentselftests/bpf: add __uint and __type macro for BTF-defined maps (diff)
downloadlinux-dev-bc7430cc8bfb51577e466a8ca02ad87375a70bde.tar.xz
linux-dev-bc7430cc8bfb51577e466a8ca02ad87375a70bde.zip
selftests/bpf: convert selftests using BTF-defined maps to new syntax
Convert all the existing selftests that are already using BTF-defined maps to use new syntax (with no static data initialization). 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>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
index d073d37d4e27..08346e7765d5 100644
--- a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
@@ -15,26 +15,18 @@
#include "test_tcpnotify.h"
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- struct tcpnotify_globals *value;
-} global_map SEC(".maps") = {
- .type = BPF_MAP_TYPE_ARRAY,
- .max_entries = 4,
-};
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 4);
+ __type(key, __u32);
+ __type(value, struct tcpnotify_globals);
+} global_map SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 key_size;
- __u32 value_size;
-} perf_event_map SEC(".maps") = {
- .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
- .max_entries = 2,
- .key_size = sizeof(int),
- .value_size = sizeof(__u32),
-};
+ __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
+ __uint(max_entries, 2);
+ __uint(key_size, sizeof(int));
+ __uint(value_size, sizeof(__u32));
+} perf_event_map SEC(".maps");
int _version SEC("version") = 1;