xref: /linux/tools/testing/selftests/bpf/btf_helpers.h (revision 26fbb4c8c7c3ee9a4c3b4de555a8587b5a19154e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2020 Facebook */
3 #ifndef __BTF_HELPERS_H
4 #define __BTF_HELPERS_H
5 
6 #include <stdio.h>
7 #include <bpf/btf.h>
8 
9 int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id);
10 const char *btf_type_raw_dump(const struct btf *btf, int type_id);
11 int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]);
12 
13 #define VALIDATE_RAW_BTF(btf, raw_types...)				\
14 	btf_validate_raw(btf,						\
15 			 sizeof((const char *[]){raw_types})/sizeof(void *),\
16 			 (const char *[]){raw_types})
17 
18 const char *btf_type_c_dump(const struct btf *btf);
19 #endif
20