btf.h 775 B

1234567891011121314151617181920212223242526
  1. /* SPDX-License-Identifier: LGPL-2.1 */
  2. /* Copyright (c) 2018 Facebook */
  3. #ifndef __BPF_BTF_H
  4. #define __BPF_BTF_H
  5. #include <linux/types.h>
  6. #define BTF_ELF_SEC ".BTF"
  7. struct btf;
  8. struct btf_type;
  9. typedef int (*btf_print_fn_t)(const char *, ...)
  10. __attribute__((format(printf, 1, 2)));
  11. void btf__free(struct btf *btf);
  12. struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
  13. __s32 btf__find_by_name(const struct btf *btf, const char *type_name);
  14. const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id);
  15. __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
  16. int btf__resolve_type(const struct btf *btf, __u32 type_id);
  17. int btf__fd(const struct btf *btf);
  18. const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
  19. #endif