11306c980SAndrii Nakryiko /* SPDX-License-Identifier: GPL-2.0 */ 21306c980SAndrii Nakryiko /* Copyright (c) 2020 Facebook */ 31306c980SAndrii Nakryiko #ifndef __BTF_HELPERS_H 41306c980SAndrii Nakryiko #define __BTF_HELPERS_H 51306c980SAndrii Nakryiko 61306c980SAndrii Nakryiko #include <stdio.h> 71306c980SAndrii Nakryiko #include <bpf/btf.h> 81306c980SAndrii Nakryiko 91306c980SAndrii Nakryiko int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id); 101306c980SAndrii Nakryiko const char *btf_type_raw_dump(const struct btf *btf, int type_id); 11*232338faSAndrii Nakryiko int btf_validate_raw(struct btf *btf, int nr_types, const char *exp_types[]); 121306c980SAndrii Nakryiko 13*232338faSAndrii Nakryiko #define VALIDATE_RAW_BTF(btf, raw_types...) \ 14*232338faSAndrii Nakryiko btf_validate_raw(btf, \ 15*232338faSAndrii Nakryiko sizeof((const char *[]){raw_types})/sizeof(void *),\ 16*232338faSAndrii Nakryiko (const char *[]){raw_types}) 17*232338faSAndrii Nakryiko 18*232338faSAndrii Nakryiko const char *btf_type_c_dump(const struct btf *btf); 191306c980SAndrii Nakryiko #endif 20