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