Skip to content

Commit 9ae1b6c

Browse files
committed
Fix usage of map_params to use BPFMapType
1 parent 1a1f2cf commit 9ae1b6c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pythonbpf/maps_pass.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ class BPFMapType(Enum):
3737
def create_bpf_map(module, map_name, map_params):
3838
"""Create a BPF map in the module with the given parameters and debug info"""
3939

40-
map_type_str = map_params.get("type", "HASH")
41-
map_type = BPF_MAP_MAPPINGS.get(map_type_str)
40+
map_type = map_params.get("type", BPFMapType.HASH).value
4241

4342
# Create the anonymous struct type for BPF map
4443
map_struct_type = ir.LiteralStructType(
@@ -82,7 +81,7 @@ def create_map_debug_info(module, map_global, map_name, map_params):
8281

8382
# Create array type for map type field (array of 1 unsigned int)
8483
array_subrange = module.add_debug_info(
85-
"DISubrange", {"count": BPF_MAP_MAPPINGS[map_params.get("type", "HASH")]})
84+
"DISubrange", {"count": map_params.get("type", BPFMapType.HASH).value})
8685
array_type = module.add_debug_info("DICompositeType", {
8786
"tag": dc.DW_TAG_array_type,
8887
"baseType": uint_type,

0 commit comments

Comments
 (0)