.. | .. |
---|
9 | 9 | #include <linux/version.h> |
---|
10 | 10 | #include <uapi/linux/bpf.h> |
---|
11 | 11 | #include <uapi/linux/perf_event.h> |
---|
12 | | -#include "bpf_helpers.h" |
---|
| 12 | +#include <bpf/bpf_helpers.h> |
---|
| 13 | +#include <bpf/bpf_tracing.h> |
---|
13 | 14 | |
---|
14 | | -struct bpf_map_def SEC("maps") my_map = { |
---|
15 | | - .type = BPF_MAP_TYPE_HASH, |
---|
16 | | - .key_size = sizeof(long), |
---|
17 | | - .value_size = sizeof(long), |
---|
18 | | - .max_entries = 1024, |
---|
19 | | -}; |
---|
20 | | -struct bpf_map_def SEC("maps") my_map2 = { |
---|
21 | | - .type = BPF_MAP_TYPE_PERCPU_HASH, |
---|
22 | | - .key_size = sizeof(long), |
---|
23 | | - .value_size = sizeof(long), |
---|
24 | | - .max_entries = 1024, |
---|
25 | | -}; |
---|
| 15 | +struct { |
---|
| 16 | + __uint(type, BPF_MAP_TYPE_HASH); |
---|
| 17 | + __type(key, long); |
---|
| 18 | + __type(value, long); |
---|
| 19 | + __uint(max_entries, 1024); |
---|
| 20 | +} my_map SEC(".maps"); |
---|
| 21 | +struct { |
---|
| 22 | + __uint(type, BPF_MAP_TYPE_PERCPU_HASH); |
---|
| 23 | + __uint(key_size, sizeof(long)); |
---|
| 24 | + __uint(value_size, sizeof(long)); |
---|
| 25 | + __uint(max_entries, 1024); |
---|
| 26 | +} my_map2 SEC(".maps"); |
---|
26 | 27 | |
---|
27 | | -struct bpf_map_def SEC("maps") stackmap = { |
---|
28 | | - .type = BPF_MAP_TYPE_STACK_TRACE, |
---|
29 | | - .key_size = sizeof(u32), |
---|
30 | | - .value_size = PERF_MAX_STACK_DEPTH * sizeof(u64), |
---|
31 | | - .max_entries = 10000, |
---|
32 | | -}; |
---|
| 28 | +struct { |
---|
| 29 | + __uint(type, BPF_MAP_TYPE_STACK_TRACE); |
---|
| 30 | + __uint(key_size, sizeof(u32)); |
---|
| 31 | + __uint(value_size, PERF_MAX_STACK_DEPTH * sizeof(u64)); |
---|
| 32 | + __uint(max_entries, 10000); |
---|
| 33 | +} stackmap SEC(".maps"); |
---|
33 | 34 | |
---|
34 | 35 | #define PROG(foo) \ |
---|
35 | 36 | int foo(struct pt_regs *ctx) \ |
---|