1 // SPDX-License-Identifier: GPL-2.0
5 #include <bpf/bpf_helpers.h>
11 struct S global_variable = {};
14 __uint(type, BPF_MAP_TYPE_ARRAY);
15 __uint(max_entries, 7);
18 } values SEC(".maps");
20 static void save_value(__u32 index, int value)
22 bpf_map_update_elem(&values, &index, &value, 0);
25 __noinline int foo(__u32 index, struct S *s)
28 save_value(index, s->v);
37 __noinline int bar(__u32 index, volatile struct S *s)
40 save_value(index, s->v);
49 __noinline int baz(struct S **s)
57 SEC("cgroup_skb/ingress")
58 int test_cls(struct __sk_buff *skb)
63 const int v = foo(index++, 0);
65 save_value(index++, v);
69 struct S s = { .v = 100 };
72 save_value(index++, s.v);
76 global_variable.v = 42;
77 bar(index++, &global_variable);
78 save_value(index++, global_variable.v);
85 save_value(index++, !p);
91 char _license[] SEC("license") = "GPL";