1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _UAPI_LINUX_FS_H 20 #define _UAPI_LINUX_FS_H 21 #include <linux/limits.h> 22 #include <linux/ioctl.h> 23 #include <linux/types.h> 24 #include <linux/mount.h> 25 #undef NR_OPEN 26 #define INR_OPEN_CUR 1024 27 #define INR_OPEN_MAX 4096 28 #define BLOCK_SIZE_BITS 10 29 #define BLOCK_SIZE (1 << BLOCK_SIZE_BITS) 30 #define SEEK_SET 0 31 #define SEEK_CUR 1 32 #define SEEK_END 2 33 #define SEEK_DATA 3 34 #define SEEK_HOLE 4 35 #define SEEK_MAX SEEK_HOLE 36 #define RENAME_NOREPLACE (1 << 0) 37 #define RENAME_EXCHANGE (1 << 1) 38 #define RENAME_WHITEOUT (1 << 2) 39 struct file_clone_range { 40 __s64 src_fd; 41 __u64 src_offset; 42 __u64 src_length; 43 __u64 dest_offset; 44 }; 45 struct fstrim_range { 46 __u64 start; 47 __u64 len; 48 __u64 minlen; 49 }; 50 #define FILE_DEDUPE_RANGE_SAME 0 51 #define FILE_DEDUPE_RANGE_DIFFERS 1 52 struct file_dedupe_range_info { 53 __s64 dest_fd; 54 __u64 dest_offset; 55 __u64 bytes_deduped; 56 __s32 status; 57 __u32 reserved; 58 }; 59 struct file_dedupe_range { 60 __u64 src_offset; 61 __u64 src_length; 62 __u16 dest_count; 63 __u16 reserved1; 64 __u32 reserved2; 65 struct file_dedupe_range_info info[0]; 66 }; 67 struct files_stat_struct { 68 unsigned long nr_files; 69 unsigned long nr_free_files; 70 unsigned long max_files; 71 }; 72 struct inodes_stat_t { 73 long nr_inodes; 74 long nr_unused; 75 long dummy[5]; 76 }; 77 #define NR_FILE 8192 78 struct fsxattr { 79 __u32 fsx_xflags; 80 __u32 fsx_extsize; 81 __u32 fsx_nextents; 82 __u32 fsx_projid; 83 __u32 fsx_cowextsize; 84 unsigned char fsx_pad[8]; 85 }; 86 #define FS_XFLAG_REALTIME 0x00000001 87 #define FS_XFLAG_PREALLOC 0x00000002 88 #define FS_XFLAG_IMMUTABLE 0x00000008 89 #define FS_XFLAG_APPEND 0x00000010 90 #define FS_XFLAG_SYNC 0x00000020 91 #define FS_XFLAG_NOATIME 0x00000040 92 #define FS_XFLAG_NODUMP 0x00000080 93 #define FS_XFLAG_RTINHERIT 0x00000100 94 #define FS_XFLAG_PROJINHERIT 0x00000200 95 #define FS_XFLAG_NOSYMLINKS 0x00000400 96 #define FS_XFLAG_EXTSIZE 0x00000800 97 #define FS_XFLAG_EXTSZINHERIT 0x00001000 98 #define FS_XFLAG_NODEFRAG 0x00002000 99 #define FS_XFLAG_FILESTREAM 0x00004000 100 #define FS_XFLAG_DAX 0x00008000 101 #define FS_XFLAG_COWEXTSIZE 0x00010000 102 #define FS_XFLAG_HASATTR 0x80000000 103 #define BLKROSET _IO(0x12, 93) 104 #define BLKROGET _IO(0x12, 94) 105 #define BLKRRPART _IO(0x12, 95) 106 #define BLKGETSIZE _IO(0x12, 96) 107 #define BLKFLSBUF _IO(0x12, 97) 108 #define BLKRASET _IO(0x12, 98) 109 #define BLKRAGET _IO(0x12, 99) 110 #define BLKFRASET _IO(0x12, 100) 111 #define BLKFRAGET _IO(0x12, 101) 112 #define BLKSECTSET _IO(0x12, 102) 113 #define BLKSECTGET _IO(0x12, 103) 114 #define BLKSSZGET _IO(0x12, 104) 115 #define BLKBSZGET _IOR(0x12, 112, size_t) 116 #define BLKBSZSET _IOW(0x12, 113, size_t) 117 #define BLKGETSIZE64 _IOR(0x12, 114, size_t) 118 #define BLKTRACESETUP _IOWR(0x12, 115, struct blk_user_trace_setup) 119 #define BLKTRACESTART _IO(0x12, 116) 120 #define BLKTRACESTOP _IO(0x12, 117) 121 #define BLKTRACETEARDOWN _IO(0x12, 118) 122 #define BLKDISCARD _IO(0x12, 119) 123 #define BLKIOMIN _IO(0x12, 120) 124 #define BLKIOOPT _IO(0x12, 121) 125 #define BLKALIGNOFF _IO(0x12, 122) 126 #define BLKPBSZGET _IO(0x12, 123) 127 #define BLKDISCARDZEROES _IO(0x12, 124) 128 #define BLKSECDISCARD _IO(0x12, 125) 129 #define BLKROTATIONAL _IO(0x12, 126) 130 #define BLKZEROOUT _IO(0x12, 127) 131 #define BMAP_IOCTL 1 132 #define FIBMAP _IO(0x00, 1) 133 #define FIGETBSZ _IO(0x00, 2) 134 #define FIFREEZE _IOWR('X', 119, int) 135 #define FITHAW _IOWR('X', 120, int) 136 #define FITRIM _IOWR('X', 121, struct fstrim_range) 137 #define FICLONE _IOW(0x94, 9, int) 138 #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) 139 #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) 140 #define FSLABEL_MAX 256 141 #define FS_IOC_GETFLAGS _IOR('f', 1, long) 142 #define FS_IOC_SETFLAGS _IOW('f', 2, long) 143 #define FS_IOC_GETVERSION _IOR('v', 1, long) 144 #define FS_IOC_SETVERSION _IOW('v', 2, long) 145 #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) 146 #define FS_IOC32_GETFLAGS _IOR('f', 1, int) 147 #define FS_IOC32_SETFLAGS _IOW('f', 2, int) 148 #define FS_IOC32_GETVERSION _IOR('v', 1, int) 149 #define FS_IOC32_SETVERSION _IOW('v', 2, int) 150 #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) 151 #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) 152 #define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX]) 153 #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) 154 #define FS_KEY_DESCRIPTOR_SIZE 8 155 #define FS_POLICY_FLAGS_PAD_4 0x00 156 #define FS_POLICY_FLAGS_PAD_8 0x01 157 #define FS_POLICY_FLAGS_PAD_16 0x02 158 #define FS_POLICY_FLAGS_PAD_32 0x03 159 #define FS_POLICY_FLAGS_PAD_MASK 0x03 160 #define FS_POLICY_FLAG_DIRECT_KEY 0x04 161 #define FS_POLICY_FLAGS_VALID 0x07 162 #define FS_ENCRYPTION_MODE_INVALID 0 163 #define FS_ENCRYPTION_MODE_AES_256_XTS 1 164 #define FS_ENCRYPTION_MODE_AES_256_GCM 2 165 #define FS_ENCRYPTION_MODE_AES_256_CBC 3 166 #define FS_ENCRYPTION_MODE_AES_256_CTS 4 167 #define FS_ENCRYPTION_MODE_AES_128_CBC 5 168 #define FS_ENCRYPTION_MODE_AES_128_CTS 6 169 #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 170 #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 171 #define FS_ENCRYPTION_MODE_ADIANTUM 9 172 struct fscrypt_policy { 173 __u8 version; 174 __u8 contents_encryption_mode; 175 __u8 filenames_encryption_mode; 176 __u8 flags; 177 __u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; 178 }; 179 #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) 180 #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) 181 #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) 182 #define FS_KEY_DESC_PREFIX "fscrypt:" 183 #define FS_KEY_DESC_PREFIX_SIZE 8 184 #define FS_MAX_KEY_SIZE 64 185 struct fscrypt_key { 186 __u32 mode; 187 __u8 raw[FS_MAX_KEY_SIZE]; 188 __u32 size; 189 }; 190 #define FS_SECRM_FL 0x00000001 191 #define FS_UNRM_FL 0x00000002 192 #define FS_COMPR_FL 0x00000004 193 #define FS_SYNC_FL 0x00000008 194 #define FS_IMMUTABLE_FL 0x00000010 195 #define FS_APPEND_FL 0x00000020 196 #define FS_NODUMP_FL 0x00000040 197 #define FS_NOATIME_FL 0x00000080 198 #define FS_DIRTY_FL 0x00000100 199 #define FS_COMPRBLK_FL 0x00000200 200 #define FS_NOCOMP_FL 0x00000400 201 #define FS_ENCRYPT_FL 0x00000800 202 #define FS_BTREE_FL 0x00001000 203 #define FS_INDEX_FL 0x00001000 204 #define FS_IMAGIC_FL 0x00002000 205 #define FS_JOURNAL_DATA_FL 0x00004000 206 #define FS_NOTAIL_FL 0x00008000 207 #define FS_DIRSYNC_FL 0x00010000 208 #define FS_TOPDIR_FL 0x00020000 209 #define FS_HUGE_FILE_FL 0x00040000 210 #define FS_EXTENT_FL 0x00080000 211 #define FS_EA_INODE_FL 0x00200000 212 #define FS_EOFBLOCKS_FL 0x00400000 213 #define FS_NOCOW_FL 0x00800000 214 #define FS_INLINE_DATA_FL 0x10000000 215 #define FS_PROJINHERIT_FL 0x20000000 216 #define FS_RESERVED_FL 0x80000000 217 #define FS_FL_USER_VISIBLE 0x0003DFFF 218 #define FS_FL_USER_MODIFIABLE 0x000380FF 219 #define SYNC_FILE_RANGE_WAIT_BEFORE 1 220 #define SYNC_FILE_RANGE_WRITE 2 221 #define SYNC_FILE_RANGE_WAIT_AFTER 4 222 typedef int __bitwise __kernel_rwf_t; 223 #define RWF_HIPRI ((__force __kernel_rwf_t) 0x00000001) 224 #define RWF_DSYNC ((__force __kernel_rwf_t) 0x00000002) 225 #define RWF_SYNC ((__force __kernel_rwf_t) 0x00000004) 226 #define RWF_NOWAIT ((__force __kernel_rwf_t) 0x00000008) 227 #define RWF_APPEND ((__force __kernel_rwf_t) 0x00000010) 228 #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT | RWF_APPEND) 229 #endif 230