mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-03-26 23:21:27 +00:00
Add remaining docstrings to complete documentation coverage
Co-authored-by: varun-r-mallya <100590632+varun-r-mallya@users.noreply.github.com>
This commit is contained in:
@ -24,6 +24,7 @@ logger: Logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BPFHelperID(Enum):
|
||||
"""Enumeration of BPF helper function IDs."""
|
||||
BPF_MAP_LOOKUP_ELEM = 1
|
||||
BPF_MAP_UPDATE_ELEM = 2
|
||||
BPF_MAP_DELETE_ELEM = 3
|
||||
@ -260,6 +261,11 @@ def bpf_perf_event_output_handler(
|
||||
local_sym_tab=None,
|
||||
struct_sym_tab=None,
|
||||
):
|
||||
"""
|
||||
Emit LLVM IR for bpf_perf_event_output helper function call.
|
||||
|
||||
This allows sending data to userspace via a perf event array.
|
||||
"""
|
||||
if len(call.args) != 1:
|
||||
raise ValueError(
|
||||
f"Perf event output expects exactly one argument, got {len(call.args)}"
|
||||
@ -310,6 +316,7 @@ def handle_helper_call(
|
||||
|
||||
# Helper function to get map pointer and invoke handler
|
||||
def invoke_helper(method_name, map_ptr=None):
|
||||
"""Helper function to look up and invoke a registered handler."""
|
||||
handler = HelperHandlerRegistry.get_handler(method_name)
|
||||
if not handler:
|
||||
raise NotImplementedError(
|
||||
|
||||
@ -26,6 +26,7 @@ class HelperHandlerRegistry:
|
||||
"""Decorator to register a handler function for a helper"""
|
||||
|
||||
def decorator(func):
|
||||
"""Decorator that registers the handler function."""
|
||||
cls._handlers[helper_name] = func
|
||||
return func
|
||||
|
||||
|
||||
Reference in New Issue
Block a user