Pull in latest changes from both headers, so we can make use of them in libbpf.
Showing the changes to tools/include/uapi/linux (2 of 2 files). Show all
Unified · Split
| @@ -105,6 +105,7 @@ enum bpf_cmd { · 104 unmodified lines | ||
| 105 | 105 | BPF_BTF_GET_FD_BY_ID, |
| 106 | 106 | BPF_TASK_FD_QUERY, |
| 107 | 107 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, |
| 108 | + BPF_MAP_FREEZE, | |
| 108 | 109 | }; |
| 109 | 110 | |
| 110 | 111 | enum bpf_map_type { |
| @@ -255,8 +256,19 @@ enum bpf_attach_type { · 144 unmodified lines | ||
| 255 | 256 | */ |
| 256 | 257 | #define BPF_F_ANY_ALIGNMENT (1U << 1) |
| 257 | 258 | |
| 258 | −/* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */ | |
| 259 | +/* When BPF ldimm64's insn[0].src_reg != 0 then this can have | |
| 260 | + * two extensions: | |
| 261 | + * | |
| 262 | + * insn[0].src_reg: BPF_PSEUDO_MAP_FD BPF_PSEUDO_MAP_VALUE | |
| 263 | + * insn[0].imm: map fd map fd | |
| 264 | + * insn[1].imm: 0 offset into value | |
| 265 | + * insn[0].off: 0 0 | |
| 266 | + * insn[1].off: 0 0 | |
| 267 | + * ldimm64 rewrite: address of map address of map[0]+offset | |
| 268 | + * verifier type: CONST_PTR_TO_MAP PTR_TO_MAP_VALUE | |
| 269 | + */ | |
| 259 | 270 | #define BPF_PSEUDO_MAP_FD 1 |
| 271 | +#define BPF_PSEUDO_MAP_VALUE 2 | |
| 260 | 272 | |
| 261 | 273 | /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative |
| 262 | 274 | * offset to another bpf function |
| @@ -283,7 +295,7 @@ enum bpf_attach_type { · 20 unmodified lines | ||
| 283 | 295 | |
| 284 | 296 | #define BPF_OBJ_NAME_LEN 16U |
| 285 | 297 | |
| 286 | −/* Flags for accessing BPF object */ | |
| 298 | +/* Flags for accessing BPF object from syscall side. */ | |
| 287 | 299 | #define BPF_F_RDONLY (1U << 3) |
| 288 | 300 | #define BPF_F_WRONLY (1U << 4) |
| 289 | 301 | |
| @@ -293,6 +305,10 @@ enum bpf_attach_type { · 3 unmodified lines | ||
| 293 | 305 | /* Zero-initialize hash function seed. This should only be used for testing. */ |
| 294 | 306 | #define BPF_F_ZERO_SEED (1U << 6) |
| 295 | 307 | |
| 308 | +/* Flags for accessing BPF object from program side. */ | |
| 309 | +#define BPF_F_RDONLY_PROG (1U << 7) | |
| 310 | +#define BPF_F_WRONLY_PROG (1U << 8) | |
| 311 | + | |
| 296 | 312 | /* flags for BPF_PROG_QUERY */ |
| 297 | 313 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) |
| 298 | 314 | |
| @@ -39,11 +39,11 @@ struct btf_type { · 38 unmodified lines | ||
| 39 | 39 | * struct, union and fwd |
| 40 | 40 | */ |
| 41 | 41 | __u32 info; |
| 42 | − /* "size" is used by INT, ENUM, STRUCT and UNION. | |
| 42 | + /* "size" is used by INT, ENUM, STRUCT, UNION and DATASEC. | |
| 43 | 43 | * "size" tells the size of the type it is describing. |
| 44 | 44 | * |
| 45 | 45 | * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT, |
| 46 | − * FUNC and FUNC_PROTO. | |
| 46 | + * FUNC, FUNC_PROTO and VAR. | |
| 47 | 47 | * "type" is a type_id referring to another type. |
| 48 | 48 | */ |
| 49 | 49 | union { |
| @@ -70,8 +70,10 @@ struct btf_type { · 20 unmodified lines | ||
| 70 | 70 | #define BTF_KIND_RESTRICT 11 /* Restrict */ |
| 71 | 71 | #define BTF_KIND_FUNC 12 /* Function */ |
| 72 | 72 | #define BTF_KIND_FUNC_PROTO 13 /* Function Proto */ |
| 73 | −#define BTF_KIND_MAX 13 | |
| 74 | −#define NR_BTF_KINDS 14 | |
| 73 | +#define BTF_KIND_VAR 14 /* Variable */ | |
| 74 | +#define BTF_KIND_DATASEC 15 /* Section */ | |
| 75 | +#define BTF_KIND_MAX BTF_KIND_DATASEC | |
| 76 | +#define NR_BTF_KINDS (BTF_KIND_MAX + 1) | |
| 75 | 77 | |
| 76 | 78 | /* For some specific BTF_KIND, "struct btf_type" is immediately |
| 77 | 79 | * followed by extra data. |
| @@ -138,4 +140,26 @@ struct btf_param { · 60 unmodified lines | ||
| 138 | 140 | __u32 type; |
| 139 | 141 | }; |
| 140 | 142 | |
| 143 | +enum { | |
| 144 | + BTF_VAR_STATIC = 0, | |
| 145 | + BTF_VAR_GLOBAL_ALLOCATED, | |
| 146 | +}; | |
| 147 | + | |
| 148 | +/* BTF_KIND_VAR is followed by a single "struct btf_var" to describe | |
| 149 | + * additional information related to the variable such as its linkage. | |
| 150 | + */ | |
| 151 | +struct btf_var { | |
| 152 | + __u32 linkage; | |
| 153 | +}; | |
| 154 | + | |
| 155 | +/* BTF_KIND_DATASEC is followed by multiple "struct btf_var_secinfo" | |
| 156 | + * to describe all BTF_KIND_VAR types it contains along with it's | |
| 157 | + * in-section offset as well as size. | |
| 158 | + */ | |
| 159 | +struct btf_var_secinfo { | |
| 160 | + __u32 type; | |
| 161 | + __u32 offset; | |
| 162 | + __u32 size; | |
| 163 | +}; | |
| 164 | + | |
| 141 | 165 | #endif /* _UAPI__LINUX_BTF_H__ */ |