shorten disksnoop.c example further
diff --git a/examples/disksnoop.c b/examples/disksnoop.c
index 2de04cc..c4a25aa 100644
--- a/examples/disksnoop.c
+++ b/examples/disksnoop.c
@@ -15,27 +15,21 @@
BPF_HASH(start, struct request *);
-int kprobe__blk_start_request(struct pt_regs *ctx, struct request *req) {
- u64 ts;
-
+void kprobe__blk_start_request(struct pt_regs *ctx, struct request *req) {
// stash start timestamp by request ptr
- ts = bpf_ktime_get_ns();
- start.update(&req, &ts);
+ u64 ts = bpf_ktime_get_ns();
- return 0;
+ start.update(&req, &ts);
}
-int kprobe__blk_update_request(struct pt_regs *ctx, struct request *req) {
+void kprobe__blk_update_request(struct pt_regs *ctx, struct request *req) {
u64 *tsp, delta;
tsp = start.lookup(&req);
-
if (tsp != 0) {
delta = bpf_ktime_get_ns() - *tsp;
bpf_trace_printk("%d %x %d\n", req->__data_len,
req->cmd_flags, delta / 1000);
start.delete(&req);
}
-
- return 0;
}