/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2018 Facebook */ #ifndef _UAPI__LINUX_BTF_H__ #define _UAPI__LINUX_BTF_H__ #include <linux/types.h> #define BTF_MAGIC … #define BTF_VERSION … struct btf_header { … }; /* Max # of type identifier */ #define BTF_MAX_TYPE … /* Max offset into the string section */ #define BTF_MAX_NAME_OFFSET … /* Max # of struct/union/enum members or func args */ #define BTF_MAX_VLEN … struct btf_type { … }; #define BTF_INFO_KIND(info) … #define BTF_INFO_VLEN(info) … #define BTF_INFO_KFLAG(info) … enum { … }; /* For some specific BTF_KIND, "struct btf_type" is immediately * followed by extra data. */ /* BTF_KIND_INT is followed by a u32 and the following * is the 32 bits arrangement: */ #define BTF_INT_ENCODING(VAL) … #define BTF_INT_OFFSET(VAL) … #define BTF_INT_BITS(VAL) … /* Attributes stored in the BTF_INT_ENCODING */ #define BTF_INT_SIGNED … #define BTF_INT_CHAR … #define BTF_INT_BOOL … /* BTF_KIND_ENUM is followed by multiple "struct btf_enum". * The exact number of btf_enum is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_enum { … }; /* BTF_KIND_ARRAY is followed by one "struct btf_array" */ struct btf_array { … }; /* BTF_KIND_STRUCT and BTF_KIND_UNION are followed * by multiple "struct btf_member". The exact number * of btf_member is stored in the vlen (of the info in * "struct btf_type"). */ struct btf_member { … }; /* If the struct/union type info kind_flag is set, the * following two macros are used to access bitfield_size * and bit_offset from btf_member.offset. */ #define BTF_MEMBER_BITFIELD_SIZE(val) … #define BTF_MEMBER_BIT_OFFSET(val) … /* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param". * The exact number of btf_param is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_param { … }; enum { … }; enum btf_func_linkage { … }; /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe * additional information related to the variable such as its linkage. */ struct btf_var { … }; /* BTF_KIND_DATASEC is followed by multiple "struct btf_var_secinfo" * to describe all BTF_KIND_VAR types it contains along with it's * in-section offset as well as size. */ struct btf_var_secinfo { … }; /* BTF_KIND_DECL_TAG is followed by a single "struct btf_decl_tag" to describe * additional information related to the tag applied location. * If component_idx == -1, the tag is applied to a struct, union, * variable or function. Otherwise, it is applied to a struct/union * member or a func argument, and component_idx indicates which member * or argument (0 ... vlen-1). */ struct btf_decl_tag { … }; /* BTF_KIND_ENUM64 is followed by multiple "struct btf_enum64". * The exact number of btf_enum64 is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_enum64 { … }; #endif /* _UAPI__LINUX_BTF_H__ */