Skip to content

Commit 8239097

Browse files
format chore
1 parent a4cfc2b commit 8239097

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

pythonbpf/vmlinux_parser/class_handler.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ def process_vmlinux_post_ast(
147147
process_vmlinux_post_ast(
148148
containing_type, llvm_handler, handler, processing_stack
149149
)
150-
size_of_containing_type = (handler[containing_type.__name__]).__sizeof__()
151-
new_dep_node.set_field_ready(elem_name, True, size_of_containing_type)
150+
size_of_containing_type = (
151+
handler[containing_type.__name__]
152+
).__sizeof__()
153+
new_dep_node.set_field_ready(
154+
elem_name, True, size_of_containing_type
155+
)
152156
elif containing_type.__module__ == ctypes.__name__:
153157
logger.debug(f"Processing ctype internal{containing_type}")
154158
new_dep_node.set_field_ready(elem_name, True)
@@ -165,8 +169,12 @@ def process_vmlinux_post_ast(
165169
process_vmlinux_post_ast(
166170
elem_type, llvm_handler, handler, processing_stack
167171
)
168-
size_of_containing_type = (handler[elem_type.__name__]).__sizeof__()
169-
new_dep_node.set_field_ready(elem_name, True, size_of_containing_type)
172+
size_of_containing_type = (
173+
handler[elem_type.__name__]
174+
).__sizeof__()
175+
new_dep_node.set_field_ready(
176+
elem_name, True, size_of_containing_type
177+
)
170178
else:
171179
raise ValueError(
172180
f"{elem_name} with type {elem_type} from module {module_name} not supported in recursive resolver"

pythonbpf/vmlinux_parser/dependency_node.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ def set_field_bitfield_size(
215215
# Invalidate readiness cache
216216
self._ready_cache = None
217217

218-
def set_field_ready(self, name: str, is_ready: bool = False, size_of_containing_type: Optional[int] = None) -> None:
218+
def set_field_ready(
219+
self,
220+
name: str,
221+
is_ready: bool = False,
222+
size_of_containing_type: Optional[int] = None,
223+
) -> None:
219224
"""Mark a field as ready or not ready."""
220225
if name not in self.fields:
221226
raise KeyError(f"Field '{name}' does not exist in node '{self.name}'")
@@ -226,7 +231,9 @@ def set_field_ready(self, name: str, is_ready: bool = False, size_of_containing_
226231
# Invalidate readiness cache
227232
self._ready_cache = None
228233

229-
def _calculate_size(self, name: str, size_of_containing_type: Optional[int] = None) -> int:
234+
def _calculate_size(
235+
self, name: str, size_of_containing_type: Optional[int] = None
236+
) -> int:
230237
processing_field = self.fields[name]
231238
# size_of_field will be in bytes
232239
if processing_field.type.__module__ == ctypes.__name__:
@@ -244,8 +251,7 @@ def _calculate_size(self, name: str, size_of_containing_type: Optional[int] = No
244251
return size_of_field
245252
elif processing_field.containing_type.__module__ == "vmlinux":
246253
size_of_field = (
247-
size_of_containing_type
248-
* processing_field.type_size
254+
size_of_containing_type * processing_field.type_size
249255
)
250256
return size_of_field
251257
elif issubclass(processing_field.ctype_complex_type, ctypes._Pointer):

tests/failing_tests/xdp_pass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pythonbpf.helper import XDP_PASS
44
from vmlinux import TASK_COMM_LEN # noqa: F401
55
from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401
6+
67
# from vmlinux import struct_request
78
from vmlinux import struct_xdp_md
89
# from vmlinux import struct_trace_event_raw_sys_enter # noqa: F401

0 commit comments

Comments
 (0)