1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2018 Facebook */
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_legacy.h"
6 
7 struct ipv_counts {
8 	unsigned int v4;
9 	unsigned int v6;
10 };
11 
12 struct bpf_map_def SEC("maps") btf_map = {
13 	.type = BPF_MAP_TYPE_ARRAY,
14 	.key_size = sizeof(int),
15 	.value_size = sizeof(struct ipv_counts),
16 	.max_entries = 4,
17 };
18 
19 BPF_ANNOTATE_KV_PAIR(btf_map, int, struct ipv_counts);
20 
21 __attribute__((noinline))
test_long_fname_2(void)22 int test_long_fname_2(void)
23 {
24 	struct ipv_counts *counts;
25 	int key = 0;
26 
27 	counts = bpf_map_lookup_elem(&btf_map, &key);
28 	if (!counts)
29 		return 0;
30 
31 	counts->v6++;
32 
33 	return 0;
34 }
35 
36 __attribute__((noinline))
test_long_fname_1(void)37 int test_long_fname_1(void)
38 {
39 	return test_long_fname_2();
40 }
41 
42 SEC("dummy_tracepoint")
_dummy_tracepoint(void * arg)43 int _dummy_tracepoint(void *arg)
44 {
45 	return test_long_fname_1();
46 }
47 
48 char _license[] SEC("license") = "GPL";
49