Change BTF_KIND_* macros to enums so they are encoded in dwarf and appear in vmlinux.h. This will make it easier for bpf programs to use these constants without macro definitions.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -56,25 +56,28 @@ struct btf_type { · 55 unmodified lines | |||
| 56 | #define BTF_INFO_VLEN(info) ((info) & 0xffff) | 56 | #define BTF_INFO_VLEN(info) ((info) & 0xffff) |
| 57 | #define BTF_INFO_KFLAG(info) ((info) >> 31) | 57 | #define BTF_INFO_KFLAG(info) ((info) >> 31) |
| 58 | 58 | ||
| 59 | #define BTF_KIND_UNKN 0 /* Unknown */ | 59 | enum { |
| 60 | #define BTF_KIND_INT 1 /* Integer */ | 60 | BTF_KIND_UNKN = 0, /* Unknown */ |
| 61 | #define BTF_KIND_PTR 2 /* Pointer */ | 61 | BTF_KIND_INT = 1, /* Integer */ |
| 62 | #define BTF_KIND_ARRAY 3 /* Array */ | 62 | BTF_KIND_PTR = 2, /* Pointer */ |
| 63 | #define BTF_KIND_STRUCT 4 /* Struct */ | 63 | BTF_KIND_ARRAY = 3, /* Array */ |
| 64 | #define BTF_KIND_UNION 5 /* Union */ | 64 | BTF_KIND_STRUCT = 4, /* Struct */ |
| 65 | #define BTF_KIND_ENUM 6 /* Enumeration */ | 65 | BTF_KIND_UNION = 5, /* Union */ |
| 66 | #define BTF_KIND_FWD 7 /* Forward */ | 66 | BTF_KIND_ENUM = 6, /* Enumeration */ |
| 67 | #define BTF_KIND_TYPEDEF 8 /* Typedef */ | 67 | BTF_KIND_FWD = 7, /* Forward */ |
| 68 | #define BTF_KIND_VOLATILE 9 /* Volatile */ | 68 | BTF_KIND_TYPEDEF = 8, /* Typedef */ |
| 69 | #define BTF_KIND_CONST 10 /* Const */ | 69 | BTF_KIND_VOLATILE = 9, /* Volatile */ |
| 70 | #define BTF_KIND_RESTRICT 11 /* Restrict */ | 70 | BTF_KIND_CONST = 10, /* Const */ |
| 71 | #define BTF_KIND_FUNC 12 /* Function */ | 71 | BTF_KIND_RESTRICT = 11, /* Restrict */ |
| 72 | #define BTF_KIND_FUNC_PROTO 13 /* Function Proto */ | 72 | BTF_KIND_FUNC = 12, /* Function */ |
| 73 | #define BTF_KIND_VAR 14 /* Variable */ | 73 | BTF_KIND_FUNC_PROTO = 13, /* Function Proto */ |
| 74 | #define BTF_KIND_DATASEC 15 /* Section */ | 74 | BTF_KIND_VAR = 14, /* Variable */ |
| 75 | #define BTF_KIND_FLOAT 16 /* Floating point */ | 75 | BTF_KIND_DATASEC = 15, /* Section */ |
| 76 | #define BTF_KIND_MAX BTF_KIND_FLOAT | 76 | BTF_KIND_FLOAT = 16, /* Floating point */ |
| 77 | #define NR_BTF_KINDS (BTF_KIND_MAX + 1) | 77 | |
| 78 | NR_BTF_KINDS, | ||
| 79 | BTF_KIND_MAX = NR_BTF_KINDS - 1, | ||
| 80 | }; | ||
| 78 | 81 | ||
| 79 | /* For some specific BTF_KIND, "struct btf_type" is immediately | 82 | /* For some specific BTF_KIND, "struct btf_type" is immediately |
| 80 | * followed by extra data. | 83 | * followed by extra data. |