mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add __init__ to maps to improve imports
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
from pythonbpf.decorators import bpf, map, section, bpfglobal
|
from pythonbpf.decorators import bpf, map, section, bpfglobal
|
||||||
from ctypes import c_void_p, c_int64, c_int32, c_uint64
|
from ctypes import c_void_p, c_int64, c_int32, c_uint64
|
||||||
from pythonbpf.helpers import ktime
|
from pythonbpf.helpers import ktime
|
||||||
from pythonbpf.maps.maps import HashMap
|
from pythonbpf.maps import HashMap
|
||||||
|
|
||||||
|
|
||||||
@bpf
|
@bpf
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from pythonbpf import bpf, map, section, bpfglobal, compile
|
from pythonbpf import bpf, map, section, bpfglobal, compile
|
||||||
from pythonbpf.helpers import ktime, deref
|
from pythonbpf.helpers import ktime, deref
|
||||||
from pythonbpf.maps.maps import HashMap
|
from pythonbpf.maps import HashMap
|
||||||
|
|
||||||
from ctypes import c_void_p, c_int64, c_int32, c_uint64
|
from ctypes import c_void_p, c_int64, c_int32, c_uint64
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import ast
|
|||||||
from llvmlite import ir
|
from llvmlite import ir
|
||||||
from .license_pass import license_processing
|
from .license_pass import license_processing
|
||||||
from .functions_pass import func_proc
|
from .functions_pass import func_proc
|
||||||
from pythonbpf.maps.maps_pass import maps_proc
|
from pythonbpf.maps import maps_proc
|
||||||
from .structs.structs_pass import structs_proc
|
from .structs.structs_pass import structs_proc
|
||||||
from .globals_pass import globals_processing
|
from .globals_pass import globals_processing
|
||||||
import os
|
import os
|
||||||
|
|||||||
2
pythonbpf/maps/__init__.py
Normal file
2
pythonbpf/maps/__init__.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
from .maps import HashMap, PerfEventArray
|
||||||
|
from .maps_pass import maps_proc
|
||||||
@ -256,8 +256,8 @@ def process_bpf_map(func_node, module):
|
|||||||
if handler:
|
if handler:
|
||||||
return handler(map_name, rval, module)
|
return handler(map_name, rval, module)
|
||||||
else:
|
else:
|
||||||
logger.warning(f"Unknown map type {
|
logger.warning(f"Unknown map type "
|
||||||
rval.func.id}, defaulting to HashMap")
|
f"{rval.func.id}, defaulting to HashMap")
|
||||||
process_hash_map(map_name, rval, module)
|
process_hash_map(map_name, rval, module)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Function under @map must return a map")
|
raise ValueError("Function under @map must return a map")
|
||||||
|
|||||||
Reference in New Issue
Block a user