mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add is_map in maps_pass
This commit is contained in:
committed by
Pragyansh Chaturvedi
parent
0fb1cafd20
commit
0d691865bc
@ -8,19 +8,20 @@ map_sym_tab = {}
|
||||
|
||||
def maps_proc(tree, module, chunks):
|
||||
for func_node in chunks:
|
||||
# Check if this function is a map
|
||||
is_map = False
|
||||
for decorator in func_node.decorator_list:
|
||||
if isinstance(decorator, ast.Name) and decorator.id == "map":
|
||||
is_map = True
|
||||
break
|
||||
if is_map:
|
||||
if is_map(func_node):
|
||||
print(f"Found BPF map: {func_node.name}")
|
||||
process_bpf_map(func_node, module)
|
||||
continue
|
||||
return map_sym_tab
|
||||
|
||||
|
||||
def is_map(func_node):
|
||||
return any(
|
||||
isinstance(decorator, ast.Name) and decorator.id == "map"
|
||||
for decorator in func_node.decorator_list
|
||||
)
|
||||
|
||||
|
||||
BPF_MAP_MAPPINGS = {
|
||||
"HASH": 1, # BPF_MAP_TYPE_HASH
|
||||
"PERF_EVENT_ARRAY": 4, # BPF_MAP_TYPE_PERF_EVENT_ARRAY
|
||||
|
||||
Reference in New Issue
Block a user