mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
format chore
This commit is contained in:
@ -3,16 +3,19 @@ import logging
|
||||
from pythonbpf import compile, bpf, section, bpfglobal, compile_to_ir
|
||||
from ctypes import c_void_p, c_int64, c_int32
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def somevalue() -> c_int32:
|
||||
return c_int32(42)
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def somevalue2() -> c_int64:
|
||||
return c_int64(69)
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def somevalue1() -> c_int32:
|
||||
@ -21,12 +24,14 @@ def somevalue1() -> c_int32:
|
||||
|
||||
# --- Passing examples ---
|
||||
|
||||
|
||||
# Simple constant return
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def g1() -> c_int64:
|
||||
return c_int64(42)
|
||||
|
||||
|
||||
# Constructor with one constant argument
|
||||
@bpf
|
||||
@bpfglobal
|
||||
@ -62,15 +67,17 @@ def g2() -> c_int64:
|
||||
# def g6() -> c_int64:
|
||||
# return c_int64(CONST)
|
||||
|
||||
|
||||
# Constructor with multiple args
|
||||
#TODO: this is not working. should it work ?
|
||||
# TODO: this is not working. should it work ?
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def g7() -> c_int64:
|
||||
return c_int64(1)
|
||||
|
||||
|
||||
# Dataclass call
|
||||
#TODO: fails with dataclass
|
||||
# TODO: fails with dataclass
|
||||
# @dataclass
|
||||
# class Point:
|
||||
# x: c_int64
|
||||
@ -91,6 +98,7 @@ def sometag(ctx: c_void_p) -> c_int64:
|
||||
print(f"{somevalue}")
|
||||
return c_int64(1)
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
|
||||
Reference in New Issue
Block a user