perf augmented_raw_syscalls: Use bpf_map()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 24 Jan 2019 14:17:23 +0000 (15:17 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 Jan 2019 14:12:10 +0000 (15:12 +0100)
To make the code more compact and also paving the way to have the BTF
annotation to be done transparently.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Link: https://lkml.kernel.org/n/tip-pjlf38sv3i1hbn5vzkr4y3ol@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/examples/bpf/augmented_raw_syscalls.c

index 9e9d4c66e53c53ed961294a1629dd3d9f53cbafb..f9b2161e1ca493c908d1f4265fe77e7847dee969 100644 (file)
 #include <pid_filter.h>
 
 /* bpf-output associated map */
-struct bpf_map SEC("maps") __augmented_syscalls__ = {
-       .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
-       .key_size = sizeof(int),
-       .value_size = sizeof(u32),
-       .max_entries = __NR_CPUS__,
-};
+bpf_map(__augmented_syscalls__, PERF_EVENT_ARRAY, int, u32, __NR_CPUS__);
 
 struct syscall {
        bool    enabled;
 };
 
-struct bpf_map SEC("maps") syscalls = {
-       .type        = BPF_MAP_TYPE_ARRAY,
-       .key_size    = sizeof(int),
-       .value_size  = sizeof(struct syscall),
-       .max_entries = 512,
-};
+bpf_map(syscalls, ARRAY, int, struct syscall, 512);
 
 struct syscall_enter_args {
        unsigned long long common_tp_fields;