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/test_get_stack_rawtp.c | |
| parent | selftests/bpf: add __uint and __type macro for BTF-defined maps (diff) | |
| download | linux-bc7430cc8bfb51577e466a8ca02ad87375a70bde.tar.gz linux-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_get_stack_rawtp.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c index aaa6ec250e15..d06b47a09097 100644 --- a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c +++ b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c @@ -16,26 +16,18 @@ struct stack_trace_t { }; struct { - __u32 type; - __u32 max_entries; - __u32 key_size; - __u32 value_size; -} perfmap 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)); +} perfmap SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - struct stack_trace_t *value; -} stackdata_map SEC(".maps") = { - .type = BPF_MAP_TYPE_PERCPU_ARRAY, - .max_entries = 1, -}; + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); + __type(value, struct stack_trace_t); +} stackdata_map SEC(".maps"); /* Allocate per-cpu space twice the needed. For the code below * usize = bpf_get_stack(ctx, raw_data, max_len, BPF_F_USER_STACK); @@ -56,14 +48,11 @@ struct { * This is an acceptable workaround since there is one entry here. */ struct { - __u32 type; - __u32 max_entries; - __u32 *key; + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); __u64 (*value)[2 * MAX_STACK_RAWTP]; -} rawdata_map SEC(".maps") = { - .type = BPF_MAP_TYPE_PERCPU_ARRAY, - .max_entries = 1, -}; +} rawdata_map SEC(".maps"); SEC("tracepoint/raw_syscalls/sys_enter") int bpf_prog1(void *ctx) |
