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:
@ -11,6 +11,7 @@ from pythonbpf.maps import HashMap
|
|||||||
# We can allow bitcasts in cases where the width of the types is the same in
|
# We can allow bitcasts in cases where the width of the types is the same in
|
||||||
# the future. But for now, we do not allow any re-interpretation of variables.
|
# the future. But for now, we do not allow any re-interpretation of variables.
|
||||||
|
|
||||||
|
|
||||||
@bpf
|
@bpf
|
||||||
@map
|
@map
|
||||||
def last() -> HashMap:
|
def last() -> HashMap:
|
||||||
|
|||||||
@ -9,6 +9,7 @@ from pythonbpf.helper import ktime
|
|||||||
# the compiler, it is recommended to use named variables to reduce the amount of
|
# the compiler, it is recommended to use named variables to reduce the amount of
|
||||||
# scratch space that needs to be allocated.
|
# scratch space that needs to be allocated.
|
||||||
|
|
||||||
|
|
||||||
@bpf
|
@bpf
|
||||||
@struct
|
@struct
|
||||||
class data_t:
|
class data_t:
|
||||||
@ -48,8 +49,12 @@ def hello_world(ctx: c_void_p) -> c_int64:
|
|||||||
a = last.lookup(0)
|
a = last.lookup(0)
|
||||||
print(f"a is {a}")
|
print(f"a is {a}")
|
||||||
last.update(9, 9)
|
last.update(9, 9)
|
||||||
last.update(0, last.lookup(last.lookup(0)) +
|
last.update(
|
||||||
last.lookup(last.lookup(0)) + last.lookup(last.lookup(0)))
|
0,
|
||||||
|
last.lookup(last.lookup(0))
|
||||||
|
+ last.lookup(last.lookup(0))
|
||||||
|
+ last.lookup(last.lookup(0)),
|
||||||
|
)
|
||||||
z = last.lookup(0)
|
z = last.lookup(0)
|
||||||
print(f"new map val at index 0 is {z}")
|
print(f"new map val at index 0 is {z}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user