There was an error while loading. Please reload this page.
1 parent 0fb1caf commit 0d69186Copy full SHA for 0d69186
1 file changed
pythonbpf/maps_pass.py
@@ -8,19 +8,20 @@
8
9
def maps_proc(tree, module, chunks):
10
for func_node in chunks:
11
- # Check if this function is a map
12
- is_map = False
13
- for decorator in func_node.decorator_list:
14
- if isinstance(decorator, ast.Name) and decorator.id == "map":
15
- is_map = True
16
- break
17
- if is_map:
+ if is_map(func_node):
18
print(f"Found BPF map: {func_node.name}")
19
process_bpf_map(func_node, module)
20
continue
21
return map_sym_tab
22
23
+def is_map(func_node):
+ return any(
+ isinstance(decorator, ast.Name) and decorator.id == "map"
+ for decorator in func_node.decorator_list
+ )
+
24
25
BPF_MAP_MAPPINGS = {
26
"HASH": 1, # BPF_MAP_TYPE_HASH
27
"PERF_EVENT_ARRAY": 4, # BPF_MAP_TYPE_PERF_EVENT_ARRAY
0 commit comments