.. | .. |
---|
8 | 8 | #include <linux/version.h> |
---|
9 | 9 | #include <linux/ptrace.h> |
---|
10 | 10 | #include <uapi/linux/bpf.h> |
---|
11 | | -#include "bpf_helpers.h" |
---|
| 11 | +#include <bpf/bpf_helpers.h> |
---|
12 | 12 | |
---|
13 | 13 | #define MAX_ENTRIES 20 |
---|
14 | 14 | #define MAX_CPU 4 |
---|
.. | .. |
---|
18 | 18 | * trace_preempt_[on|off] tracepoints hooks is not supported. |
---|
19 | 19 | */ |
---|
20 | 20 | |
---|
21 | | -struct bpf_map_def SEC("maps") my_map = { |
---|
22 | | - .type = BPF_MAP_TYPE_ARRAY, |
---|
23 | | - .key_size = sizeof(int), |
---|
24 | | - .value_size = sizeof(u64), |
---|
25 | | - .max_entries = MAX_CPU, |
---|
26 | | -}; |
---|
| 21 | +struct { |
---|
| 22 | + __uint(type, BPF_MAP_TYPE_ARRAY); |
---|
| 23 | + __type(key, int); |
---|
| 24 | + __type(value, u64); |
---|
| 25 | + __uint(max_entries, MAX_CPU); |
---|
| 26 | +} my_map SEC(".maps"); |
---|
27 | 27 | |
---|
28 | 28 | SEC("kprobe/trace_preempt_off") |
---|
29 | 29 | int bpf_prog1(struct pt_regs *ctx) |
---|
.. | .. |
---|
61 | 61 | return log2(v); |
---|
62 | 62 | } |
---|
63 | 63 | |
---|
64 | | -struct bpf_map_def SEC("maps") my_lat = { |
---|
65 | | - .type = BPF_MAP_TYPE_ARRAY, |
---|
66 | | - .key_size = sizeof(int), |
---|
67 | | - .value_size = sizeof(long), |
---|
68 | | - .max_entries = MAX_CPU * MAX_ENTRIES, |
---|
69 | | -}; |
---|
| 64 | +struct { |
---|
| 65 | + __uint(type, BPF_MAP_TYPE_ARRAY); |
---|
| 66 | + __type(key, int); |
---|
| 67 | + __type(value, long); |
---|
| 68 | + __uint(max_entries, MAX_CPU * MAX_ENTRIES); |
---|
| 69 | +} my_lat SEC(".maps"); |
---|
70 | 70 | |
---|
71 | 71 | SEC("kprobe/trace_preempt_on") |
---|
72 | 72 | int bpf_prog2(struct pt_regs *ctx) |
---|