blob: 83d7e681cb6fe1a545a9374e3d32a1307537b7ed [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 */
Christopher Ferris9ce28842018-10-25 12:11:39 -07007#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
12struct 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};
Christopher Ferris9584fa42019-12-09 15:36:13 -080022#define BTF_MAX_TYPE 0x000fffff
23#define BTF_MAX_NAME_OFFSET 0x00ffffff
Christopher Ferris9ce28842018-10-25 12:11:39 -070024#define BTF_MAX_VLEN 0xffff
25struct btf_type {
26 __u32 name_off;
27 __u32 info;
28 union {
29 __u32 size;
30 __u32 type;
31 };
32};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +000033#define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f)
Christopher Ferris9ce28842018-10-25 12:11:39 -070034#define BTF_INFO_VLEN(info) ((info) & 0xffff)
Christopher Ferrisd842e432019-03-07 10:21:59 -080035#define BTF_INFO_KFLAG(info) ((info) >> 31)
Christopher Ferrisa4792612022-01-10 13:51:15 -080036enum {
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,
Christopher Ferris1ed55342022-03-22 16:06:25 -070055 BTF_KIND_TYPE_TAG = 18,
Christopher Ferris7447a1c2022-10-04 18:24:44 -070056 BTF_KIND_ENUM64 = 19,
Christopher Ferrisa4792612022-01-10 13:51:15 -080057 NR_BTF_KINDS,
58 BTF_KIND_MAX = NR_BTF_KINDS - 1,
59};
Christopher Ferris9ce28842018-10-25 12:11:39 -070060#define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070061#define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16)
Christopher Ferris9ce28842018-10-25 12:11:39 -070062#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)
66struct btf_enum {
67 __u32 name_off;
68 __s32 val;
69};
70struct btf_array {
71 __u32 type;
72 __u32 index_type;
73 __u32 nelems;
74};
75struct btf_member {
76 __u32 name_off;
77 __u32 type;
78 __u32 offset;
79};
Christopher Ferrisd842e432019-03-07 10:21:59 -080080#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
81#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
82struct btf_param {
83 __u32 name_off;
84 __u32 type;
85};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070086enum {
87 BTF_VAR_STATIC = 0,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070088 BTF_VAR_GLOBAL_ALLOCATED = 1,
89 BTF_VAR_GLOBAL_EXTERN = 2,
90};
91enum btf_func_linkage {
92 BTF_FUNC_STATIC = 0,
93 BTF_FUNC_GLOBAL = 1,
94 BTF_FUNC_EXTERN = 2,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070095};
96struct btf_var {
97 __u32 linkage;
98};
99struct btf_var_secinfo {
100 __u32 type;
101 __u32 offset;
102 __u32 size;
103};
Christopher Ferrisa4792612022-01-10 13:51:15 -0800104struct btf_decl_tag {
105 __s32 component_idx;
106};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700107struct btf_enum64 {
108 __u32 name_off;
109 __u32 val_lo32;
110 __u32 val_hi32;
111};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700112#endif