1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPI__LINUX_BTF_H__
8 #define _UAPI__LINUX_BTF_H__
9 #include <linux/types.h>
10 #define BTF_MAGIC 0xeB9F
11 #define BTF_VERSION 1
12 struct btf_header {
13   __u16 magic;
14   __u8 version;
15   __u8 flags;
16   __u32 hdr_len;
17   __u32 type_off;
18   __u32 type_len;
19   __u32 str_off;
20   __u32 str_len;
21 };
22 #define BTF_MAX_TYPE 0x000fffff
23 #define BTF_MAX_NAME_OFFSET 0x00ffffff
24 #define BTF_MAX_VLEN 0xffff
25 struct btf_type {
26   __u32 name_off;
27   __u32 info;
28   union {
29     __u32 size;
30     __u32 type;
31   };
32 };
33 #define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f)
34 #define BTF_INFO_VLEN(info) ((info) & 0xffff)
35 #define BTF_INFO_KFLAG(info) ((info) >> 31)
36 enum {
37   BTF_KIND_UNKN = 0,
38   BTF_KIND_INT = 1,
39   BTF_KIND_PTR = 2,
40   BTF_KIND_ARRAY = 3,
41   BTF_KIND_STRUCT = 4,
42   BTF_KIND_UNION = 5,
43   BTF_KIND_ENUM = 6,
44   BTF_KIND_FWD = 7,
45   BTF_KIND_TYPEDEF = 8,
46   BTF_KIND_VOLATILE = 9,
47   BTF_KIND_CONST = 10,
48   BTF_KIND_RESTRICT = 11,
49   BTF_KIND_FUNC = 12,
50   BTF_KIND_FUNC_PROTO = 13,
51   BTF_KIND_VAR = 14,
52   BTF_KIND_DATASEC = 15,
53   BTF_KIND_FLOAT = 16,
54   BTF_KIND_DECL_TAG = 17,
55   BTF_KIND_TYPE_TAG = 18,
56   BTF_KIND_ENUM64 = 19,
57   NR_BTF_KINDS,
58   BTF_KIND_MAX = NR_BTF_KINDS - 1,
59 };
60 #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
61 #define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16)
62 #define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff)
63 #define BTF_INT_SIGNED (1 << 0)
64 #define BTF_INT_CHAR (1 << 1)
65 #define BTF_INT_BOOL (1 << 2)
66 struct btf_enum {
67   __u32 name_off;
68   __s32 val;
69 };
70 struct btf_array {
71   __u32 type;
72   __u32 index_type;
73   __u32 nelems;
74 };
75 struct btf_member {
76   __u32 name_off;
77   __u32 type;
78   __u32 offset;
79 };
80 #define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
81 #define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
82 struct btf_param {
83   __u32 name_off;
84   __u32 type;
85 };
86 enum {
87   BTF_VAR_STATIC = 0,
88   BTF_VAR_GLOBAL_ALLOCATED = 1,
89   BTF_VAR_GLOBAL_EXTERN = 2,
90 };
91 enum btf_func_linkage {
92   BTF_FUNC_STATIC = 0,
93   BTF_FUNC_GLOBAL = 1,
94   BTF_FUNC_EXTERN = 2,
95 };
96 struct btf_var {
97   __u32 linkage;
98 };
99 struct btf_var_secinfo {
100   __u32 type;
101   __u32 offset;
102   __u32 size;
103 };
104 struct btf_decl_tag {
105   __s32 component_idx;
106 };
107 struct btf_enum64 {
108   __u32 name_off;
109   __u32 val_lo32;
110   __u32 val_hi32;
111 };
112 #endif
113