11/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22/* Copyright (c) 2018 Facebook */
3- #ifndef __LINUX_BTF_H__
4- #define __LINUX_BTF_H__
3+ #ifndef _UAPI__LINUX_BTF_H__
4+ #define _UAPI__LINUX_BTF_H__
55
66#include <linux/types.h>
77
@@ -43,7 +43,7 @@ struct btf_type {
4343 * "size" tells the size of the type it is describing.
4444 *
4545 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
46- * FUNC, FUNC_PROTO and VAR .
46+ * FUNC, FUNC_PROTO, VAR, DECL_TAG and TYPE_TAG .
4747 * "type" is a type_id referring to another type.
4848 */
4949 union {
@@ -56,25 +56,30 @@ struct btf_type {
5656#define BTF_INFO_VLEN (info ) ((info) & 0xffff)
5757#define BTF_INFO_KFLAG (info ) ((info) >> 31)
5858
59- #define BTF_KIND_UNKN 0 /* Unknown */
60- #define BTF_KIND_INT 1 /* Integer */
61- #define BTF_KIND_PTR 2 /* Pointer */
62- #define BTF_KIND_ARRAY 3 /* Array */
63- #define BTF_KIND_STRUCT 4 /* Struct */
64- #define BTF_KIND_UNION 5 /* Union */
65- #define BTF_KIND_ENUM 6 /* Enumeration */
66- #define BTF_KIND_FWD 7 /* Forward */
67- #define BTF_KIND_TYPEDEF 8 /* Typedef */
68- #define BTF_KIND_VOLATILE 9 /* Volatile */
69- #define BTF_KIND_CONST 10 /* Const */
70- #define BTF_KIND_RESTRICT 11 /* Restrict */
71- #define BTF_KIND_FUNC 12 /* Function */
72- #define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
73- #define BTF_KIND_VAR 14 /* Variable */
74- #define BTF_KIND_DATASEC 15 /* Section */
75- #define BTF_KIND_FLOAT 16 /* Floating point */
76- #define BTF_KIND_MAX BTF_KIND_FLOAT
77- #define NR_BTF_KINDS (BTF_KIND_MAX + 1)
59+ enum {
60+ BTF_KIND_UNKN = 0 , /* Unknown */
61+ BTF_KIND_INT = 1 , /* Integer */
62+ BTF_KIND_PTR = 2 , /* Pointer */
63+ BTF_KIND_ARRAY = 3 , /* Array */
64+ BTF_KIND_STRUCT = 4 , /* Struct */
65+ BTF_KIND_UNION = 5 , /* Union */
66+ BTF_KIND_ENUM = 6 , /* Enumeration */
67+ BTF_KIND_FWD = 7 , /* Forward */
68+ BTF_KIND_TYPEDEF = 8 , /* Typedef */
69+ BTF_KIND_VOLATILE = 9 , /* Volatile */
70+ BTF_KIND_CONST = 10 , /* Const */
71+ BTF_KIND_RESTRICT = 11 , /* Restrict */
72+ BTF_KIND_FUNC = 12 , /* Function */
73+ BTF_KIND_FUNC_PROTO = 13 , /* Function Proto */
74+ BTF_KIND_VAR = 14 , /* Variable */
75+ BTF_KIND_DATASEC = 15 , /* Section */
76+ BTF_KIND_FLOAT = 16 , /* Floating point */
77+ BTF_KIND_DECL_TAG = 17 , /* Decl Tag */
78+ BTF_KIND_TYPE_TAG = 18 , /* Type Tag */
79+
80+ NR_BTF_KINDS ,
81+ BTF_KIND_MAX = NR_BTF_KINDS - 1 ,
82+ };
7883
7984/* For some specific BTF_KIND, "struct btf_type" is immediately
8085 * followed by extra data.
@@ -170,4 +175,15 @@ struct btf_var_secinfo {
170175 __u32 size ;
171176};
172177
173- #endif /* __LINUX_BTF_H__ */
178+ /* BTF_KIND_DECL_TAG is followed by a single "struct btf_decl_tag" to describe
179+ * additional information related to the tag applied location.
180+ * If component_idx == -1, the tag is applied to a struct, union,
181+ * variable or function. Otherwise, it is applied to a struct/union
182+ * member or a func argument, and component_idx indicates which member
183+ * or argument (0 ... vlen-1).
184+ */
185+ struct btf_decl_tag {
186+ __s32 component_idx ;
187+ };
188+
189+ #endif /* _UAPI__LINUX_BTF_H__ */
0 commit comments