summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_tcpbpf_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_tcpbpf_kern.c
parent00acd00814527a1856c92beda17475205bddaba6 (diff)
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_tcpbpf_kern.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
index 38e10c9fd996..2e233613d1fc 100644
--- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
@@ -15,24 +15,18 @@
#include "test_tcpbpf.h"
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- struct tcpbpf_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 tcpbpf_globals);
+} global_map SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- int *value;
-} sockopt_results SEC(".maps") = {
- .type = BPF_MAP_TYPE_ARRAY,
- .max_entries = 2,
-};
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 2);
+ __type(key, __u32);
+ __type(value, int);
+} sockopt_results SEC(".maps");
static inline void update_event_map(int event)
{