add tests

This commit is contained in:
2025-11-13 09:29:53 +05:30
parent f7dee329cb
commit 73bbf00e7c
3 changed files with 34 additions and 9 deletions

View File

@ -1,13 +1,15 @@
from vmlinux import struct_kobj_type
from vmlinux import struct_request, struct_pt_regs, XDP_PASS
from pythonbpf import bpf, section, bpfglobal, compile_to_ir
import logging
from ctypes import c_void_p
from ctypes import c_int64
@bpf
@section("kprobe/blk_mq_start_request")
def example(ctx: c_void_p):
print(f"data lengt")
def example(ctx: struct_pt_regs) -> c_int64:
req = ctx.di
print(f"data length {req}")
return c_int64(0)
@bpf
@ -16,4 +18,4 @@ def LICENSE() -> str:
return "GPL"
compile_to_ir("requests.py", "requests.ll", loglevel=logging.INFO)
compile_to_ir("requests2.py", "requests2.ll", loglevel=logging.INFO)