hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/samples/bpf/tracex3_kern.c
....@@ -8,19 +8,20 @@
88 #include <linux/netdevice.h>
99 #include <linux/version.h>
1010 #include <uapi/linux/bpf.h>
11
-#include "bpf_helpers.h"
11
+#include <bpf/bpf_helpers.h>
12
+#include <bpf/bpf_tracing.h>
1213
13
-struct bpf_map_def SEC("maps") my_map = {
14
- .type = BPF_MAP_TYPE_HASH,
15
- .key_size = sizeof(long),
16
- .value_size = sizeof(u64),
17
- .max_entries = 4096,
18
-};
14
+struct {
15
+ __uint(type, BPF_MAP_TYPE_HASH);
16
+ __type(key, long);
17
+ __type(value, u64);
18
+ __uint(max_entries, 4096);
19
+} my_map SEC(".maps");
1920
2021 /* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe
2122 * example will no longer be meaningful
2223 */
23
-SEC("kprobe/blk_start_request")
24
+SEC("kprobe/blk_mq_start_request")
2425 int bpf_prog1(struct pt_regs *ctx)
2526 {
2627 long rq = PT_REGS_PARM1(ctx);
....@@ -41,14 +42,14 @@
4142
4243 #define SLOTS 100
4344
44
-struct bpf_map_def SEC("maps") lat_map = {
45
- .type = BPF_MAP_TYPE_PERCPU_ARRAY,
46
- .key_size = sizeof(u32),
47
- .value_size = sizeof(u64),
48
- .max_entries = SLOTS,
49
-};
45
+struct {
46
+ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
47
+ __uint(key_size, sizeof(u32));
48
+ __uint(value_size, sizeof(u64));
49
+ __uint(max_entries, SLOTS);
50
+} lat_map SEC(".maps");
5051
51
-SEC("kprobe/blk_account_io_completion")
52
+SEC("kprobe/blk_account_io_done")
5253 int bpf_prog2(struct pt_regs *ctx)
5354 {
5455 long rq = PT_REGS_PARM1(ctx);