From 9ae1b6ce15f63d033b18eefb4d0a857814673b68 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Tue, 30 Sep 2025 13:28:18 +0530 Subject: [PATCH] Fix usage of map_params to use BPFMapType --- pythonbpf/maps_pass.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pythonbpf/maps_pass.py b/pythonbpf/maps_pass.py index 7484aea..eeb5338 100644 --- a/pythonbpf/maps_pass.py +++ b/pythonbpf/maps_pass.py @@ -37,8 +37,7 @@ BPF_MAP_MAPPINGS = { def create_bpf_map(module, map_name, map_params): """Create a BPF map in the module with the given parameters and debug info""" - map_type_str = map_params.get("type", "HASH") - map_type = BPF_MAP_MAPPINGS.get(map_type_str) + map_type = map_params.get("type", BPFMapType.HASH).value # Create the anonymous struct type for BPF map map_struct_type = ir.LiteralStructType( @@ -82,7 +81,7 @@ def create_map_debug_info(module, map_global, map_name, map_params): # Create array type for map type field (array of 1 unsigned int) array_subrange = module.add_debug_info( - "DISubrange", {"count": BPF_MAP_MAPPINGS[map_params.get("type", "HASH")]}) + "DISubrange", {"count": map_params.get("type", BPFMapType.HASH).value}) array_type = module.add_debug_info("DICompositeType", { "tag": dc.DW_TAG_array_type, "baseType": uint_type,