Skip to content

Commit 5adc6d7

Browse files
committed
janitorial
1 parent 7c15bff commit 5adc6d7

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

pythonbpf/bpf_helper_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import ast
22
from llvmlite import ir
33

4+
45
def bpf_ktime_get_ns_emitter(call, module, builder, func):
56
pass
67

8+
79
def bpf_printk_emitter(call, module, builder, func):
810
if not hasattr(func, "_fmt_counter"):
911
func._fmt_counter = 0

pythonbpf/globals_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def globals_processing(tree, module: ir.Module):
4242

4343
elif isinstance(dec, ast.Name) and dec.id == "bpfglobal":
4444
collected.append(node.name)
45-
45+
4646
elif isinstance(dec, ast.Name) and dec.id == "map":
4747
collected.append(node.name)
4848

pythonbpf/license_pass.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from llvmlite import ir
22
import ast
33

4+
45
def emit_license(module: ir.Module, license_str: str):
56
license_bytes = license_str.encode("utf8") + b"\x00"
67
elems = [ir.Constant(ir.IntType(8), b) for b in license_bytes]
@@ -17,13 +18,15 @@ def emit_license(module: ir.Module, license_str: str):
1718

1819
return gvar
1920

21+
2022
def license_processing(tree, module):
2123
"""Process the LICENSE function decorated with @bpf and @bpfglobal and return the section name"""
2224
count = 0
2325
for node in tree.body:
2426
if isinstance(node, ast.FunctionDef) and node.name == "LICENSE":
2527
# check decorators
26-
decorators = [dec.id for dec in node.decorator_list if isinstance(dec, ast.Name)]
28+
decorators = [
29+
dec.id for dec in node.decorator_list if isinstance(dec, ast.Name)]
2730
if "bpf" in decorators and "bpfglobal" in decorators:
2831
if count == 0:
2932
count += 1

pythonbpf/maps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def __init__(self, key_type, value_type, max_entries):
44
self.value_type = value_type
55
self.max_entries = max_entries
66
self.entries = {}
7-
7+
88
def lookup(self, key):
99
if key in self.entries:
1010
return self.entries[key]

pythonbpf/type_deducer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from llvmlite import ir
22

3-
#TODO: THIS IS NOT SUPPOSED TO MATCH STRINGS :skull:
3+
# TODO: THIS IS NOT SUPPOSED TO MATCH STRINGS :skull:
4+
5+
46
def ctypes_to_ir(ctype: str):
57
mapping = {
68
"c_int8": ir.IntType(8),

0 commit comments

Comments
 (0)