Skip to content

Commit b6362ca

Browse files
committed
Revert "feat: remove redundant files"
This reverts commit 62b9f20.
1 parent df1e54d commit b6362ca

File tree

12 files changed

+12505
-0
lines changed

12 files changed

+12505
-0
lines changed

include/uapi/linux/bpf.h

Lines changed: 7158 additions & 0 deletions
Large diffs are not rendered by default.

include/uapi/linux/bpf_common.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI__LINUX_BPF_COMMON_H__
3+
#define _UAPI__LINUX_BPF_COMMON_H__
4+
5+
/* Instruction classes */
6+
#define BPF_CLASS(code) ((code) & 0x07)
7+
#define BPF_LD 0x00
8+
#define BPF_LDX 0x01
9+
#define BPF_ST 0x02
10+
#define BPF_STX 0x03
11+
#define BPF_ALU 0x04
12+
#define BPF_JMP 0x05
13+
#define BPF_RET 0x06
14+
#define BPF_MISC 0x07
15+
16+
/* ld/ldx fields */
17+
#define BPF_SIZE(code) ((code) & 0x18)
18+
#define BPF_W 0x00 /* 32-bit */
19+
#define BPF_H 0x08 /* 16-bit */
20+
#define BPF_B 0x10 /* 8-bit */
21+
/* eBPF BPF_DW 0x18 64-bit */
22+
#define BPF_MODE(code) ((code) & 0xe0)
23+
#define BPF_IMM 0x00
24+
#define BPF_ABS 0x20
25+
#define BPF_IND 0x40
26+
#define BPF_MEM 0x60
27+
#define BPF_LEN 0x80
28+
#define BPF_MSH 0xa0
29+
30+
/* alu/jmp fields */
31+
#define BPF_OP(code) ((code) & 0xf0)
32+
#define BPF_ADD 0x00
33+
#define BPF_SUB 0x10
34+
#define BPF_MUL 0x20
35+
#define BPF_DIV 0x30
36+
#define BPF_OR 0x40
37+
#define BPF_AND 0x50
38+
#define BPF_LSH 0x60
39+
#define BPF_RSH 0x70
40+
#define BPF_NEG 0x80
41+
#define BPF_MOD 0x90
42+
#define BPF_XOR 0xa0
43+
44+
#define BPF_JA 0x00
45+
#define BPF_JEQ 0x10
46+
#define BPF_JGT 0x20
47+
#define BPF_JGE 0x30
48+
#define BPF_JSET 0x40
49+
#define BPF_SRC(code) ((code) & 0x08)
50+
#define BPF_K 0x00
51+
#define BPF_X 0x08
52+
53+
#ifndef BPF_MAXINSNS
54+
#define BPF_MAXINSNS 4096
55+
#endif
56+
57+
#endif /* _UAPI__LINUX_BPF_COMMON_H__ */

include/uapi/linux/btf.h

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
/* Copyright (c) 2018 Facebook */
3+
#ifndef _UAPI__LINUX_BTF_H__
4+
#define _UAPI__LINUX_BTF_H__
5+
6+
#include <linux/types.h>
7+
8+
#define BTF_MAGIC 0xeB9F
9+
#define BTF_VERSION 1
10+
11+
struct btf_header {
12+
__u16 magic;
13+
__u8 version;
14+
__u8 flags;
15+
__u32 hdr_len;
16+
17+
/* All offsets are in bytes relative to the end of this header */
18+
__u32 type_off; /* offset of type section */
19+
__u32 type_len; /* length of type section */
20+
__u32 str_off; /* offset of string section */
21+
__u32 str_len; /* length of string section */
22+
};
23+
24+
/* Max # of type identifier */
25+
#define BTF_MAX_TYPE 0x000fffff
26+
/* Max offset into the string section */
27+
#define BTF_MAX_NAME_OFFSET 0x00ffffff
28+
/* Max # of struct/union/enum members or func args */
29+
#define BTF_MAX_VLEN 0xffff
30+
31+
struct btf_type {
32+
__u32 name_off;
33+
/* "info" bits arrangement
34+
* bits 0-15: vlen (e.g. # of struct's members)
35+
* bits 16-23: unused
36+
* bits 24-28: kind (e.g. int, ptr, array...etc)
37+
* bits 29-30: unused
38+
* bit 31: kind_flag, currently used by
39+
* struct, union, enum, fwd and enum64
40+
*/
41+
__u32 info;
42+
/* "size" is used by INT, ENUM, STRUCT, UNION, DATASEC and ENUM64.
43+
* "size" tells the size of the type it is describing.
44+
*
45+
* "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
46+
* FUNC, FUNC_PROTO, VAR, DECL_TAG and TYPE_TAG.
47+
* "type" is a type_id referring to another type.
48+
*/
49+
union {
50+
__u32 size;
51+
__u32 type;
52+
};
53+
};
54+
55+
#define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f)
56+
#define BTF_INFO_VLEN(info) ((info) & 0xffff)
57+
#define BTF_INFO_KFLAG(info) ((info) >> 31)
58+
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 up to 32-bit values */
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+
BTF_KIND_ENUM64 = 19, /* Enumeration up to 64-bit values */
80+
81+
NR_BTF_KINDS,
82+
BTF_KIND_MAX = NR_BTF_KINDS - 1,
83+
};
84+
85+
/* For some specific BTF_KIND, "struct btf_type" is immediately
86+
* followed by extra data.
87+
*/
88+
89+
/* BTF_KIND_INT is followed by a u32 and the following
90+
* is the 32 bits arrangement:
91+
*/
92+
#define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
93+
#define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16)
94+
#define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff)
95+
96+
/* Attributes stored in the BTF_INT_ENCODING */
97+
#define BTF_INT_SIGNED (1 << 0)
98+
#define BTF_INT_CHAR (1 << 1)
99+
#define BTF_INT_BOOL (1 << 2)
100+
101+
/* BTF_KIND_ENUM is followed by multiple "struct btf_enum".
102+
* The exact number of btf_enum is stored in the vlen (of the
103+
* info in "struct btf_type").
104+
*/
105+
struct btf_enum {
106+
__u32 name_off;
107+
__s32 val;
108+
};
109+
110+
/* BTF_KIND_ARRAY is followed by one "struct btf_array" */
111+
struct btf_array {
112+
__u32 type;
113+
__u32 index_type;
114+
__u32 nelems;
115+
};
116+
117+
/* BTF_KIND_STRUCT and BTF_KIND_UNION are followed
118+
* by multiple "struct btf_member". The exact number
119+
* of btf_member is stored in the vlen (of the info in
120+
* "struct btf_type").
121+
*/
122+
struct btf_member {
123+
__u32 name_off;
124+
__u32 type;
125+
/* If the type info kind_flag is set, the btf_member offset
126+
* contains both member bitfield size and bit offset. The
127+
* bitfield size is set for bitfield members. If the type
128+
* info kind_flag is not set, the offset contains only bit
129+
* offset.
130+
*/
131+
__u32 offset;
132+
};
133+
134+
/* If the struct/union type info kind_flag is set, the
135+
* following two macros are used to access bitfield_size
136+
* and bit_offset from btf_member.offset.
137+
*/
138+
#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
139+
#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
140+
141+
/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param".
142+
* The exact number of btf_param is stored in the vlen (of the
143+
* info in "struct btf_type").
144+
*/
145+
struct btf_param {
146+
__u32 name_off;
147+
__u32 type;
148+
};
149+
150+
enum {
151+
BTF_VAR_STATIC = 0,
152+
BTF_VAR_GLOBAL_ALLOCATED = 1,
153+
BTF_VAR_GLOBAL_EXTERN = 2,
154+
};
155+
156+
enum btf_func_linkage {
157+
BTF_FUNC_STATIC = 0,
158+
BTF_FUNC_GLOBAL = 1,
159+
BTF_FUNC_EXTERN = 2,
160+
};
161+
162+
/* BTF_KIND_VAR is followed by a single "struct btf_var" to describe
163+
* additional information related to the variable such as its linkage.
164+
*/
165+
struct btf_var {
166+
__u32 linkage;
167+
};
168+
169+
/* BTF_KIND_DATASEC is followed by multiple "struct btf_var_secinfo"
170+
* to describe all BTF_KIND_VAR types it contains along with it's
171+
* in-section offset as well as size.
172+
*/
173+
struct btf_var_secinfo {
174+
__u32 type;
175+
__u32 offset;
176+
__u32 size;
177+
};
178+
179+
/* BTF_KIND_DECL_TAG is followed by a single "struct btf_decl_tag" to describe
180+
* additional information related to the tag applied location.
181+
* If component_idx == -1, the tag is applied to a struct, union,
182+
* variable or function. Otherwise, it is applied to a struct/union
183+
* member or a func argument, and component_idx indicates which member
184+
* or argument (0 ... vlen-1).
185+
*/
186+
struct btf_decl_tag {
187+
__s32 component_idx;
188+
};
189+
190+
/* BTF_KIND_ENUM64 is followed by multiple "struct btf_enum64".
191+
* The exact number of btf_enum64 is stored in the vlen (of the
192+
* info in "struct btf_type").
193+
*/
194+
struct btf_enum64 {
195+
__u32 name_off;
196+
__u32 val_lo32;
197+
__u32 val_hi32;
198+
};
199+
200+
#endif /* _UAPI__LINUX_BTF_H__ */

include/uapi/linux/fcntl.h

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI_LINUX_FCNTL_H
3+
#define _UAPI_LINUX_FCNTL_H
4+
5+
#include <asm/fcntl.h>
6+
#include <linux/openat2.h>
7+
8+
#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
9+
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
10+
11+
/*
12+
* Cancel a blocking posix lock; internal use only until we expose an
13+
* asynchronous lock api to userspace:
14+
*/
15+
#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
16+
17+
/* Create a file descriptor with FD_CLOEXEC set. */
18+
#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
19+
20+
/*
21+
* Request nofications on a directory.
22+
* See below for events that may be notified.
23+
*/
24+
#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
25+
26+
/*
27+
* Set and get of pipe page size array
28+
*/
29+
#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
30+
#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
31+
32+
/*
33+
* Set/Get seals
34+
*/
35+
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
36+
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
37+
38+
/*
39+
* Types of seals
40+
*/
41+
#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
42+
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
43+
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
44+
#define F_SEAL_WRITE 0x0008 /* prevent writes */
45+
#define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
46+
#define F_SEAL_EXEC 0x0020 /* prevent chmod modifying exec bits */
47+
/* (1U << 31) is reserved for signed error codes */
48+
49+
/*
50+
* Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
51+
* underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
52+
* the specific file.
53+
*/
54+
#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
55+
#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
56+
#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
57+
#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
58+
59+
/*
60+
* Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
61+
* used to clear any hints previously set.
62+
*/
63+
#define RWH_WRITE_LIFE_NOT_SET 0
64+
#define RWH_WRITE_LIFE_NONE 1
65+
#define RWH_WRITE_LIFE_SHORT 2
66+
#define RWH_WRITE_LIFE_MEDIUM 3
67+
#define RWH_WRITE_LIFE_LONG 4
68+
#define RWH_WRITE_LIFE_EXTREME 5
69+
70+
/*
71+
* The originally introduced spelling is remained from the first
72+
* versions of the patch set that introduced the feature, see commit
73+
* v4.13-rc1~212^2~51.
74+
*/
75+
#define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET
76+
77+
/*
78+
* Types of directory notifications that may be requested.
79+
*/
80+
#define DN_ACCESS 0x00000001 /* File accessed */
81+
#define DN_MODIFY 0x00000002 /* File modified */
82+
#define DN_CREATE 0x00000004 /* File created */
83+
#define DN_DELETE 0x00000008 /* File removed */
84+
#define DN_RENAME 0x00000010 /* File renamed */
85+
#define DN_ATTRIB 0x00000020 /* File changed attibutes */
86+
#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
87+
88+
/*
89+
* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
90+
* meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
91+
* unlinkat. The two functions do completely different things and therefore,
92+
* the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
93+
* faccessat would be undefined behavior and thus treating it equivalent to
94+
* AT_EACCESS is valid undefined behavior.
95+
*/
96+
#define AT_FDCWD -100 /* Special value used to indicate
97+
openat should use the current
98+
working directory. */
99+
#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
100+
#define AT_EACCESS 0x200 /* Test access permitted for
101+
effective IDs, not real IDs. */
102+
#define AT_REMOVEDIR 0x200 /* Remove directory instead of
103+
unlinking file. */
104+
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
105+
#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
106+
#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
107+
108+
#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
109+
#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
110+
#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */
111+
#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */
112+
113+
#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
114+
115+
#endif /* _UAPI_LINUX_FCNTL_H */

0 commit comments

Comments
 (0)