diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-07-05 08:50:11 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-07-05 22:52:25 +0200 |
commit | bc7430cc8bfb51577e466a8ca02ad87375a70bde (patch) | |
tree | c56b050f3bb07c491da3f0fa082e651dbfe6d993 /tools/testing/selftests/bpf/progs/socket_cookie_prog.c | |
parent | 00acd00814527a1856c92beda17475205bddaba6 (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/socket_cookie_prog.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/socket_cookie_prog.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/testing/selftests/bpf/progs/socket_cookie_prog.c b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c index 6aabb681fb9a..e4440fdd94cb 100644 --- a/tools/testing/selftests/bpf/progs/socket_cookie_prog.c +++ b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c @@ -13,14 +13,11 @@ struct socket_cookie { }; struct { - __u32 type; - __u32 map_flags; - int *key; - struct socket_cookie *value; -} socket_cookies SEC(".maps") = { - .type = BPF_MAP_TYPE_SK_STORAGE, - .map_flags = BPF_F_NO_PREALLOC, -}; + __uint(type, BPF_MAP_TYPE_SK_STORAGE); + __uint(map_flags, BPF_F_NO_PREALLOC); + __type(key, int); + __type(value, struct socket_cookie); +} socket_cookies SEC(".maps"); SEC("cgroup/connect6") int set_cookie(struct bpf_sock_addr *ctx) |