blob: 4897e0724d4ec6180e1262338ef6bd0e9fd72ab9 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: LGPL-2.1 */
2/* Copyright (c) 2018 Facebook */
3
4#ifndef __BPF_BTF_H
5#define __BPF_BTF_H
6
7#include <linux/types.h>
8
9#define BTF_ELF_SEC ".BTF"
10
11struct btf;
12struct btf_type;
13
14typedef int (*btf_print_fn_t)(const char *, ...)
15 __attribute__((format(printf, 1, 2)));
16
17void btf__free(struct btf *btf);
18struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
19__s32 btf__find_by_name(const struct btf *btf, const char *type_name);
20const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id);
21__s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
22int btf__resolve_type(const struct btf *btf, __u32 type_id);
23int btf__fd(const struct btf *btf);
24const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
25
26#endif