0001
0002 #ifndef _UAPI_LINUX_FS_H
0003 #define _UAPI_LINUX_FS_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/limits.h>
0014 #include <linux/ioctl.h>
0015 #include <linux/types.h>
0016 #ifndef __KERNEL__
0017 #include <linux/fscrypt.h>
0018 #endif
0019
0020
0021 #if !defined(__KERNEL__)
0022 #include <linux/mount.h>
0023 #endif
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #undef NR_OPEN
0037 #define INR_OPEN_CUR 1024
0038 #define INR_OPEN_MAX 4096
0039
0040 #define BLOCK_SIZE_BITS 10
0041 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
0042
0043 #define SEEK_SET 0
0044 #define SEEK_CUR 1
0045 #define SEEK_END 2
0046 #define SEEK_DATA 3
0047 #define SEEK_HOLE 4
0048 #define SEEK_MAX SEEK_HOLE
0049
0050 #define RENAME_NOREPLACE (1 << 0)
0051 #define RENAME_EXCHANGE (1 << 1)
0052 #define RENAME_WHITEOUT (1 << 2)
0053
0054 struct file_clone_range {
0055 __s64 src_fd;
0056 __u64 src_offset;
0057 __u64 src_length;
0058 __u64 dest_offset;
0059 };
0060
0061 struct fstrim_range {
0062 __u64 start;
0063 __u64 len;
0064 __u64 minlen;
0065 };
0066
0067
0068 #define FILE_DEDUPE_RANGE_SAME 0
0069 #define FILE_DEDUPE_RANGE_DIFFERS 1
0070
0071
0072 struct file_dedupe_range_info {
0073 __s64 dest_fd;
0074 __u64 dest_offset;
0075 __u64 bytes_deduped;
0076
0077
0078
0079
0080
0081
0082 __s32 status;
0083 __u32 reserved;
0084 };
0085
0086
0087 struct file_dedupe_range {
0088 __u64 src_offset;
0089 __u64 src_length;
0090 __u16 dest_count;
0091 __u16 reserved1;
0092 __u32 reserved2;
0093 struct file_dedupe_range_info info[];
0094 };
0095
0096
0097 struct files_stat_struct {
0098 unsigned long nr_files;
0099 unsigned long nr_free_files;
0100 unsigned long max_files;
0101 };
0102
0103 struct inodes_stat_t {
0104 long nr_inodes;
0105 long nr_unused;
0106 long dummy[5];
0107 };
0108
0109
0110 #define NR_FILE 8192
0111
0112
0113
0114
0115 struct fsxattr {
0116 __u32 fsx_xflags;
0117 __u32 fsx_extsize;
0118 __u32 fsx_nextents;
0119 __u32 fsx_projid;
0120 __u32 fsx_cowextsize;
0121 unsigned char fsx_pad[8];
0122 };
0123
0124
0125
0126
0127 #define FS_XFLAG_REALTIME 0x00000001
0128 #define FS_XFLAG_PREALLOC 0x00000002
0129 #define FS_XFLAG_IMMUTABLE 0x00000008
0130 #define FS_XFLAG_APPEND 0x00000010
0131 #define FS_XFLAG_SYNC 0x00000020
0132 #define FS_XFLAG_NOATIME 0x00000040
0133 #define FS_XFLAG_NODUMP 0x00000080
0134 #define FS_XFLAG_RTINHERIT 0x00000100
0135 #define FS_XFLAG_PROJINHERIT 0x00000200
0136 #define FS_XFLAG_NOSYMLINKS 0x00000400
0137 #define FS_XFLAG_EXTSIZE 0x00000800
0138 #define FS_XFLAG_EXTSZINHERIT 0x00001000
0139 #define FS_XFLAG_NODEFRAG 0x00002000
0140 #define FS_XFLAG_FILESTREAM 0x00004000
0141 #define FS_XFLAG_DAX 0x00008000
0142 #define FS_XFLAG_COWEXTSIZE 0x00010000
0143 #define FS_XFLAG_HASATTR 0x80000000
0144
0145
0146
0147
0148 #define BLKROSET _IO(0x12,93)
0149 #define BLKROGET _IO(0x12,94)
0150 #define BLKRRPART _IO(0x12,95)
0151 #define BLKGETSIZE _IO(0x12,96)
0152 #define BLKFLSBUF _IO(0x12,97)
0153 #define BLKRASET _IO(0x12,98)
0154 #define BLKRAGET _IO(0x12,99)
0155 #define BLKFRASET _IO(0x12,100)
0156 #define BLKFRAGET _IO(0x12,101)
0157 #define BLKSECTSET _IO(0x12,102)
0158 #define BLKSECTGET _IO(0x12,103)
0159 #define BLKSSZGET _IO(0x12,104)
0160 #if 0
0161 #define BLKPG _IO(0x12,105)
0162
0163
0164
0165 #define BLKELVGET _IOR(0x12,106,size_t)
0166 #define BLKELVSET _IOW(0x12,107,size_t)
0167
0168
0169 #endif
0170
0171 #define BLKBSZGET _IOR(0x12,112,size_t)
0172 #define BLKBSZSET _IOW(0x12,113,size_t)
0173 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
0174 #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
0175 #define BLKTRACESTART _IO(0x12,116)
0176 #define BLKTRACESTOP _IO(0x12,117)
0177 #define BLKTRACETEARDOWN _IO(0x12,118)
0178 #define BLKDISCARD _IO(0x12,119)
0179 #define BLKIOMIN _IO(0x12,120)
0180 #define BLKIOOPT _IO(0x12,121)
0181 #define BLKALIGNOFF _IO(0x12,122)
0182 #define BLKPBSZGET _IO(0x12,123)
0183 #define BLKDISCARDZEROES _IO(0x12,124)
0184 #define BLKSECDISCARD _IO(0x12,125)
0185 #define BLKROTATIONAL _IO(0x12,126)
0186 #define BLKZEROOUT _IO(0x12,127)
0187 #define BLKGETDISKSEQ _IOR(0x12,128,__u64)
0188
0189
0190
0191
0192
0193 #define BMAP_IOCTL 1
0194 #define FIBMAP _IO(0x00,1)
0195 #define FIGETBSZ _IO(0x00,2)
0196 #define FIFREEZE _IOWR('X', 119, int)
0197 #define FITHAW _IOWR('X', 120, int)
0198 #define FITRIM _IOWR('X', 121, struct fstrim_range)
0199 #define FICLONE _IOW(0x94, 9, int)
0200 #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
0201 #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
0202
0203 #define FSLABEL_MAX 256
0204
0205 #define FS_IOC_GETFLAGS _IOR('f', 1, long)
0206 #define FS_IOC_SETFLAGS _IOW('f', 2, long)
0207 #define FS_IOC_GETVERSION _IOR('v', 1, long)
0208 #define FS_IOC_SETVERSION _IOW('v', 2, long)
0209 #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
0210 #define FS_IOC32_GETFLAGS _IOR('f', 1, int)
0211 #define FS_IOC32_SETFLAGS _IOW('f', 2, int)
0212 #define FS_IOC32_GETVERSION _IOR('v', 1, int)
0213 #define FS_IOC32_SETVERSION _IOW('v', 2, int)
0214 #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
0215 #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
0216 #define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])
0217 #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX])
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239 #define FS_SECRM_FL 0x00000001
0240 #define FS_UNRM_FL 0x00000002
0241 #define FS_COMPR_FL 0x00000004
0242 #define FS_SYNC_FL 0x00000008
0243 #define FS_IMMUTABLE_FL 0x00000010
0244 #define FS_APPEND_FL 0x00000020
0245 #define FS_NODUMP_FL 0x00000040
0246 #define FS_NOATIME_FL 0x00000080
0247
0248 #define FS_DIRTY_FL 0x00000100
0249 #define FS_COMPRBLK_FL 0x00000200
0250 #define FS_NOCOMP_FL 0x00000400
0251
0252 #define FS_ENCRYPT_FL 0x00000800
0253 #define FS_BTREE_FL 0x00001000
0254 #define FS_INDEX_FL 0x00001000
0255 #define FS_IMAGIC_FL 0x00002000
0256 #define FS_JOURNAL_DATA_FL 0x00004000
0257 #define FS_NOTAIL_FL 0x00008000
0258 #define FS_DIRSYNC_FL 0x00010000
0259 #define FS_TOPDIR_FL 0x00020000
0260 #define FS_HUGE_FILE_FL 0x00040000
0261 #define FS_EXTENT_FL 0x00080000
0262 #define FS_VERITY_FL 0x00100000
0263 #define FS_EA_INODE_FL 0x00200000
0264 #define FS_EOFBLOCKS_FL 0x00400000
0265 #define FS_NOCOW_FL 0x00800000
0266 #define FS_DAX_FL 0x02000000
0267 #define FS_INLINE_DATA_FL 0x10000000
0268 #define FS_PROJINHERIT_FL 0x20000000
0269 #define FS_CASEFOLD_FL 0x40000000
0270 #define FS_RESERVED_FL 0x80000000
0271
0272 #define FS_FL_USER_VISIBLE 0x0003DFFF
0273 #define FS_FL_USER_MODIFIABLE 0x000380FF
0274
0275
0276 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
0277 #define SYNC_FILE_RANGE_WRITE 2
0278 #define SYNC_FILE_RANGE_WAIT_AFTER 4
0279 #define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \
0280 SYNC_FILE_RANGE_WAIT_BEFORE | \
0281 SYNC_FILE_RANGE_WAIT_AFTER)
0282
0283
0284
0285
0286
0287 typedef int __bitwise __kernel_rwf_t;
0288
0289
0290 #define RWF_HIPRI ((__force __kernel_rwf_t)0x00000001)
0291
0292
0293 #define RWF_DSYNC ((__force __kernel_rwf_t)0x00000002)
0294
0295
0296 #define RWF_SYNC ((__force __kernel_rwf_t)0x00000004)
0297
0298
0299 #define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008)
0300
0301
0302 #define RWF_APPEND ((__force __kernel_rwf_t)0x00000010)
0303
0304
0305 #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
0306 RWF_APPEND)
0307
0308 #endif