Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 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 | */ |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 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 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 22 | #define BTF_MAX_TYPE 0x000fffff |
| 23 | #define BTF_MAX_NAME_OFFSET 0x00ffffff |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 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 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 33 | #define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f) |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 34 | #define BTF_INFO_VLEN(info) ((info) & 0xffff) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 35 | #define BTF_INFO_KFLAG(info) ((info) >> 31) |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 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, |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 55 | BTF_KIND_TYPE_TAG = 18, |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 56 | BTF_KIND_ENUM64 = 19, |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 57 | NR_BTF_KINDS, |
| 58 | BTF_KIND_MAX = NR_BTF_KINDS - 1, |
| 59 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 60 | #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24) |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 61 | #define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16) |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 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 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 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 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 86 | enum { |
| 87 | BTF_VAR_STATIC = 0, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 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, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 95 | }; |
| 96 | struct btf_var { |
| 97 | __u32 linkage; |
| 98 | }; |
| 99 | struct btf_var_secinfo { |
| 100 | __u32 type; |
| 101 | __u32 offset; |
| 102 | __u32 size; |
| 103 | }; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 104 | struct btf_decl_tag { |
| 105 | __s32 component_idx; |
| 106 | }; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 107 | struct btf_enum64 { |
| 108 | __u32 name_off; |
| 109 | __u32 val_lo32; |
| 110 | __u32 val_hi32; |
| 111 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 112 | #endif |