1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2020 Facebook */
3 /* "undefine" structs in vmlinux.h, because we "override" them below */
4 #define bpf_iter_meta bpf_iter_meta___not_used
5 #define bpf_iter__bpf_map bpf_iter__bpf_map___not_used
6 #define bpf_iter__ipv6_route bpf_iter__ipv6_route___not_used
7 #define bpf_iter__netlink bpf_iter__netlink___not_used
8 #define bpf_iter__task bpf_iter__task___not_used
9 #define bpf_iter__task_file bpf_iter__task_file___not_used
10 #define bpf_iter__task_vma bpf_iter__task_vma___not_used
11 #define bpf_iter__tcp bpf_iter__tcp___not_used
12 #define tcp6_sock tcp6_sock___not_used
13 #define bpf_iter__udp bpf_iter__udp___not_used
14 #define udp6_sock udp6_sock___not_used
15 #define bpf_iter__bpf_map_elem bpf_iter__bpf_map_elem___not_used
16 #define bpf_iter__bpf_sk_storage_map bpf_iter__bpf_sk_storage_map___not_used
17 #define bpf_iter__sockmap bpf_iter__sockmap___not_used
18 #define btf_ptr btf_ptr___not_used
19 #define BTF_F_COMPACT BTF_F_COMPACT___not_used
20 #define BTF_F_NONAME BTF_F_NONAME___not_used
21 #define BTF_F_PTR_RAW BTF_F_PTR_RAW___not_used
22 #define BTF_F_ZERO BTF_F_ZERO___not_used
23 #include "vmlinux.h"
24 #undef bpf_iter_meta
25 #undef bpf_iter__bpf_map
26 #undef bpf_iter__ipv6_route
27 #undef bpf_iter__netlink
28 #undef bpf_iter__task
29 #undef bpf_iter__task_file
30 #undef bpf_iter__task_vma
31 #undef bpf_iter__tcp
32 #undef tcp6_sock
33 #undef bpf_iter__udp
34 #undef udp6_sock
35 #undef bpf_iter__bpf_map_elem
36 #undef bpf_iter__bpf_sk_storage_map
37 #undef bpf_iter__sockmap
38 #undef btf_ptr
39 #undef BTF_F_COMPACT
40 #undef BTF_F_NONAME
41 #undef BTF_F_PTR_RAW
42 #undef BTF_F_ZERO
43 
44 struct bpf_iter_meta {
45 	struct seq_file *seq;
46 	__u64 session_id;
47 	__u64 seq_num;
48 } __attribute__((preserve_access_index));
49 
50 struct bpf_iter__ipv6_route {
51 	struct bpf_iter_meta *meta;
52 	struct fib6_info *rt;
53 } __attribute__((preserve_access_index));
54 
55 struct bpf_iter__netlink {
56 	struct bpf_iter_meta *meta;
57 	struct netlink_sock *sk;
58 } __attribute__((preserve_access_index));
59 
60 struct bpf_iter__task {
61 	struct bpf_iter_meta *meta;
62 	struct task_struct *task;
63 } __attribute__((preserve_access_index));
64 
65 struct bpf_iter__task_file {
66 	struct bpf_iter_meta *meta;
67 	struct task_struct *task;
68 	__u32 fd;
69 	struct file *file;
70 } __attribute__((preserve_access_index));
71 
72 struct bpf_iter__task_vma {
73 	struct bpf_iter_meta *meta;
74 	struct task_struct *task;
75 	struct vm_area_struct *vma;
76 } __attribute__((preserve_access_index));
77 
78 struct bpf_iter__bpf_map {
79 	struct bpf_iter_meta *meta;
80 	struct bpf_map *map;
81 } __attribute__((preserve_access_index));
82 
83 struct bpf_iter__tcp {
84 	struct bpf_iter_meta *meta;
85 	struct sock_common *sk_common;
86 	uid_t uid;
87 } __attribute__((preserve_access_index));
88 
89 struct tcp6_sock {
90 	struct tcp_sock	tcp;
91 	struct ipv6_pinfo inet6;
92 } __attribute__((preserve_access_index));
93 
94 struct bpf_iter__udp {
95 	struct bpf_iter_meta *meta;
96 	struct udp_sock *udp_sk;
97 	uid_t uid __attribute__((aligned(8)));
98 	int bucket __attribute__((aligned(8)));
99 } __attribute__((preserve_access_index));
100 
101 struct udp6_sock {
102 	struct udp_sock	udp;
103 	struct ipv6_pinfo inet6;
104 } __attribute__((preserve_access_index));
105 
106 struct bpf_iter__bpf_map_elem {
107 	struct bpf_iter_meta *meta;
108 	struct bpf_map *map;
109 	void *key;
110 	void *value;
111 };
112 
113 struct bpf_iter__bpf_sk_storage_map {
114 	struct bpf_iter_meta *meta;
115 	struct bpf_map *map;
116 	struct sock *sk;
117 	void *value;
118 };
119 
120 struct bpf_iter__sockmap {
121 	struct bpf_iter_meta *meta;
122 	struct bpf_map *map;
123 	void *key;
124 	struct sock *sk;
125 };
126 
127 struct btf_ptr {
128 	void *ptr;
129 	__u32 type_id;
130 	__u32 flags;
131 };
132 
133 enum {
134 	BTF_F_COMPACT	=	(1ULL << 0),
135 	BTF_F_NONAME	=	(1ULL << 1),
136 	BTF_F_PTR_RAW	=	(1ULL << 2),
137 	BTF_F_ZERO	=	(1ULL << 3),
138 };
139