16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells #ifndef _UAPI_LINUX_FS_H 3607ca46eSDavid Howells #define _UAPI_LINUX_FS_H 4607ca46eSDavid Howells 5607ca46eSDavid Howells /* 668ce7bfcSTheodore Ts'o * This file has definitions for some important file table structures 768ce7bfcSTheodore Ts'o * and constants and structures used by various generic file system 868ce7bfcSTheodore Ts'o * ioctl's. Please do not make any changes in this file before 968ce7bfcSTheodore Ts'o * sending patches for review to linux-fsdevel@vger.kernel.org and 1068ce7bfcSTheodore Ts'o * linux-api@vger.kernel.org. 11607ca46eSDavid Howells */ 12607ca46eSDavid Howells 13607ca46eSDavid Howells #include <linux/limits.h> 14607ca46eSDavid Howells #include <linux/ioctl.h> 15607ca46eSDavid Howells #include <linux/types.h> 167af0ab0dSEric Biggers #ifndef __KERNEL__ 177af0ab0dSEric Biggers #include <linux/fscrypt.h> 187af0ab0dSEric Biggers #endif 19607ca46eSDavid Howells 20e262e32dSDavid Howells /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ 21e262e32dSDavid Howells #if !defined(__KERNEL__) 22e262e32dSDavid Howells #include <linux/mount.h> 23e262e32dSDavid Howells #endif 24e262e32dSDavid Howells 25607ca46eSDavid Howells /* 26607ca46eSDavid Howells * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 27607ca46eSDavid Howells * the file limit at runtime and only root can increase the per-process 28607ca46eSDavid Howells * nr_file rlimit, so it's safe to set up a ridiculously high absolute 29607ca46eSDavid Howells * upper limit on files-per-process. 30607ca46eSDavid Howells * 31607ca46eSDavid Howells * Some programs (notably those using select()) may have to be 32607ca46eSDavid Howells * recompiled to take full advantage of the new limits.. 33607ca46eSDavid Howells */ 34607ca46eSDavid Howells 35607ca46eSDavid Howells /* Fixed constants first: */ 36607ca46eSDavid Howells #undef NR_OPEN 37607ca46eSDavid Howells #define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ 38607ca46eSDavid Howells #define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ 39607ca46eSDavid Howells 40607ca46eSDavid Howells #define BLOCK_SIZE_BITS 10 41607ca46eSDavid Howells #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) 42607ca46eSDavid Howells 43607ca46eSDavid Howells #define SEEK_SET 0 /* seek relative to beginning of file */ 44607ca46eSDavid Howells #define SEEK_CUR 1 /* seek relative to current file position */ 45607ca46eSDavid Howells #define SEEK_END 2 /* seek relative to end of file */ 46607ca46eSDavid Howells #define SEEK_DATA 3 /* seek to the next data */ 47607ca46eSDavid Howells #define SEEK_HOLE 4 /* seek to the next hole */ 48607ca46eSDavid Howells #define SEEK_MAX SEEK_HOLE 49607ca46eSDavid Howells 500a7c3937SMiklos Szeredi #define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ 51da1ce067SMiklos Szeredi #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ 520d7a8555SMiklos Szeredi #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ 530a7c3937SMiklos Szeredi 5404b38d60SChristoph Hellwig struct file_clone_range { 5504b38d60SChristoph Hellwig __s64 src_fd; 5604b38d60SChristoph Hellwig __u64 src_offset; 5704b38d60SChristoph Hellwig __u64 src_length; 5804b38d60SChristoph Hellwig __u64 dest_offset; 5904b38d60SChristoph Hellwig }; 6004b38d60SChristoph Hellwig 61607ca46eSDavid Howells struct fstrim_range { 62607ca46eSDavid Howells __u64 start; 63607ca46eSDavid Howells __u64 len; 64607ca46eSDavid Howells __u64 minlen; 65607ca46eSDavid Howells }; 66607ca46eSDavid Howells 6741bcbe59SKent Overstreet /* 6841bcbe59SKent Overstreet * We include a length field because some filesystems (vfat) have an identifier 6941bcbe59SKent Overstreet * that we do want to expose as a UUID, but doesn't have the standard length. 7041bcbe59SKent Overstreet * 7141bcbe59SKent Overstreet * We use a fixed size buffer beacuse this interface will, by fiat, never 7241bcbe59SKent Overstreet * support "UUIDs" longer than 16 bytes; we don't want to force all downstream 7341bcbe59SKent Overstreet * users to have to deal with that. 7441bcbe59SKent Overstreet */ 7541bcbe59SKent Overstreet struct fsuuid2 { 7641bcbe59SKent Overstreet __u8 len; 7741bcbe59SKent Overstreet __u8 uuid[16]; 7841bcbe59SKent Overstreet }; 7941bcbe59SKent Overstreet 80*ae8c5117SKent Overstreet struct fs_sysfs_path { 81*ae8c5117SKent Overstreet __u8 len; 82*ae8c5117SKent Overstreet __u8 name[128]; 83*ae8c5117SKent Overstreet }; 84*ae8c5117SKent Overstreet 8554dbc151SDarrick J. Wong /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ 8654dbc151SDarrick J. Wong #define FILE_DEDUPE_RANGE_SAME 0 8754dbc151SDarrick J. Wong #define FILE_DEDUPE_RANGE_DIFFERS 1 8854dbc151SDarrick J. Wong 8954dbc151SDarrick J. Wong /* from struct btrfs_ioctl_file_extent_same_info */ 9054dbc151SDarrick J. Wong struct file_dedupe_range_info { 9154dbc151SDarrick J. Wong __s64 dest_fd; /* in - destination file */ 9254dbc151SDarrick J. Wong __u64 dest_offset; /* in - start of extent in destination */ 9354dbc151SDarrick J. Wong __u64 bytes_deduped; /* out - total # of bytes we were able 9454dbc151SDarrick J. Wong * to dedupe from this file. */ 9554dbc151SDarrick J. Wong /* status of this dedupe operation: 9654dbc151SDarrick J. Wong * < 0 for error 9754dbc151SDarrick J. Wong * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds 9854dbc151SDarrick J. Wong * == FILE_DEDUPE_RANGE_DIFFERS if data differs 9954dbc151SDarrick J. Wong */ 10054dbc151SDarrick J. Wong __s32 status; /* out - see above description */ 10154dbc151SDarrick J. Wong __u32 reserved; /* must be zero */ 10254dbc151SDarrick J. Wong }; 10354dbc151SDarrick J. Wong 10454dbc151SDarrick J. Wong /* from struct btrfs_ioctl_file_extent_same_args */ 10554dbc151SDarrick J. Wong struct file_dedupe_range { 10654dbc151SDarrick J. Wong __u64 src_offset; /* in - start of extent in source */ 10754dbc151SDarrick J. Wong __u64 src_length; /* in - length of extent */ 10854dbc151SDarrick J. Wong __u16 dest_count; /* in - total elements in info array */ 10954dbc151SDarrick J. Wong __u16 reserved1; /* must be zero */ 11054dbc151SDarrick J. Wong __u32 reserved2; /* must be zero */ 11194dfc73eSGustavo A. R. Silva struct file_dedupe_range_info info[]; 11254dbc151SDarrick J. Wong }; 11354dbc151SDarrick J. Wong 114607ca46eSDavid Howells /* And dynamically-tunable limits and defaults: */ 115607ca46eSDavid Howells struct files_stat_struct { 116607ca46eSDavid Howells unsigned long nr_files; /* read only */ 117607ca46eSDavid Howells unsigned long nr_free_files; /* read only */ 118607ca46eSDavid Howells unsigned long max_files; /* tunable */ 119607ca46eSDavid Howells }; 120607ca46eSDavid Howells 121607ca46eSDavid Howells struct inodes_stat_t { 1223942c07cSGlauber Costa long nr_inodes; 1233942c07cSGlauber Costa long nr_unused; 1243942c07cSGlauber Costa long dummy[5]; /* padding for sysctl ABI compatibility */ 125607ca46eSDavid Howells }; 126607ca46eSDavid Howells 127607ca46eSDavid Howells 128607ca46eSDavid Howells #define NR_FILE 8192 /* this can well be larger on a larger system */ 129607ca46eSDavid Howells 130334e580aSDave Chinner /* 131334e580aSDave Chinner * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. 132334e580aSDave Chinner */ 133334e580aSDave Chinner struct fsxattr { 134334e580aSDave Chinner __u32 fsx_xflags; /* xflags field value (get/set) */ 135334e580aSDave Chinner __u32 fsx_extsize; /* extsize field value (get/set)*/ 136334e580aSDave Chinner __u32 fsx_nextents; /* nextents field value (get) */ 137334e580aSDave Chinner __u32 fsx_projid; /* project identifier (get/set) */ 1380a6eab8bSDarrick J. Wong __u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ 1390a6eab8bSDarrick J. Wong unsigned char fsx_pad[8]; 140334e580aSDave Chinner }; 141334e580aSDave Chinner 142334e580aSDave Chinner /* 143334e580aSDave Chinner * Flags for the fsx_xflags field 144334e580aSDave Chinner */ 145334e580aSDave Chinner #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ 146334e580aSDave Chinner #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ 147334e580aSDave Chinner #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ 148334e580aSDave Chinner #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ 149334e580aSDave Chinner #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ 150334e580aSDave Chinner #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ 151334e580aSDave Chinner #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ 152334e580aSDave Chinner #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ 153334e580aSDave Chinner #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ 154334e580aSDave Chinner #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ 155334e580aSDave Chinner #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ 156334e580aSDave Chinner #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ 157334e580aSDave Chinner #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ 158334e580aSDave Chinner #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ 15958f88ca2SDave Chinner #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ 1600a6eab8bSDarrick J. Wong #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ 161334e580aSDave Chinner #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ 162334e580aSDave Chinner 163607ca46eSDavid Howells /* the read-only stuff doesn't really belong here, but any other place is 164607ca46eSDavid Howells probably as bad and I don't want to create yet another include file. */ 165607ca46eSDavid Howells 166607ca46eSDavid Howells #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ 167607ca46eSDavid Howells #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ 168607ca46eSDavid Howells #define BLKRRPART _IO(0x12,95) /* re-read partition table */ 169607ca46eSDavid Howells #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ 170607ca46eSDavid Howells #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ 171607ca46eSDavid Howells #define BLKRASET _IO(0x12,98) /* set read ahead for block device */ 172607ca46eSDavid Howells #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ 173607ca46eSDavid Howells #define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 174607ca46eSDavid Howells #define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 175607ca46eSDavid Howells #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 176607ca46eSDavid Howells #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 177607ca46eSDavid Howells #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ 178607ca46eSDavid Howells #if 0 179607ca46eSDavid Howells #define BLKPG _IO(0x12,105)/* See blkpg.h */ 180607ca46eSDavid Howells 181607ca46eSDavid Howells /* Some people are morons. Do not use sizeof! */ 182607ca46eSDavid Howells 183607ca46eSDavid Howells #define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ 184607ca46eSDavid Howells #define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ 185607ca46eSDavid Howells /* This was here just to show that the number is taken - 186607ca46eSDavid Howells probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ 187607ca46eSDavid Howells #endif 188607ca46eSDavid Howells /* A jump here: 108-111 have been used for various private purposes. */ 189607ca46eSDavid Howells #define BLKBSZGET _IOR(0x12,112,size_t) 190607ca46eSDavid Howells #define BLKBSZSET _IOW(0x12,113,size_t) 191607ca46eSDavid Howells #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ 192607ca46eSDavid Howells #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) 193607ca46eSDavid Howells #define BLKTRACESTART _IO(0x12,116) 194607ca46eSDavid Howells #define BLKTRACESTOP _IO(0x12,117) 195607ca46eSDavid Howells #define BLKTRACETEARDOWN _IO(0x12,118) 196607ca46eSDavid Howells #define BLKDISCARD _IO(0x12,119) 197607ca46eSDavid Howells #define BLKIOMIN _IO(0x12,120) 198607ca46eSDavid Howells #define BLKIOOPT _IO(0x12,121) 199607ca46eSDavid Howells #define BLKALIGNOFF _IO(0x12,122) 200607ca46eSDavid Howells #define BLKPBSZGET _IO(0x12,123) 201607ca46eSDavid Howells #define BLKDISCARDZEROES _IO(0x12,124) 202607ca46eSDavid Howells #define BLKSECDISCARD _IO(0x12,125) 203607ca46eSDavid Howells #define BLKROTATIONAL _IO(0x12,126) 204607ca46eSDavid Howells #define BLKZEROOUT _IO(0x12,127) 2057957d93bSMatteo Croce #define BLKGETDISKSEQ _IOR(0x12,128,__u64) 2063ed05a98SShaun Tancheff /* 20763c8af56SDamien Le Moal * A jump here: 130-136 are reserved for zoned block devices 2083ed05a98SShaun Tancheff * (see uapi/linux/blkzoned.h) 2093ed05a98SShaun Tancheff */ 210607ca46eSDavid Howells 211607ca46eSDavid Howells #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 212607ca46eSDavid Howells #define FIBMAP _IO(0x00,1) /* bmap access */ 213607ca46eSDavid Howells #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ 214607ca46eSDavid Howells #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ 215607ca46eSDavid Howells #define FITHAW _IOWR('X', 120, int) /* Thaw */ 216607ca46eSDavid Howells #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ 21704b38d60SChristoph Hellwig #define FICLONE _IOW(0x94, 9, int) 21804b38d60SChristoph Hellwig #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) 21954dbc151SDarrick J. Wong #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) 220607ca46eSDavid Howells 22162750d04SEric Sandeen #define FSLABEL_MAX 256 /* Max chars for the interface; each fs may differ */ 22262750d04SEric Sandeen 223607ca46eSDavid Howells #define FS_IOC_GETFLAGS _IOR('f', 1, long) 224607ca46eSDavid Howells #define FS_IOC_SETFLAGS _IOW('f', 2, long) 225607ca46eSDavid Howells #define FS_IOC_GETVERSION _IOR('v', 1, long) 226607ca46eSDavid Howells #define FS_IOC_SETVERSION _IOW('v', 2, long) 227607ca46eSDavid Howells #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) 228607ca46eSDavid Howells #define FS_IOC32_GETFLAGS _IOR('f', 1, int) 229607ca46eSDavid Howells #define FS_IOC32_SETFLAGS _IOW('f', 2, int) 230607ca46eSDavid Howells #define FS_IOC32_GETVERSION _IOR('v', 1, int) 231607ca46eSDavid Howells #define FS_IOC32_SETVERSION _IOW('v', 2, int) 232334e580aSDave Chinner #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) 233334e580aSDave Chinner #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) 23462750d04SEric Sandeen #define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX]) 23562750d04SEric Sandeen #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) 23641bcbe59SKent Overstreet /* Returns the external filesystem UUID, the same one blkid returns */ 23741bcbe59SKent Overstreet #define FS_IOC_GETFSUUID _IOR(0x15, 0, struct fsuuid2) 238*ae8c5117SKent Overstreet /* 239*ae8c5117SKent Overstreet * Returns the path component under /sys/fs/ that refers to this filesystem; 240*ae8c5117SKent Overstreet * also /sys/kernel/debug/ for filesystems with debugfs exports 241*ae8c5117SKent Overstreet */ 242*ae8c5117SKent Overstreet #define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path) 243607ca46eSDavid Howells 244607ca46eSDavid Howells /* 245607ca46eSDavid Howells * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) 24668ce7bfcSTheodore Ts'o * 24768ce7bfcSTheodore Ts'o * Note: for historical reasons, these flags were originally used and 24868ce7bfcSTheodore Ts'o * defined for use by ext2/ext3, and then other file systems started 24968ce7bfcSTheodore Ts'o * using these flags so they wouldn't need to write their own version 25068ce7bfcSTheodore Ts'o * of chattr/lsattr (which was shipped as part of e2fsprogs). You 25168ce7bfcSTheodore Ts'o * should think twice before trying to use these flags in new 25268ce7bfcSTheodore Ts'o * contexts, or trying to assign these flags, since they are used both 25368ce7bfcSTheodore Ts'o * as the UAPI and the on-disk encoding for ext2/3/4. Also, we are 25468ce7bfcSTheodore Ts'o * almost out of 32-bit flags. :-) 25568ce7bfcSTheodore Ts'o * 25668ce7bfcSTheodore Ts'o * We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from 25768ce7bfcSTheodore Ts'o * XFS to the generic FS level interface. This uses a structure that 25868ce7bfcSTheodore Ts'o * has padding and hence has more room to grow, so it may be more 25968ce7bfcSTheodore Ts'o * appropriate for many new use cases. 26068ce7bfcSTheodore Ts'o * 26168ce7bfcSTheodore Ts'o * Please do not change these flags or interfaces before checking with 26268ce7bfcSTheodore Ts'o * linux-fsdevel@vger.kernel.org and linux-api@vger.kernel.org. 263607ca46eSDavid Howells */ 264607ca46eSDavid Howells #define FS_SECRM_FL 0x00000001 /* Secure deletion */ 265607ca46eSDavid Howells #define FS_UNRM_FL 0x00000002 /* Undelete */ 266607ca46eSDavid Howells #define FS_COMPR_FL 0x00000004 /* Compress file */ 267607ca46eSDavid Howells #define FS_SYNC_FL 0x00000008 /* Synchronous updates */ 268607ca46eSDavid Howells #define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ 269607ca46eSDavid Howells #define FS_APPEND_FL 0x00000020 /* writes to file may only append */ 270607ca46eSDavid Howells #define FS_NODUMP_FL 0x00000040 /* do not dump file */ 271607ca46eSDavid Howells #define FS_NOATIME_FL 0x00000080 /* do not update atime */ 272607ca46eSDavid Howells /* Reserved for compression usage... */ 273607ca46eSDavid Howells #define FS_DIRTY_FL 0x00000100 274607ca46eSDavid Howells #define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ 275607ca46eSDavid Howells #define FS_NOCOMP_FL 0x00000400 /* Don't compress */ 276607ca46eSDavid Howells /* End compression flags --- maybe not all used */ 27768ce7bfcSTheodore Ts'o #define FS_ENCRYPT_FL 0x00000800 /* Encrypted file */ 278607ca46eSDavid Howells #define FS_BTREE_FL 0x00001000 /* btree format dir */ 279607ca46eSDavid Howells #define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ 280607ca46eSDavid Howells #define FS_IMAGIC_FL 0x00002000 /* AFS directory */ 281607ca46eSDavid Howells #define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ 282607ca46eSDavid Howells #define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 283607ca46eSDavid Howells #define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 284607ca46eSDavid Howells #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 28568ce7bfcSTheodore Ts'o #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ 286607ca46eSDavid Howells #define FS_EXTENT_FL 0x00080000 /* Extents */ 287fe9918d3SEric Biggers #define FS_VERITY_FL 0x00100000 /* Verity protected inode */ 28868ce7bfcSTheodore Ts'o #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ 28968ce7bfcSTheodore Ts'o #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ 290607ca46eSDavid Howells #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ 291b383a73fSIra Weiny #define FS_DAX_FL 0x02000000 /* Inode is DAX */ 29268ce7bfcSTheodore Ts'o #define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */ 2938b4953e1STheodore Ts'o #define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ 29471e90b46SDaniel Rosenberg #define FS_CASEFOLD_FL 0x40000000 /* Folder is case insensitive */ 295607ca46eSDavid Howells #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 296607ca46eSDavid Howells 297607ca46eSDavid Howells #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 298607ca46eSDavid Howells #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 299607ca46eSDavid Howells 300607ca46eSDavid Howells 301607ca46eSDavid Howells #define SYNC_FILE_RANGE_WAIT_BEFORE 1 302607ca46eSDavid Howells #define SYNC_FILE_RANGE_WRITE 2 303607ca46eSDavid Howells #define SYNC_FILE_RANGE_WAIT_AFTER 4 304c553ea4fSAmir Goldstein #define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \ 305c553ea4fSAmir Goldstein SYNC_FILE_RANGE_WAIT_BEFORE | \ 306c553ea4fSAmir Goldstein SYNC_FILE_RANGE_WAIT_AFTER) 307607ca46eSDavid Howells 308ddef7ed2SChristoph Hellwig /* 309ddef7ed2SChristoph Hellwig * Flags for preadv2/pwritev2: 310ddef7ed2SChristoph Hellwig */ 31197be7ebeSChristoph Hellwig 312ddef7ed2SChristoph Hellwig typedef int __bitwise __kernel_rwf_t; 313ddef7ed2SChristoph Hellwig 314ddef7ed2SChristoph Hellwig /* high priority request, poll if possible */ 315ddef7ed2SChristoph Hellwig #define RWF_HIPRI ((__force __kernel_rwf_t)0x00000001) 316ddef7ed2SChristoph Hellwig 317ddef7ed2SChristoph Hellwig /* per-IO O_DSYNC */ 318ddef7ed2SChristoph Hellwig #define RWF_DSYNC ((__force __kernel_rwf_t)0x00000002) 319ddef7ed2SChristoph Hellwig 320ddef7ed2SChristoph Hellwig /* per-IO O_SYNC */ 321ddef7ed2SChristoph Hellwig #define RWF_SYNC ((__force __kernel_rwf_t)0x00000004) 322ddef7ed2SChristoph Hellwig 323ddef7ed2SChristoph Hellwig /* per-IO, return -EAGAIN if operation would block */ 324ddef7ed2SChristoph Hellwig #define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008) 325ddef7ed2SChristoph Hellwig 326e1fc742eSJürg Billeter /* per-IO O_APPEND */ 327e1fc742eSJürg Billeter #define RWF_APPEND ((__force __kernel_rwf_t)0x00000010) 328e1fc742eSJürg Billeter 32973fa7547SRich Felker /* per-IO negation of O_APPEND */ 33073fa7547SRich Felker #define RWF_NOAPPEND ((__force __kernel_rwf_t)0x00000020) 33173fa7547SRich Felker 332ddef7ed2SChristoph Hellwig /* mask of flags supported by the kernel */ 333e1fc742eSJürg Billeter #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ 33473fa7547SRich Felker RWF_APPEND | RWF_NOAPPEND) 335fdd2f5b7SGoldwyn Rodrigues 33652526ca7SMuhammad Usama Anjum /* Pagemap ioctl */ 33752526ca7SMuhammad Usama Anjum #define PAGEMAP_SCAN _IOWR('f', 16, struct pm_scan_arg) 33852526ca7SMuhammad Usama Anjum 33952526ca7SMuhammad Usama Anjum /* Bitmasks provided in pm_scan_args masks and reported in page_region.categories. */ 34052526ca7SMuhammad Usama Anjum #define PAGE_IS_WPALLOWED (1 << 0) 34152526ca7SMuhammad Usama Anjum #define PAGE_IS_WRITTEN (1 << 1) 34252526ca7SMuhammad Usama Anjum #define PAGE_IS_FILE (1 << 2) 34352526ca7SMuhammad Usama Anjum #define PAGE_IS_PRESENT (1 << 3) 34452526ca7SMuhammad Usama Anjum #define PAGE_IS_SWAPPED (1 << 4) 34552526ca7SMuhammad Usama Anjum #define PAGE_IS_PFNZERO (1 << 5) 34652526ca7SMuhammad Usama Anjum #define PAGE_IS_HUGE (1 << 6) 347e6a9a2cbSAndrei Vagin #define PAGE_IS_SOFT_DIRTY (1 << 7) 34852526ca7SMuhammad Usama Anjum 34952526ca7SMuhammad Usama Anjum /* 35052526ca7SMuhammad Usama Anjum * struct page_region - Page region with flags 35152526ca7SMuhammad Usama Anjum * @start: Start of the region 35252526ca7SMuhammad Usama Anjum * @end: End of the region (exclusive) 35352526ca7SMuhammad Usama Anjum * @categories: PAGE_IS_* category bitmask for the region 35452526ca7SMuhammad Usama Anjum */ 35552526ca7SMuhammad Usama Anjum struct page_region { 35652526ca7SMuhammad Usama Anjum __u64 start; 35752526ca7SMuhammad Usama Anjum __u64 end; 35852526ca7SMuhammad Usama Anjum __u64 categories; 35952526ca7SMuhammad Usama Anjum }; 36052526ca7SMuhammad Usama Anjum 36152526ca7SMuhammad Usama Anjum /* Flags for PAGEMAP_SCAN ioctl */ 36252526ca7SMuhammad Usama Anjum #define PM_SCAN_WP_MATCHING (1 << 0) /* Write protect the pages matched. */ 36352526ca7SMuhammad Usama Anjum #define PM_SCAN_CHECK_WPASYNC (1 << 1) /* Abort the scan when a non-WP-enabled page is found. */ 36452526ca7SMuhammad Usama Anjum 36552526ca7SMuhammad Usama Anjum /* 36652526ca7SMuhammad Usama Anjum * struct pm_scan_arg - Pagemap ioctl argument 36752526ca7SMuhammad Usama Anjum * @size: Size of the structure 36852526ca7SMuhammad Usama Anjum * @flags: Flags for the IOCTL 36952526ca7SMuhammad Usama Anjum * @start: Starting address of the region 37052526ca7SMuhammad Usama Anjum * @end: Ending address of the region 37152526ca7SMuhammad Usama Anjum * @walk_end Address where the scan stopped (written by kernel). 37252526ca7SMuhammad Usama Anjum * walk_end == end (address tags cleared) informs that the scan completed on entire range. 37352526ca7SMuhammad Usama Anjum * @vec: Address of page_region struct array for output 37452526ca7SMuhammad Usama Anjum * @vec_len: Length of the page_region struct array 37552526ca7SMuhammad Usama Anjum * @max_pages: Optional limit for number of returned pages (0 = disabled) 37652526ca7SMuhammad Usama Anjum * @category_inverted: PAGE_IS_* categories which values match if 0 instead of 1 37752526ca7SMuhammad Usama Anjum * @category_mask: Skip pages for which any category doesn't match 37852526ca7SMuhammad Usama Anjum * @category_anyof_mask: Skip pages for which no category matches 37952526ca7SMuhammad Usama Anjum * @return_mask: PAGE_IS_* categories that are to be reported in `page_region`s returned 38052526ca7SMuhammad Usama Anjum */ 38152526ca7SMuhammad Usama Anjum struct pm_scan_arg { 38252526ca7SMuhammad Usama Anjum __u64 size; 38352526ca7SMuhammad Usama Anjum __u64 flags; 38452526ca7SMuhammad Usama Anjum __u64 start; 38552526ca7SMuhammad Usama Anjum __u64 end; 38652526ca7SMuhammad Usama Anjum __u64 walk_end; 38752526ca7SMuhammad Usama Anjum __u64 vec; 38852526ca7SMuhammad Usama Anjum __u64 vec_len; 38952526ca7SMuhammad Usama Anjum __u64 max_pages; 39052526ca7SMuhammad Usama Anjum __u64 category_inverted; 39152526ca7SMuhammad Usama Anjum __u64 category_mask; 39252526ca7SMuhammad Usama Anjum __u64 category_anyof_mask; 39352526ca7SMuhammad Usama Anjum __u64 return_mask; 39452526ca7SMuhammad Usama Anjum }; 39552526ca7SMuhammad Usama Anjum 396607ca46eSDavid Howells #endif /* _UAPI_LINUX_FS_H */ 397