~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/btf_ids.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/btf_ids.h (Version linux-6.11.5) and /include/linux/btf_ids.h (Version linux-5.9.16)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2                                                     2 
  3 #ifndef _LINUX_BTF_IDS_H                            3 #ifndef _LINUX_BTF_IDS_H
  4 #define _LINUX_BTF_IDS_H                            4 #define _LINUX_BTF_IDS_H
  5                                                     5 
  6 #include <linux/types.h> /* for u32 */         << 
  7                                                << 
  8 struct btf_id_set {                            << 
  9         u32 cnt;                               << 
 10         u32 ids[];                             << 
 11 };                                             << 
 12                                                << 
 13 /* This flag implies BTF_SET8 holds kfunc(s) * << 
 14 #define BTF_SET8_KFUNCS         (1 << 0)       << 
 15                                                << 
 16 struct btf_id_set8 {                           << 
 17         u32 cnt;                               << 
 18         u32 flags;                             << 
 19         struct {                               << 
 20                 u32 id;                        << 
 21                 u32 flags;                     << 
 22         } pairs[];                             << 
 23 };                                             << 
 24                                                << 
 25 #ifdef CONFIG_DEBUG_INFO_BTF                        6 #ifdef CONFIG_DEBUG_INFO_BTF
 26                                                     7 
 27 #include <linux/compiler.h> /* for __PASTE */       8 #include <linux/compiler.h> /* for __PASTE */
 28 #include <linux/compiler_attributes.h> /* for  << 
 29 #include <linux/stringify.h>                   << 
 30                                                     9 
 31 /*                                                 10 /*
 32  * Following macros help to define lists of BT     11  * Following macros help to define lists of BTF IDs placed
 33  * in .BTF_ids section. They are initially fil     12  * in .BTF_ids section. They are initially filled with zeros
 34  * (during compilation) and resolved later dur     13  * (during compilation) and resolved later during the
 35  * linking phase by resolve_btfids tool.           14  * linking phase by resolve_btfids tool.
 36  *                                                 15  *
 37  * Any change in list layout must be reflected     16  * Any change in list layout must be reflected in resolve_btfids
 38  * tool logic.                                     17  * tool logic.
 39  */                                                18  */
 40                                                    19 
 41 #define BTF_IDS_SECTION ".BTF_ids"                 20 #define BTF_IDS_SECTION ".BTF_ids"
 42                                                    21 
 43 #define ____BTF_ID(symbol, word)               !!  22 #define ____BTF_ID(symbol)                              \
 44 asm(                                               23 asm(                                                    \
 45 ".pushsection " BTF_IDS_SECTION ",\"a\";           24 ".pushsection " BTF_IDS_SECTION ",\"a\";       \n"      \
 46 ".local " #symbol " ;                              25 ".local " #symbol " ;                          \n"      \
 47 ".type  " #symbol ", STT_OBJECT;                   26 ".type  " #symbol ", STT_OBJECT;               \n"      \
 48 ".size  " #symbol ", 4;                            27 ".size  " #symbol ", 4;                        \n"      \
 49 #symbol ":                                         28 #symbol ":                                     \n"      \
 50 ".zero 4                                           29 ".zero 4                                       \n"      \
 51 word                                           << 
 52 ".popsection;                                      30 ".popsection;                                  \n");
 53                                                    31 
 54 #define __BTF_ID(symbol, word) \               !!  32 #define __BTF_ID(symbol) \
 55         ____BTF_ID(symbol, word)               !!  33         ____BTF_ID(symbol)
 56                                                    34 
 57 #define __ID(prefix) \                             35 #define __ID(prefix) \
 58         __PASTE(__PASTE(prefix, __COUNTER__),  !!  36         __PASTE(prefix, __COUNTER__)
 59                                                    37 
 60 /*                                                 38 /*
 61  * The BTF_ID defines unique symbol for each I     39  * The BTF_ID defines unique symbol for each ID pointing
 62  * to 4 zero bytes.                                40  * to 4 zero bytes.
 63  */                                                41  */
 64 #define BTF_ID(prefix, name) \                     42 #define BTF_ID(prefix, name) \
 65         __BTF_ID(__ID(__BTF_ID__##prefix##__## !!  43         __BTF_ID(__ID(__BTF_ID__##prefix##__##name##__))
 66                                                << 
 67 #define ____BTF_ID_FLAGS(prefix, name, flags)  << 
 68         __BTF_ID(__ID(__BTF_ID__##prefix##__## << 
 69 #define __BTF_ID_FLAGS(prefix, name, flags, .. << 
 70         ____BTF_ID_FLAGS(prefix, name, flags)  << 
 71 #define BTF_ID_FLAGS(prefix, name, ...) \      << 
 72         __BTF_ID_FLAGS(prefix, name, ##__VA_AR << 
 73                                                    44 
 74 /*                                                 45 /*
 75  * The BTF_ID_LIST macro defines pure (unsorte     46  * The BTF_ID_LIST macro defines pure (unsorted) list
 76  * of BTF IDs, with following layout:              47  * of BTF IDs, with following layout:
 77  *                                                 48  *
 78  * BTF_ID_LIST(list1)                              49  * BTF_ID_LIST(list1)
 79  * BTF_ID(type1, name1)                            50  * BTF_ID(type1, name1)
 80  * BTF_ID(type2, name2)                            51  * BTF_ID(type2, name2)
 81  *                                                 52  *
 82  * list1:                                          53  * list1:
 83  * __BTF_ID__type1__name1__1:                      54  * __BTF_ID__type1__name1__1:
 84  * .zero 4                                         55  * .zero 4
 85  * __BTF_ID__type2__name2__2:                      56  * __BTF_ID__type2__name2__2:
 86  * .zero 4                                         57  * .zero 4
 87  *                                                 58  *
 88  */                                                59  */
 89 #define __BTF_ID_LIST(name, scope)                 60 #define __BTF_ID_LIST(name, scope)                      \
 90 asm(                                               61 asm(                                                    \
 91 ".pushsection " BTF_IDS_SECTION ",\"a\";           62 ".pushsection " BTF_IDS_SECTION ",\"a\";       \n"      \
 92 "." #scope " " #name ";                            63 "." #scope " " #name ";                        \n"      \
 93 #name ":;                                          64 #name ":;                                      \n"      \
 94 ".popsection;                                  !!  65 ".popsection;                                  \n");    \
 95                                                    66 
 96 #define BTF_ID_LIST(name)                          67 #define BTF_ID_LIST(name)                               \
 97 __BTF_ID_LIST(name, local)                         68 __BTF_ID_LIST(name, local)                              \
 98 extern u32 name[];                                 69 extern u32 name[];
 99                                                    70 
100 #define BTF_ID_LIST_GLOBAL(name, n)            !!  71 #define BTF_ID_LIST_GLOBAL(name)                        \
101 __BTF_ID_LIST(name, globl)                         72 __BTF_ID_LIST(name, globl)
102                                                    73 
103 /* The BTF_ID_LIST_SINGLE macro defines a BTF_ << 
104  * a single entry.                             << 
105  */                                            << 
106 #define BTF_ID_LIST_SINGLE(name, prefix, typen << 
107         BTF_ID_LIST(name) \                    << 
108         BTF_ID(prefix, typename)               << 
109 #define BTF_ID_LIST_GLOBAL_SINGLE(name, prefix << 
110         BTF_ID_LIST_GLOBAL(name, 1)            << 
111         BTF_ID(prefix, typename)               << 
112                                                << 
113 /*                                                 74 /*
114  * The BTF_ID_UNUSED macro defines 4 zero byte     75  * The BTF_ID_UNUSED macro defines 4 zero bytes.
115  * It's used when we want to define 'unused' e     76  * It's used when we want to define 'unused' entry
116  * in BTF_ID_LIST, like:                           77  * in BTF_ID_LIST, like:
117  *                                                 78  *
118  *   BTF_ID_LIST(bpf_skb_output_btf_ids)           79  *   BTF_ID_LIST(bpf_skb_output_btf_ids)
119  *   BTF_ID(struct, sk_buff)                       80  *   BTF_ID(struct, sk_buff)
120  *   BTF_ID_UNUSED                                 81  *   BTF_ID_UNUSED
121  *   BTF_ID(struct, task_struct)                   82  *   BTF_ID(struct, task_struct)
122  */                                                83  */
123                                                    84 
124 #define BTF_ID_UNUSED                              85 #define BTF_ID_UNUSED                                   \
125 asm(                                               86 asm(                                                    \
126 ".pushsection " BTF_IDS_SECTION ",\"a\";           87 ".pushsection " BTF_IDS_SECTION ",\"a\";       \n"      \
127 ".zero 4                                           88 ".zero 4                                       \n"      \
128 ".popsection;                                      89 ".popsection;                                  \n");
129                                                    90 
130 /*                                             << 
131  * The BTF_SET_START/END macros pair defines s << 
132  * BTF IDs plus its members count, with follow << 
133  *                                             << 
134  * BTF_SET_START(list)                         << 
135  * BTF_ID(type1, name1)                        << 
136  * BTF_ID(type2, name2)                        << 
137  * BTF_SET_END(list)                           << 
138  *                                             << 
139  * __BTF_ID__set__list:                        << 
140  * .zero 4                                     << 
141  * list:                                       << 
142  * __BTF_ID__type1__name1__3:                  << 
143  * .zero 4                                     << 
144  * __BTF_ID__type2__name2__4:                  << 
145  * .zero 4                                     << 
146  *                                             << 
147  */                                            << 
148 #define __BTF_SET_START(name, scope)           << 
149 asm(                                           << 
150 ".pushsection " BTF_IDS_SECTION ",\"a\";       << 
151 "." #scope " __BTF_ID__set__" #name ";         << 
152 "__BTF_ID__set__" #name ":;                    << 
153 ".zero 4                                       << 
154 ".popsection;                                  << 
155                                                << 
156 #define BTF_SET_START(name)                    << 
157 __BTF_ID_LIST(name, local)                     << 
158 __BTF_SET_START(name, local)                   << 
159                                                << 
160 #define BTF_SET_START_GLOBAL(name)             << 
161 __BTF_ID_LIST(name, globl)                     << 
162 __BTF_SET_START(name, globl)                   << 
163                                                << 
164 #define BTF_SET_END(name)                      << 
165 asm(                                           << 
166 ".pushsection " BTF_IDS_SECTION ",\"a\";       << 
167 ".size __BTF_ID__set__" #name ", .-" #name "   << 
168 ".popsection;                                  << 
169 extern struct btf_id_set name;                 << 
170                                                << 
171 /*                                             << 
172  * The BTF_SET8_START/END macros pair defines  << 
173  * BTF IDs and their flags plus its members co << 
174  * following layout:                           << 
175  *                                             << 
176  * BTF_SET8_START(list)                        << 
177  * BTF_ID_FLAGS(type1, name1, flags)           << 
178  * BTF_ID_FLAGS(type2, name2, flags)           << 
179  * BTF_SET8_END(list)                          << 
180  *                                             << 
181  * __BTF_ID__set8__list:                       << 
182  * .zero 8                                     << 
183  * list:                                       << 
184  * __BTF_ID__type1__name1__3:                  << 
185  * .zero 4                                     << 
186  * .word (1 << 0) | (1 << 2)                   << 
187  * __BTF_ID__type2__name2__5:                  << 
188  * .zero 4                                     << 
189  * .word (1 << 3) | (1 << 1) | (1 << 2)        << 
190  *                                             << 
191  */                                            << 
192 #define __BTF_SET8_START(name, scope, flags)   << 
193 __BTF_ID_LIST(name, local)                     << 
194 asm(                                           << 
195 ".pushsection " BTF_IDS_SECTION ",\"a\";       << 
196 "." #scope " __BTF_ID__set8__" #name ";        << 
197 "__BTF_ID__set8__" #name ":;                   << 
198 ".zero 4                                       << 
199 ".long " __stringify(flags)                    << 
200 ".popsection;                                  << 
201                                                << 
202 #define BTF_SET8_START(name)                   << 
203 __BTF_SET8_START(name, local, 0)               << 
204                                                << 
205 #define BTF_SET8_END(name)                     << 
206 asm(                                           << 
207 ".pushsection " BTF_IDS_SECTION ",\"a\";       << 
208 ".size __BTF_ID__set8__" #name ", .-" #name "  << 
209 ".popsection;                                  << 
210 extern struct btf_id_set8 name;                << 
211                                                << 
212 #define BTF_KFUNCS_START(name)                 << 
213 __BTF_SET8_START(name, local, BTF_SET8_KFUNCS) << 
214                                                << 
215 #define BTF_KFUNCS_END(name)                   << 
216 BTF_SET8_END(name)                             << 
217                                                << 
218 #else                                              91 #else
219                                                    92 
220 #define BTF_ID_LIST(name) static u32 __maybe_u !!  93 #define BTF_ID_LIST(name) static u32 name[5];
221 #define BTF_ID(prefix, name)                       94 #define BTF_ID(prefix, name)
222 #define BTF_ID_FLAGS(prefix, name, ...)        << 
223 #define BTF_ID_UNUSED                              95 #define BTF_ID_UNUSED
224 #define BTF_ID_LIST_GLOBAL(name, n) u32 __mayb !!  96 #define BTF_ID_LIST_GLOBAL(name) u32 name[1];
225 #define BTF_ID_LIST_SINGLE(name, prefix, typen << 
226 #define BTF_ID_LIST_GLOBAL_SINGLE(name, prefix << 
227 #define BTF_SET_START(name) static struct btf_ << 
228 #define BTF_SET_START_GLOBAL(name) static stru << 
229 #define BTF_SET_END(name)                      << 
230 #define BTF_SET8_START(name) static struct btf << 
231 #define BTF_SET8_END(name)                     << 
232 #define BTF_KFUNCS_START(name) static struct b << 
233 #define BTF_KFUNCS_END(name)                   << 
234                                                    97 
235 #endif /* CONFIG_DEBUG_INFO_BTF */                 98 #endif /* CONFIG_DEBUG_INFO_BTF */
236                                                    99 
237 #ifdef CONFIG_NET                                 100 #ifdef CONFIG_NET
238 /* Define a list of socket types which can be     101 /* Define a list of socket types which can be the argument for
239  * skc_to_*_sock() helpers. All these sockets     102  * skc_to_*_sock() helpers. All these sockets should have
240  * sock_common as the first argument in its me    103  * sock_common as the first argument in its memory layout.
241  */                                               104  */
242 #define BTF_SOCK_TYPE_xxx \                       105 #define BTF_SOCK_TYPE_xxx \
243         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET, inet    106         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET, inet_sock)                    \
244         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_CONN,    107         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_CONN, inet_connection_sock)    \
245         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_REQ,     108         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_REQ, inet_request_sock)        \
246         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_TW, i    109         BTF_SOCK_TYPE(BTF_SOCK_TYPE_INET_TW, inet_timewait_sock)        \
247         BTF_SOCK_TYPE(BTF_SOCK_TYPE_REQ, reque    110         BTF_SOCK_TYPE(BTF_SOCK_TYPE_REQ, request_sock)                  \
248         BTF_SOCK_TYPE(BTF_SOCK_TYPE_SOCK, sock    111         BTF_SOCK_TYPE(BTF_SOCK_TYPE_SOCK, sock)                         \
249         BTF_SOCK_TYPE(BTF_SOCK_TYPE_SOCK_COMMO    112         BTF_SOCK_TYPE(BTF_SOCK_TYPE_SOCK_COMMON, sock_common)           \
250         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP, tcp_s    113         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP, tcp_sock)                      \
251         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP_REQ, t    114         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP_REQ, tcp_request_sock)          \
252         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP_TW, tc    115         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP_TW, tcp_timewait_sock)          \
253         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP6, tcp6    116         BTF_SOCK_TYPE(BTF_SOCK_TYPE_TCP6, tcp6_sock)                    \
254         BTF_SOCK_TYPE(BTF_SOCK_TYPE_UDP, udp_s    117         BTF_SOCK_TYPE(BTF_SOCK_TYPE_UDP, udp_sock)                      \
255         BTF_SOCK_TYPE(BTF_SOCK_TYPE_UDP6, udp6 !! 118         BTF_SOCK_TYPE(BTF_SOCK_TYPE_UDP6, udp6_sock)
256         BTF_SOCK_TYPE(BTF_SOCK_TYPE_UNIX, unix << 
257         BTF_SOCK_TYPE(BTF_SOCK_TYPE_MPTCP, mpt << 
258         BTF_SOCK_TYPE(BTF_SOCK_TYPE_SOCKET, so << 
259                                                   119 
260 enum {                                            120 enum {
261 #define BTF_SOCK_TYPE(name, str) name,            121 #define BTF_SOCK_TYPE(name, str) name,
262 BTF_SOCK_TYPE_xxx                                 122 BTF_SOCK_TYPE_xxx
263 #undef BTF_SOCK_TYPE                              123 #undef BTF_SOCK_TYPE
264 MAX_BTF_SOCK_TYPE,                                124 MAX_BTF_SOCK_TYPE,
265 };                                                125 };
266                                                   126 
267 extern u32 btf_sock_ids[];                        127 extern u32 btf_sock_ids[];
268 #endif                                            128 #endif
269                                                << 
270 #define BTF_TRACING_TYPE_xxx    \              << 
271         BTF_TRACING_TYPE(BTF_TRACING_TYPE_TASK << 
272         BTF_TRACING_TYPE(BTF_TRACING_TYPE_FILE << 
273         BTF_TRACING_TYPE(BTF_TRACING_TYPE_VMA, << 
274                                                << 
275 enum {                                         << 
276 #define BTF_TRACING_TYPE(name, type) name,     << 
277 BTF_TRACING_TYPE_xxx                           << 
278 #undef BTF_TRACING_TYPE                        << 
279 MAX_BTF_TRACING_TYPE,                          << 
280 };                                             << 
281                                                << 
282 extern u32 btf_tracing_ids[];                  << 
283 extern u32 bpf_cgroup_btf_id[];                << 
284 extern u32 bpf_local_storage_map_btf_id[];     << 
285 extern u32 btf_bpf_map_id[];                   << 
286                                                   129 
287 #endif                                            130 #endif
288                                                   131 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php