hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/samples/bpf/sampleip_kern.c
....@@ -8,16 +8,17 @@
88 #include <linux/ptrace.h>
99 #include <uapi/linux/bpf.h>
1010 #include <uapi/linux/bpf_perf_event.h>
11
-#include "bpf_helpers.h"
11
+#include <bpf/bpf_helpers.h>
12
+#include <bpf/bpf_tracing.h>
1213
1314 #define MAX_IPS 8192
1415
15
-struct bpf_map_def SEC("maps") ip_map = {
16
- .type = BPF_MAP_TYPE_HASH,
17
- .key_size = sizeof(u64),
18
- .value_size = sizeof(u32),
19
- .max_entries = MAX_IPS,
20
-};
16
+struct {
17
+ __uint(type, BPF_MAP_TYPE_HASH);
18
+ __type(key, u64);
19
+ __type(value, u32);
20
+ __uint(max_entries, MAX_IPS);
21
+} ip_map SEC(".maps");
2122
2223 SEC("perf_event")
2324 int do_sample(struct bpf_perf_event_data *ctx)