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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/btf.h (Version linux-6.12-rc7) and /include/linux/btf.h (Version linux-5.0.21)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* Copyright (c) 2018 Facebook */                   2 /* Copyright (c) 2018 Facebook */
  3                                                     3 
  4 #ifndef _LINUX_BTF_H                                4 #ifndef _LINUX_BTF_H
  5 #define _LINUX_BTF_H 1                              5 #define _LINUX_BTF_H 1
  6                                                     6 
  7 #include <linux/types.h>                            7 #include <linux/types.h>
  8 #include <linux/bpfptr.h>                      << 
  9 #include <linux/bsearch.h>                     << 
 10 #include <linux/btf_ids.h>                     << 
 11 #include <uapi/linux/btf.h>                    << 
 12 #include <uapi/linux/bpf.h>                    << 
 13                                                << 
 14 #define BTF_TYPE_EMIT(type) ((void)(type *)0)  << 
 15 #define BTF_TYPE_EMIT_ENUM(enum_val) ((void)en << 
 16                                                << 
 17 /* These need to be macros, as the expressions << 
 18 #define KF_ACQUIRE      (1 << 0) /* kfunc is a << 
 19 #define KF_RELEASE      (1 << 1) /* kfunc is a << 
 20 #define KF_RET_NULL     (1 << 2) /* kfunc retu << 
 21 /* Trusted arguments are those which are guara << 
 22  * the kfunc. It is used to enforce that point << 
 23  * kfuncs, or from the main kernel on a tracep << 
 24  * invocation, remain unmodified when being pa << 
 25  * args.                                       << 
 26  *                                             << 
 27  * Consider, for example, the following new ta << 
 28  *                                             << 
 29  *      SEC("tp_btf/task_newtask")             << 
 30  *      int BPF_PROG(new_task_tp, struct task_ << 
 31  *      {                                      << 
 32  *              ...                            << 
 33  *      }                                      << 
 34  *                                             << 
 35  * And the following kfunc:                    << 
 36  *                                             << 
 37  *      BTF_ID_FLAGS(func, bpf_task_acquire, K << 
 38  *                                             << 
 39  * All invocations to the kfunc must pass the  << 
 40  *                                             << 
 41  *      bpf_task_acquire(task);             // << 
 42  *      bpf_task_acquire(task->last_wakee); // << 
 43  *                                             << 
 44  * Programs may also pass referenced tasks dir << 
 45  *                                             << 
 46  *      struct task_struct *acquired;          << 
 47  *                                             << 
 48  *      acquired = bpf_task_acquire(task);     << 
 49  *      bpf_task_acquire(acquired);            << 
 50  *      bpf_task_acquire(task);                << 
 51  *      bpf_task_acquire(acquired->last_wakee) << 
 52  *                                             << 
 53  * Programs may _not_, however, pass a task fr << 
 54  * kprobe/kretprobe to the kfunc, as BPF canno << 
 55  * pointers are guaranteed to be safe. For exa << 
 56  * would be rejected:                          << 
 57  *                                             << 
 58  * SEC("kretprobe/free_task")                  << 
 59  * int BPF_PROG(free_task_probe, struct task_s << 
 60  * {                                           << 
 61  *      struct task_struct *acquired;          << 
 62  *                                             << 
 63  *      acquired = bpf_task_acquire(acquired); << 
 64  *      bpf_task_release(acquired);            << 
 65  *                                             << 
 66  *      return 0;                              << 
 67  * }                                           << 
 68  */                                            << 
 69 #define KF_TRUSTED_ARGS (1 << 4) /* kfunc only << 
 70 #define KF_SLEEPABLE    (1 << 5) /* kfunc may  << 
 71 #define KF_DESTRUCTIVE  (1 << 6) /* kfunc perf << 
 72 #define KF_RCU          (1 << 7) /* kfunc take << 
 73 /* only one of KF_ITER_{NEW,NEXT,DESTROY} coul << 
 74 #define KF_ITER_NEW     (1 << 8) /* kfunc impl << 
 75 #define KF_ITER_NEXT    (1 << 9) /* kfunc impl << 
 76 #define KF_ITER_DESTROY (1 << 10) /* kfunc imp << 
 77 #define KF_RCU_PROTECTED (1 << 11) /* kfunc sh << 
 78                                                << 
 79 /*                                             << 
 80  * Tag marking a kernel function as a kfunc. T << 
 81  * amount of copy-paste that kfunc authors hav << 
 82  * as to avoid issues such as the compiler inl << 
 83  * kfunc, or a global kfunc in an LTO build.   << 
 84  */                                            << 
 85 #define __bpf_kfunc __used __retain noinline   << 
 86                                                << 
 87 #define __bpf_kfunc_start_defs()               << 
 88         __diag_push();                         << 
 89         __diag_ignore_all("-Wmissing-declarati << 
 90                           "Global kfuncs as th << 
 91         __diag_ignore_all("-Wmissing-prototype << 
 92                           "Global kfuncs as th << 
 93                                                << 
 94 #define __bpf_kfunc_end_defs() __diag_pop()    << 
 95 #define __bpf_hook_start() __bpf_kfunc_start_d << 
 96 #define __bpf_hook_end() __bpf_kfunc_end_defs( << 
 97                                                << 
 98 /*                                             << 
 99  * Return the name of the passed struct, if ex << 
100  * example the structure gets renamed. In this << 
101  * the code using that structure name, and upd << 
102  */                                            << 
103 #define stringify_struct(x)                    << 
104         ({ BUILD_BUG_ON(sizeof(struct x) < 0); << 
105            __stringify(x); })                  << 
106                                                     8 
107 struct btf;                                         9 struct btf;
108 struct btf_member;                                 10 struct btf_member;
109 struct btf_type;                                   11 struct btf_type;
110 union bpf_attr;                                    12 union bpf_attr;
111 struct btf_show;                               << 
112 struct btf_id_set;                             << 
113 struct bpf_prog;                               << 
114                                                << 
115 typedef int (*btf_kfunc_filter_t)(const struct << 
116                                                << 
117 struct btf_kfunc_id_set {                      << 
118         struct module *owner;                  << 
119         struct btf_id_set8 *set;               << 
120         btf_kfunc_filter_t filter;             << 
121 };                                             << 
122                                                << 
123 struct btf_id_dtor_kfunc {                     << 
124         u32 btf_id;                            << 
125         u32 kfunc_btf_id;                      << 
126 };                                             << 
127                                                << 
128 struct btf_struct_meta {                       << 
129         u32 btf_id;                            << 
130         struct btf_record *record;             << 
131 };                                             << 
132                                                << 
133 struct btf_struct_metas {                      << 
134         u32 cnt;                               << 
135         struct btf_struct_meta types[];        << 
136 };                                             << 
137                                                    13 
138 extern const struct file_operations btf_fops;      14 extern const struct file_operations btf_fops;
139                                                    15 
140 const char *btf_get_name(const struct btf *btf << 
141 void btf_get(struct btf *btf);                 << 
142 void btf_put(struct btf *btf);                     16 void btf_put(struct btf *btf);
143 const struct btf_header *btf_header(const stru !!  17 int btf_new_fd(const union bpf_attr *attr);
144 int btf_new_fd(const union bpf_attr *attr, bpf << 
145 struct btf *btf_get_by_fd(int fd);                 18 struct btf *btf_get_by_fd(int fd);
146 int btf_get_info_by_fd(const struct btf *btf,      19 int btf_get_info_by_fd(const struct btf *btf,
147                        const union bpf_attr *a     20                        const union bpf_attr *attr,
148                        union bpf_attr __user *     21                        union bpf_attr __user *uattr);
149 /* Figure out the size of a type_id.  If type_     22 /* Figure out the size of a type_id.  If type_id is a modifier
150  * (e.g. const), it will be resolved to find o     23  * (e.g. const), it will be resolved to find out the type with size.
151  *                                                 24  *
152  * For example:                                    25  * For example:
153  * In describing "const void *",  type_id is "     26  * In describing "const void *",  type_id is "const" and "const"
154  * refers to "void *".  The return type will b     27  * refers to "void *".  The return type will be "void *".
155  *                                                 28  *
156  * If type_id is a simple "int", then return t     29  * If type_id is a simple "int", then return type will be "int".
157  *                                                 30  *
158  * @btf: struct btf object                         31  * @btf: struct btf object
159  * @type_id: Find out the size of type_id. The     32  * @type_id: Find out the size of type_id. The type_id of the return
160  *           type is set to *type_id.              33  *           type is set to *type_id.
161  * @ret_size: It can be NULL.  If not NULL, th     34  * @ret_size: It can be NULL.  If not NULL, the size of the return
162  *            type is set to *ret_size.            35  *            type is set to *ret_size.
163  * Return: The btf_type (resolved to another t     36  * Return: The btf_type (resolved to another type with size info if needed).
164  *         NULL is returned if type_id itself      37  *         NULL is returned if type_id itself does not have size info
165  *         (e.g. void) or it cannot be resolve     38  *         (e.g. void) or it cannot be resolved to another type that
166  *         has size info.                          39  *         has size info.
167  *         *type_id and *ret_size will not be      40  *         *type_id and *ret_size will not be changed in the
168  *         NULL return case.                       41  *         NULL return case.
169  */                                                42  */
170 const struct btf_type *btf_type_id_size(const      43 const struct btf_type *btf_type_id_size(const struct btf *btf,
171                                         u32 *t     44                                         u32 *type_id,
172                                         u32 *r     45                                         u32 *ret_size);
173                                                << 
174 /*                                             << 
175  * Options to control show behaviour.          << 
176  *      - BTF_SHOW_COMPACT: no formatting arou << 
177  *      - BTF_SHOW_NONAME: no struct/union mem << 
178  *      - BTF_SHOW_PTR_RAW: show raw (unobfusc << 
179  *        equivalent to %px.                   << 
180  *      - BTF_SHOW_ZERO: show zero-valued stru << 
181  *        are not displayed by default         << 
182  *      - BTF_SHOW_UNSAFE: skip use of bpf_pro << 
183  *        data before displaying it.           << 
184  */                                            << 
185 #define BTF_SHOW_COMPACT        BTF_F_COMPACT  << 
186 #define BTF_SHOW_NONAME         BTF_F_NONAME   << 
187 #define BTF_SHOW_PTR_RAW        BTF_F_PTR_RAW  << 
188 #define BTF_SHOW_ZERO           BTF_F_ZERO     << 
189 #define BTF_SHOW_UNSAFE         (1ULL << 4)    << 
190                                                << 
191 void btf_type_seq_show(const struct btf *btf,      46 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
192                        struct seq_file *m);        47                        struct seq_file *m);
193 int btf_type_seq_show_flags(const struct btf * << 
194                             struct seq_file *m << 
195                                                << 
196 /*                                             << 
197  * Copy len bytes of string representation of  << 
198  *                                             << 
199  * @btf: struct btf object                     << 
200  * @type_id: type id of type obj points to     << 
201  * @obj: pointer to typed data                 << 
202  * @buf: buffer to write to                    << 
203  * @len: maximum length to write to buf        << 
204  * @flags: show options (see above)            << 
205  *                                             << 
206  * Return: length that would have been/was cop << 
207  *         negative error.                     << 
208  */                                            << 
209 int btf_type_snprintf_show(const struct btf *b << 
210                            char *buf, int len, << 
211                                                << 
212 int btf_get_fd_by_id(u32 id);                      48 int btf_get_fd_by_id(u32 id);
213 u32 btf_obj_id(const struct btf *btf);         !!  49 u32 btf_id(const struct btf *btf);
214 bool btf_is_kernel(const struct btf *btf);     << 
215 bool btf_is_module(const struct btf *btf);     << 
216 bool btf_is_vmlinux(const struct btf *btf);    << 
217 struct module *btf_try_get_module(const struct << 
218 u32 btf_nr_types(const struct btf *btf);       << 
219 struct btf *btf_base_btf(const struct btf *btf << 
220 bool btf_member_is_reg_int(const struct btf *b     50 bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s,
221                            const struct btf_me     51                            const struct btf_member *m,
222                            u32 expected_offset     52                            u32 expected_offset, u32 expected_size);
223 struct btf_record *btf_parse_fields(const stru << 
224                                     u32 field_ << 
225 int btf_check_and_fixup_fields(const struct bt << 
226 bool btf_type_is_void(const struct btf_type *t << 
227 s32 btf_find_by_name_kind(const struct btf *bt << 
228 s32 bpf_find_btf_id(const char *name, u32 kind << 
229 const struct btf_type *btf_type_skip_modifiers << 
230                                                << 
231 const struct btf_type *btf_type_resolve_ptr(co << 
232                                             u3 << 
233 const struct btf_type *btf_type_resolve_func_p << 
234                                                << 
235 const struct btf_type *                        << 
236 btf_resolve_size(const struct btf *btf, const  << 
237                  u32 *type_size);              << 
238 const char *btf_type_str(const struct btf_type << 
239                                                << 
240 #define for_each_member(i, struct_type, member << 
241         for (i = 0, member = btf_type_member(s << 
242              i < btf_type_vlen(struct_type);   << 
243              i++, member++)                    << 
244                                                << 
245 #define for_each_vsi(i, datasec_type, member)  << 
246         for (i = 0, member = btf_type_var_seci << 
247              i < btf_type_vlen(datasec_type);  << 
248              i++, member++)                    << 
249                                                << 
250 static inline bool btf_type_is_ptr(const struc << 
251 {                                              << 
252         return BTF_INFO_KIND(t->info) == BTF_K << 
253 }                                              << 
254                                                << 
255 static inline bool btf_type_is_int(const struc << 
256 {                                              << 
257         return BTF_INFO_KIND(t->info) == BTF_K << 
258 }                                              << 
259                                                << 
260 static inline bool btf_type_is_small_int(const << 
261 {                                              << 
262         return btf_type_is_int(t) && t->size < << 
263 }                                              << 
264                                                << 
265 static inline u8 btf_int_encoding(const struct << 
266 {                                              << 
267         return BTF_INT_ENCODING(*(u32 *)(t + 1 << 
268 }                                              << 
269                                                << 
270 static inline bool btf_type_is_signed_int(cons << 
271 {                                              << 
272         return btf_type_is_int(t) && (btf_int_ << 
273 }                                              << 
274                                                << 
275 static inline bool btf_type_is_enum(const stru << 
276 {                                              << 
277         return BTF_INFO_KIND(t->info) == BTF_K << 
278 }                                              << 
279                                                << 
280 static inline bool btf_is_any_enum(const struc << 
281 {                                              << 
282         return BTF_INFO_KIND(t->info) == BTF_K << 
283                BTF_INFO_KIND(t->info) == BTF_K << 
284 }                                              << 
285                                                << 
286 static inline bool btf_kind_core_compat(const  << 
287                                         const  << 
288 {                                              << 
289         return BTF_INFO_KIND(t1->info) == BTF_ << 
290                (btf_is_any_enum(t1) && btf_is_ << 
291 }                                              << 
292                                                << 
293 static inline bool str_is_empty(const char *s) << 
294 {                                              << 
295         return !s || !s[0];                    << 
296 }                                              << 
297                                                << 
298 static inline u16 btf_kind(const struct btf_ty << 
299 {                                              << 
300         return BTF_INFO_KIND(t->info);         << 
301 }                                              << 
302                                                << 
303 static inline bool btf_is_enum(const struct bt << 
304 {                                              << 
305         return btf_kind(t) == BTF_KIND_ENUM;   << 
306 }                                              << 
307                                                << 
308 static inline bool btf_is_enum64(const struct  << 
309 {                                              << 
310         return btf_kind(t) == BTF_KIND_ENUM64; << 
311 }                                              << 
312                                                << 
313 static inline u64 btf_enum64_value(const struc << 
314 {                                              << 
315         return ((u64)e->val_hi32 << 32) | e->v << 
316 }                                              << 
317                                                << 
318 static inline bool btf_is_composite(const stru << 
319 {                                              << 
320         u16 kind = btf_kind(t);                << 
321                                                << 
322         return kind == BTF_KIND_STRUCT || kind << 
323 }                                              << 
324                                                << 
325 static inline bool btf_is_array(const struct b << 
326 {                                              << 
327         return btf_kind(t) == BTF_KIND_ARRAY;  << 
328 }                                              << 
329                                                << 
330 static inline bool btf_is_int(const struct btf << 
331 {                                              << 
332         return btf_kind(t) == BTF_KIND_INT;    << 
333 }                                              << 
334                                                << 
335 static inline bool btf_is_ptr(const struct btf << 
336 {                                              << 
337         return btf_kind(t) == BTF_KIND_PTR;    << 
338 }                                              << 
339                                                << 
340 static inline u8 btf_int_offset(const struct b << 
341 {                                              << 
342         return BTF_INT_OFFSET(*(u32 *)(t + 1)) << 
343 }                                              << 
344                                                << 
345 static inline __u8 btf_int_bits(const struct b << 
346 {                                              << 
347         return BTF_INT_BITS(*(__u32 *)(t + 1)) << 
348 }                                              << 
349                                                << 
350 static inline bool btf_type_is_scalar(const st << 
351 {                                              << 
352         return btf_type_is_int(t) || btf_type_ << 
353 }                                              << 
354                                                << 
355 static inline bool btf_type_is_typedef(const s << 
356 {                                              << 
357         return BTF_INFO_KIND(t->info) == BTF_K << 
358 }                                              << 
359                                                << 
360 static inline bool btf_type_is_volatile(const  << 
361 {                                              << 
362         return BTF_INFO_KIND(t->info) == BTF_K << 
363 }                                              << 
364                                                << 
365 static inline bool btf_type_is_func(const stru << 
366 {                                              << 
367         return BTF_INFO_KIND(t->info) == BTF_K << 
368 }                                              << 
369                                                << 
370 static inline bool btf_type_is_func_proto(cons << 
371 {                                              << 
372         return BTF_INFO_KIND(t->info) == BTF_K << 
373 }                                              << 
374                                                << 
375 static inline bool btf_type_is_var(const struc << 
376 {                                              << 
377         return BTF_INFO_KIND(t->info) == BTF_K << 
378 }                                              << 
379                                                << 
380 static inline bool btf_type_is_type_tag(const  << 
381 {                                              << 
382         return BTF_INFO_KIND(t->info) == BTF_K << 
383 }                                              << 
384                                                << 
385 /* union is only a special case of struct:     << 
386  * all its offsetof(member) == 0               << 
387  */                                            << 
388 static inline bool btf_type_is_struct(const st << 
389 {                                              << 
390         u8 kind = BTF_INFO_KIND(t->info);      << 
391                                                << 
392         return kind == BTF_KIND_STRUCT || kind << 
393 }                                              << 
394                                                << 
395 static inline bool __btf_type_is_struct(const  << 
396 {                                              << 
397         return BTF_INFO_KIND(t->info) == BTF_K << 
398 }                                              << 
399                                                << 
400 static inline bool btf_type_is_array(const str << 
401 {                                              << 
402         return BTF_INFO_KIND(t->info) == BTF_K << 
403 }                                              << 
404                                                << 
405 static inline u16 btf_type_vlen(const struct b << 
406 {                                              << 
407         return BTF_INFO_VLEN(t->info);         << 
408 }                                              << 
409                                                << 
410 static inline u16 btf_vlen(const struct btf_ty << 
411 {                                              << 
412         return btf_type_vlen(t);               << 
413 }                                              << 
414                                                << 
415 static inline u16 btf_func_linkage(const struc << 
416 {                                              << 
417         return BTF_INFO_VLEN(t->info);         << 
418 }                                              << 
419                                                << 
420 static inline bool btf_type_kflag(const struct << 
421 {                                              << 
422         return BTF_INFO_KFLAG(t->info);        << 
423 }                                              << 
424                                                << 
425 static inline u32 __btf_member_bit_offset(cons << 
426                                           cons << 
427 {                                              << 
428         return btf_type_kflag(struct_type) ? B << 
429                                            : m << 
430 }                                              << 
431                                                << 
432 static inline u32 __btf_member_bitfield_size(c << 
433                                              c << 
434 {                                              << 
435         return btf_type_kflag(struct_type) ? B << 
436                                            : 0 << 
437 }                                              << 
438                                                << 
439 static inline struct btf_member *btf_members(c << 
440 {                                              << 
441         return (struct btf_member *)(t + 1);   << 
442 }                                              << 
443                                                << 
444 static inline u32 btf_member_bit_offset(const  << 
445 {                                              << 
446         const struct btf_member *m = btf_membe << 
447                                                << 
448         return __btf_member_bit_offset(t, m);  << 
449 }                                              << 
450                                                << 
451 static inline u32 btf_member_bitfield_size(con << 
452 {                                              << 
453         const struct btf_member *m = btf_membe << 
454                                                << 
455         return __btf_member_bitfield_size(t, m << 
456 }                                              << 
457                                                << 
458 static inline const struct btf_member *btf_typ << 
459 {                                              << 
460         return (const struct btf_member *)(t + << 
461 }                                              << 
462                                                << 
463 static inline struct btf_array *btf_array(cons << 
464 {                                              << 
465         return (struct btf_array *)(t + 1);    << 
466 }                                              << 
467                                                << 
468 static inline struct btf_enum *btf_enum(const  << 
469 {                                              << 
470         return (struct btf_enum *)(t + 1);     << 
471 }                                              << 
472                                                << 
473 static inline struct btf_enum64 *btf_enum64(co << 
474 {                                              << 
475         return (struct btf_enum64 *)(t + 1);   << 
476 }                                              << 
477                                                << 
478 static inline const struct btf_var_secinfo *bt << 
479                 const struct btf_type *t)      << 
480 {                                              << 
481         return (const struct btf_var_secinfo * << 
482 }                                              << 
483                                                << 
484 static inline struct btf_param *btf_params(con << 
485 {                                              << 
486         return (struct btf_param *)(t + 1);    << 
487 }                                              << 
488                                                << 
489 static inline struct btf_decl_tag *btf_decl_ta << 
490 {                                              << 
491         return (struct btf_decl_tag *)(t + 1); << 
492 }                                              << 
493                                                << 
494 static inline int btf_id_cmp_func(const void * << 
495 {                                              << 
496         const int *pa = a, *pb = b;            << 
497                                                << 
498         return *pa - *pb;                      << 
499 }                                              << 
500                                                << 
501 static inline bool btf_id_set_contains(const s << 
502 {                                              << 
503         return bsearch(&id, set->ids, set->cnt << 
504 }                                              << 
505                                                << 
506 static inline void *btf_id_set8_contains(const << 
507 {                                              << 
508         return bsearch(&id, set->pairs, set->c << 
509 }                                              << 
510                                                << 
511 bool btf_param_match_suffix(const struct btf * << 
512                             const struct btf_p << 
513                             const char *suffix << 
514 int btf_ctx_arg_offset(const struct btf *btf,  << 
515                        u32 arg_no);            << 
516                                                << 
517 struct bpf_verifier_log;                       << 
518                                                << 
519 #if defined(CONFIG_BPF_JIT) && defined(CONFIG_ << 
520 struct bpf_struct_ops;                         << 
521 int __register_bpf_struct_ops(struct bpf_struc << 
522 const struct bpf_struct_ops_desc *bpf_struct_o << 
523 const struct bpf_struct_ops_desc *bpf_struct_o << 
524 #else                                          << 
525 static inline const struct bpf_struct_ops_desc << 
526 {                                              << 
527         return NULL;                           << 
528 }                                              << 
529 #endif                                         << 
530                                                << 
531 enum btf_field_iter_kind {                     << 
532         BTF_FIELD_ITER_IDS,                    << 
533         BTF_FIELD_ITER_STRS,                   << 
534 };                                             << 
535                                                << 
536 struct btf_field_desc {                        << 
537         /* once-per-type offsets */            << 
538         int t_off_cnt, t_offs[2];              << 
539         /* member struct size, or zero, if no  << 
540         int m_sz;                              << 
541         /* repeated per-member offsets */      << 
542         int m_off_cnt, m_offs[1];              << 
543 };                                             << 
544                                                << 
545 struct btf_field_iter {                        << 
546         struct btf_field_desc desc;            << 
547         void *p;                               << 
548         int m_idx;                             << 
549         int off_idx;                           << 
550         int vlen;                              << 
551 };                                             << 
552                                                    53 
553 #ifdef CONFIG_BPF_SYSCALL                          54 #ifdef CONFIG_BPF_SYSCALL
554 const struct btf_type *btf_type_by_id(const st     55 const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);
555 void btf_set_base_btf(struct btf *btf, const s << 
556 int btf_relocate(struct btf *btf, const struct << 
557 int btf_field_iter_init(struct btf_field_iter  << 
558                         enum btf_field_iter_ki << 
559 __u32 *btf_field_iter_next(struct btf_field_it << 
560                                                << 
561 const char *btf_name_by_offset(const struct bt     56 const char *btf_name_by_offset(const struct btf *btf, u32 offset);
562 const char *btf_str_by_offset(const struct btf << 
563 struct btf *btf_parse_vmlinux(void);           << 
564 struct btf *bpf_prog_get_target_btf(const stru << 
565 u32 *btf_kfunc_id_set_contains(const struct bt << 
566                                const struct bp << 
567 u32 *btf_kfunc_is_modify_return(const struct b << 
568                                 const struct b << 
569 int register_btf_kfunc_id_set(enum bpf_prog_ty << 
570                               const struct btf << 
571 int register_btf_fmodret_id_set(const struct b << 
572 s32 btf_find_dtor_kfunc(struct btf *btf, u32 b << 
573 int register_btf_id_dtor_kfuncs(const struct b << 
574                                 struct module  << 
575 struct btf_struct_meta *btf_find_struct_meta(c << 
576 bool btf_is_projection_of(const char *pname, c << 
577 bool btf_is_prog_ctx_type(struct bpf_verifier_ << 
578                            const struct btf_ty << 
579                            int arg);           << 
580 int get_kern_ctx_btf_id(struct bpf_verifier_lo << 
581 bool btf_types_are_same(const struct btf *btf1 << 
582                         const struct btf *btf2 << 
583 int btf_check_iter_arg(struct btf *btf, const  << 
584 #else                                              57 #else
585 static inline const struct btf_type *btf_type_     58 static inline const struct btf_type *btf_type_by_id(const struct btf *btf,
586                                                    59                                                     u32 type_id)
587 {                                                  60 {
588         return NULL;                               61         return NULL;
589 }                                                  62 }
590                                                << 
591 static inline void btf_set_base_btf(struct btf << 
592 {                                              << 
593 }                                              << 
594                                                << 
595 static inline int btf_relocate(void *log, stru << 
596                                __u32 **map_ids << 
597 {                                              << 
598         return -EOPNOTSUPP;                    << 
599 }                                              << 
600                                                << 
601 static inline int btf_field_iter_init(struct b << 
602                                       enum btf << 
603 {                                              << 
604         return -EOPNOTSUPP;                    << 
605 }                                              << 
606                                                << 
607 static inline __u32 *btf_field_iter_next(struc << 
608 {                                              << 
609         return NULL;                           << 
610 }                                              << 
611                                                << 
612 static inline const char *btf_name_by_offset(c     63 static inline const char *btf_name_by_offset(const struct btf *btf,
613                                              u     64                                              u32 offset)
614 {                                                  65 {
615         return NULL;                               66         return NULL;
616 }                                                  67 }
617 static inline u32 *btf_kfunc_id_set_contains(c << 
618                                              u << 
619                                              s << 
620                                                << 
621 {                                              << 
622         return NULL;                           << 
623 }                                              << 
624 static inline int register_btf_kfunc_id_set(en << 
625                                             co << 
626 {                                              << 
627         return 0;                              << 
628 }                                              << 
629 static inline s32 btf_find_dtor_kfunc(struct b << 
630 {                                              << 
631         return -ENOENT;                        << 
632 }                                              << 
633 static inline int register_btf_id_dtor_kfuncs( << 
634                                                << 
635 {                                              << 
636         return 0;                              << 
637 }                                              << 
638 static inline struct btf_struct_meta *btf_find << 
639 {                                              << 
640         return NULL;                           << 
641 }                                              << 
642 static inline bool                             << 
643 btf_is_prog_ctx_type(struct bpf_verifier_log * << 
644                      const struct btf_type *t, << 
645                      int arg)                  << 
646 {                                              << 
647         return false;                          << 
648 }                                              << 
649 static inline int get_kern_ctx_btf_id(struct b << 
650                                       enum bpf << 
651         return -EINVAL;                        << 
652 }                                              << 
653 static inline bool btf_types_are_same(const st << 
654                                       const st << 
655 {                                              << 
656         return false;                          << 
657 }                                              << 
658 static inline int btf_check_iter_arg(struct bt << 
659 {                                              << 
660         return -EOPNOTSUPP;                    << 
661 }                                              << 
662 #endif                                             68 #endif
663                                                << 
664 static inline bool btf_type_is_struct_ptr(stru << 
665 {                                              << 
666         if (!btf_type_is_ptr(t))               << 
667                 return false;                  << 
668                                                << 
669         t = btf_type_skip_modifiers(btf, t->ty << 
670                                                << 
671         return btf_type_is_struct(t);          << 
672 }                                              << 
673                                                    69 
674 #endif                                             70 #endif
675                                                    71 

~ [ 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