Debian Codegraph @

testdata/strings.c

raw symbols SCIP
1 #include "common.h"
2
3 char __license[] __section("license") = "MIT";
4
5 typedef char custkey[48];
6
7 struct {
8 __uint(type, BPF_MAP_TYPE_HASH);
9 __uint(max_entries, 2);
10 __type(key, custkey);
11 __type(value, uint32_t);
12 } my_map __section(".maps");
13
14 #define KEY "This string is allocated in the string section\n"
15
16 __section("xdp") int filter() {
17 uint32_t *value = bpf_map_lookup_elem(&my_map, KEY);
18 if (value)
19 (*value)++;
20 else {
21 uint32_t newValue = 1;
22 bpf_map_update_elem(&my_map, KEY, &newValue, 0);
23 }
24
25 return 2;
26 }