format chore

This commit is contained in:
2025-10-12 23:47:46 +05:30
parent 9b8462f1ed
commit 93634a4769
3 changed files with 20 additions and 10 deletions

View File

@ -41,9 +41,7 @@ def process_vmlinux_post_ast(
module_name = getattr(elem_type_class, "__module__", None)
if current_symbol_name in processing_stack:
logger.info(
f"Circular dependency detected for {current_symbol_name}, skipping"
)
logger.info(f"Circular dependency detected for {current_symbol_name}, skipping")
return True
# Check if already processed
@ -119,20 +117,28 @@ def process_vmlinux_post_ast(
raise ImportError(
f"Unsupported module of {containing_type}"
)
logger.info(f"{containing_type} containing type of parent {elem_name} with {elem_type} and ctype {ctype_complex_type} and length {type_length}")
new_dep_node.set_field_containing_type(elem_name, containing_type)
logger.info(
f"{containing_type} containing type of parent {elem_name} with {elem_type} and ctype {ctype_complex_type} and length {type_length}"
)
new_dep_node.set_field_containing_type(
elem_name, containing_type
)
new_dep_node.set_field_type_size(elem_name, type_length)
new_dep_node.set_field_ctype_complex_type(elem_name, ctype_complex_type)
new_dep_node.set_field_ctype_complex_type(
elem_name, ctype_complex_type
)
new_dep_node.set_field_type(elem_name, elem_type)
if containing_type.__module__ == "vmlinux":
if process_vmlinux_post_ast(
containing_type, llvm_handler, handler, processing_stack
containing_type, llvm_handler, handler, processing_stack
):
new_dep_node.set_field_ready(elem_name, True)
elif containing_type.__module__ == ctypes.__name__:
logger.info(f"Processing ctype internal{containing_type}")
else:
raise TypeError("Module not supported in recursive resolution")
raise TypeError(
"Module not supported in recursive resolution"
)
continue
if process_vmlinux_post_ast(
elem_type, llvm_handler, handler, processing_stack

View File

@ -46,7 +46,9 @@ class Field:
if mark_ready:
self.ready = True
def set_ctype_complex_type(self, ctype_complex_type: Any, mark_ready: bool = True) -> None:
def set_ctype_complex_type(
self, ctype_complex_type: Any, mark_ready: bool = True
) -> None:
"""Set the ctype_complex_type of this field and optionally mark it as ready."""
self.ctype_complex_type = ctype_complex_type
if mark_ready:
@ -127,7 +129,7 @@ class DependencyNode:
containing_type=containing_type,
type_size=type_size,
ctype_complex_type=ctype_complex_type,
bitfield_size=bitfield_size
bitfield_size=bitfield_size,
)
# Invalidate readiness cache
self._ready_cache = None

View File

@ -2,8 +2,10 @@ from pythonbpf import bpf, map, section, bpfglobal, compile_to_ir
from pythonbpf.maps import HashMap
from pythonbpf.helper import XDP_PASS
from vmlinux import struct_xdp_md
# from vmlinux import struct_ring_buffer_per_cpu # noqa: F401
from vmlinux import struct_xdp_buff # noqa: F401
# from vmlinux import struct_xdp_md
from ctypes import c_int64