1
2#ifndef _UAPI_LINUX_FS_H
3#define _UAPI_LINUX_FS_H
4
5
6
7
8
9
10
11
12
13#include <linux/limits.h>
14#include <linux/ioctl.h>
15#include <linux/types.h>
16#ifndef __KERNEL__
17#include <linux/fscrypt.h>
18#endif
19
20
21#if !defined(__KERNEL__)
22#include <linux/mount.h>
23#endif
24
25
26
27
28
29
30
31
32
33
34
35
36#undef NR_OPEN
37#define INR_OPEN_CUR 1024
38#define INR_OPEN_MAX 4096
39
40#define BLOCK_SIZE_BITS 10
41#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
42
43#define SEEK_SET 0
44#define SEEK_CUR 1
45#define SEEK_END 2
46#define SEEK_DATA 3
47#define SEEK_HOLE 4
48#define SEEK_MAX SEEK_HOLE
49
50#define RENAME_NOREPLACE (1 << 0)
51#define RENAME_EXCHANGE (1 << 1)
52#define RENAME_WHITEOUT (1 << 2)
53
54struct file_clone_range {
55 __s64 src_fd;
56 __u64 src_offset;
57 __u64 src_length;
58 __u64 dest_offset;
59};
60
61struct fstrim_range {
62 __u64 start;
63 __u64 len;
64 __u64 minlen;
65};
66
67
68#define FILE_DEDUPE_RANGE_SAME 0
69#define FILE_DEDUPE_RANGE_DIFFERS 1
70
71
72struct file_dedupe_range_info {
73 __s64 dest_fd;
74 __u64 dest_offset;
75 __u64 bytes_deduped;
76
77
78
79
80
81
82 __s32 status;
83 __u32 reserved;
84};
85
86
87struct file_dedupe_range {
88 __u64 src_offset;
89 __u64 src_length;
90 __u16 dest_count;
91 __u16 reserved1;
92 __u32 reserved2;
93 struct file_dedupe_range_info info[0];
94};
95
96
97struct files_stat_struct {
98 unsigned long nr_files;
99 unsigned long nr_free_files;
100 unsigned long max_files;
101};
102
103struct inodes_stat_t {
104 long nr_inodes;
105 long nr_unused;
106 long dummy[5];
107};
108
109
110#define NR_FILE 8192
111
112
113
114
115struct fsxattr {
116 __u32 fsx_xflags;
117 __u32 fsx_extsize;
118 __u32 fsx_nextents;
119 __u32 fsx_projid;
120 __u32 fsx_cowextsize;
121 unsigned char fsx_pad[8];
122};
123
124
125
126
127#define FS_XFLAG_REALTIME 0x00000001
128#define FS_XFLAG_PREALLOC 0x00000002
129#define FS_XFLAG_IMMUTABLE 0x00000008
130#define FS_XFLAG_APPEND 0x00000010
131#define FS_XFLAG_SYNC 0x00000020
132#define FS_XFLAG_NOATIME 0x00000040
133#define FS_XFLAG_NODUMP 0x00000080
134#define FS_XFLAG_RTINHERIT 0x00000100
135#define FS_XFLAG_PROJINHERIT 0x00000200
136#define FS_XFLAG_NOSYMLINKS 0x00000400
137#define FS_XFLAG_EXTSIZE 0x00000800
138#define FS_XFLAG_EXTSZINHERIT 0x00001000
139#define FS_XFLAG_NODEFRAG 0x00002000
140#define FS_XFLAG_FILESTREAM 0x00004000
141#define FS_XFLAG_DAX 0x00008000
142#define FS_XFLAG_COWEXTSIZE 0x00010000
143#define FS_XFLAG_HASATTR 0x80000000
144
145
146
147
148#define BLKROSET _IO(0x12,93)
149#define BLKROGET _IO(0x12,94)
150#define BLKRRPART _IO(0x12,95)
151#define BLKGETSIZE _IO(0x12,96)
152#define BLKFLSBUF _IO(0x12,97)
153#define BLKRASET _IO(0x12,98)
154#define BLKRAGET _IO(0x12,99)
155#define BLKFRASET _IO(0x12,100)
156#define BLKFRAGET _IO(0x12,101)
157#define BLKSECTSET _IO(0x12,102)
158#define BLKSECTGET _IO(0x12,103)
159#define BLKSSZGET _IO(0x12,104)
160#if 0
161#define BLKPG _IO(0x12,105)
162
163
164
165#define BLKELVGET _IOR(0x12,106,size_t)
166#define BLKELVSET _IOW(0x12,107,size_t)
167
168
169#endif
170
171#define BLKBSZGET _IOR(0x12,112,size_t)
172#define BLKBSZSET _IOW(0x12,113,size_t)
173#define BLKGETSIZE64 _IOR(0x12,114,size_t)
174#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
175#define BLKTRACESTART _IO(0x12,116)
176#define BLKTRACESTOP _IO(0x12,117)
177#define BLKTRACETEARDOWN _IO(0x12,118)
178#define BLKDISCARD _IO(0x12,119)
179#define BLKIOMIN _IO(0x12,120)
180#define BLKIOOPT _IO(0x12,121)
181#define BLKALIGNOFF _IO(0x12,122)
182#define BLKPBSZGET _IO(0x12,123)
183#define BLKDISCARDZEROES _IO(0x12,124)
184#define BLKSECDISCARD _IO(0x12,125)
185#define BLKROTATIONAL _IO(0x12,126)
186#define BLKZEROOUT _IO(0x12,127)
187#define BLKGETDISKSEQ _IOR(0x12,128,__u64)
188
189
190
191
192
193#define BMAP_IOCTL 1
194#define FIBMAP _IO(0x00,1)
195#define FIGETBSZ _IO(0x00,2)
196#define FIFREEZE _IOWR('X', 119, int)
197#define FITHAW _IOWR('X', 120, int)
198#define FITRIM _IOWR('X', 121, struct fstrim_range)
199#define FICLONE _IOW(0x94, 9, int)
200#define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
201#define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
202
203#define FSLABEL_MAX 256
204
205#define FS_IOC_GETFLAGS _IOR('f', 1, long)
206#define FS_IOC_SETFLAGS _IOW('f', 2, long)
207#define FS_IOC_GETVERSION _IOR('v', 1, long)
208#define FS_IOC_SETVERSION _IOW('v', 2, long)
209#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
210#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
211#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
212#define FS_IOC32_GETVERSION _IOR('v', 1, int)
213#define FS_IOC32_SETVERSION _IOW('v', 2, int)
214#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
215#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
216#define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])
217#define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX])
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239#define FS_SECRM_FL 0x00000001
240#define FS_UNRM_FL 0x00000002
241#define FS_COMPR_FL 0x00000004
242#define FS_SYNC_FL 0x00000008
243#define FS_IMMUTABLE_FL 0x00000010
244#define FS_APPEND_FL 0x00000020
245#define FS_NODUMP_FL 0x00000040
246#define FS_NOATIME_FL 0x00000080
247
248#define FS_DIRTY_FL 0x00000100
249#define FS_COMPRBLK_FL 0x00000200
250#define FS_NOCOMP_FL 0x00000400
251
252#define FS_ENCRYPT_FL 0x00000800
253#define FS_BTREE_FL 0x00001000
254#define FS_INDEX_FL 0x00001000
255#define FS_IMAGIC_FL 0x00002000
256#define FS_JOURNAL_DATA_FL 0x00004000
257#define FS_NOTAIL_FL 0x00008000
258#define FS_DIRSYNC_FL 0x00010000
259#define FS_TOPDIR_FL 0x00020000
260#define FS_HUGE_FILE_FL 0x00040000
261#define FS_EXTENT_FL 0x00080000
262#define FS_VERITY_FL 0x00100000
263#define FS_EA_INODE_FL 0x00200000
264#define FS_EOFBLOCKS_FL 0x00400000
265#define FS_NOCOW_FL 0x00800000
266#define FS_DAX_FL 0x02000000
267#define FS_INLINE_DATA_FL 0x10000000
268#define FS_PROJINHERIT_FL 0x20000000
269#define FS_CASEFOLD_FL 0x40000000
270#define FS_RESERVED_FL 0x80000000
271
272#define FS_FL_USER_VISIBLE 0x0003DFFF
273#define FS_FL_USER_MODIFIABLE 0x000380FF
274
275
276#define SYNC_FILE_RANGE_WAIT_BEFORE 1
277#define SYNC_FILE_RANGE_WRITE 2
278#define SYNC_FILE_RANGE_WAIT_AFTER 4
279#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \
280 SYNC_FILE_RANGE_WAIT_BEFORE | \
281 SYNC_FILE_RANGE_WAIT_AFTER)
282
283
284
285
286
287typedef int __bitwise __kernel_rwf_t;
288
289
290#define RWF_HIPRI ((__force __kernel_rwf_t)0x00000001)
291
292
293#define RWF_DSYNC ((__force __kernel_rwf_t)0x00000002)
294
295
296#define RWF_SYNC ((__force __kernel_rwf_t)0x00000004)
297
298
299#define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008)
300
301
302#define RWF_APPEND ((__force __kernel_rwf_t)0x00000010)
303
304
305#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
306 RWF_APPEND)
307
308#endif
309