blob: 9288653d74f6826ed8e81f6c7c899f9b4f871ca0 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_FS_H
8#define _UAPI_LINUX_FS_H
9#include <linux/limits.h>
10#include <linux/ioctl.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070011#include <linux/types.h>
Christopher Ferris9584fa42019-12-09 15:36:13 -080012#include <linux/fscrypt.h>
Christopher Ferrisd842e432019-03-07 10:21:59 -080013#include <linux/mount.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070014#undef NR_OPEN
15#define INR_OPEN_CUR 1024
16#define INR_OPEN_MAX 4096
Ben Cheng655a7c02013-10-16 16:09:24 -070017#define BLOCK_SIZE_BITS 10
Tao Baod7db5942015-01-28 10:07:51 -080018#define BLOCK_SIZE (1 << BLOCK_SIZE_BITS)
Ben Cheng655a7c02013-10-16 16:09:24 -070019#define SEEK_SET 0
20#define SEEK_CUR 1
Ben Cheng655a7c02013-10-16 16:09:24 -070021#define SEEK_END 2
22#define SEEK_DATA 3
23#define SEEK_HOLE 4
24#define SEEK_MAX SEEK_HOLE
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070025#define RENAME_NOREPLACE (1 << 0)
26#define RENAME_EXCHANGE (1 << 1)
Christopher Ferris82d75042015-01-26 10:57:07 -080027#define RENAME_WHITEOUT (1 << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -070028struct file_clone_range {
Christopher Ferris106b3a82016-08-24 12:15:38 -070029 __s64 src_fd;
30 __u64 src_offset;
31 __u64 src_length;
32 __u64 dest_offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -070033};
34struct fstrim_range {
Tao Baod7db5942015-01-28 10:07:51 -080035 __u64 start;
36 __u64 len;
37 __u64 minlen;
Ben Cheng655a7c02013-10-16 16:09:24 -070038};
Christopher Ferris106b3a82016-08-24 12:15:38 -070039#define FILE_DEDUPE_RANGE_SAME 0
40#define FILE_DEDUPE_RANGE_DIFFERS 1
Christopher Ferris106b3a82016-08-24 12:15:38 -070041struct file_dedupe_range_info {
42 __s64 dest_fd;
43 __u64 dest_offset;
44 __u64 bytes_deduped;
Christopher Ferris106b3a82016-08-24 12:15:38 -070045 __s32 status;
46 __u32 reserved;
47};
48struct file_dedupe_range {
Christopher Ferris106b3a82016-08-24 12:15:38 -070049 __u64 src_offset;
50 __u64 src_length;
51 __u16 dest_count;
52 __u16 reserved1;
Christopher Ferris106b3a82016-08-24 12:15:38 -070053 __u32 reserved2;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070054 struct file_dedupe_range_info info[];
Christopher Ferris106b3a82016-08-24 12:15:38 -070055};
Christopher Ferris82d75042015-01-26 10:57:07 -080056struct files_stat_struct {
Tao Baod7db5942015-01-28 10:07:51 -080057 unsigned long nr_files;
58 unsigned long nr_free_files;
59 unsigned long max_files;
Christopher Ferris82d75042015-01-26 10:57:07 -080060};
Ben Cheng655a7c02013-10-16 16:09:24 -070061struct inodes_stat_t {
Tao Baod7db5942015-01-28 10:07:51 -080062 long nr_inodes;
63 long nr_unused;
Tao Baod7db5942015-01-28 10:07:51 -080064 long dummy[5];
Ben Cheng655a7c02013-10-16 16:09:24 -070065};
66#define NR_FILE 8192
Christopher Ferris106b3a82016-08-24 12:15:38 -070067struct fsxattr {
Christopher Ferris6a9755d2017-01-13 14:09:31 -080068 __u32 fsx_xflags;
Christopher Ferris106b3a82016-08-24 12:15:38 -070069 __u32 fsx_extsize;
70 __u32 fsx_nextents;
71 __u32 fsx_projid;
Christopher Ferris6a9755d2017-01-13 14:09:31 -080072 __u32 fsx_cowextsize;
73 unsigned char fsx_pad[8];
Christopher Ferris106b3a82016-08-24 12:15:38 -070074};
75#define FS_XFLAG_REALTIME 0x00000001
76#define FS_XFLAG_PREALLOC 0x00000002
77#define FS_XFLAG_IMMUTABLE 0x00000008
Christopher Ferris106b3a82016-08-24 12:15:38 -070078#define FS_XFLAG_APPEND 0x00000010
79#define FS_XFLAG_SYNC 0x00000020
80#define FS_XFLAG_NOATIME 0x00000040
81#define FS_XFLAG_NODUMP 0x00000080
Christopher Ferris106b3a82016-08-24 12:15:38 -070082#define FS_XFLAG_RTINHERIT 0x00000100
83#define FS_XFLAG_PROJINHERIT 0x00000200
84#define FS_XFLAG_NOSYMLINKS 0x00000400
85#define FS_XFLAG_EXTSIZE 0x00000800
Christopher Ferris106b3a82016-08-24 12:15:38 -070086#define FS_XFLAG_EXTSZINHERIT 0x00001000
87#define FS_XFLAG_NODEFRAG 0x00002000
88#define FS_XFLAG_FILESTREAM 0x00004000
89#define FS_XFLAG_DAX 0x00008000
Christopher Ferris6a9755d2017-01-13 14:09:31 -080090#define FS_XFLAG_COWEXTSIZE 0x00010000
Christopher Ferris106b3a82016-08-24 12:15:38 -070091#define FS_XFLAG_HASATTR 0x80000000
92#define BLKROSET _IO(0x12, 93)
Christopher Ferris05d08e92016-02-04 13:16:38 -080093#define BLKROGET _IO(0x12, 94)
Tao Baod7db5942015-01-28 10:07:51 -080094#define BLKRRPART _IO(0x12, 95)
95#define BLKGETSIZE _IO(0x12, 96)
96#define BLKFLSBUF _IO(0x12, 97)
Christopher Ferris05d08e92016-02-04 13:16:38 -080097#define BLKRASET _IO(0x12, 98)
Tao Baod7db5942015-01-28 10:07:51 -080098#define BLKRAGET _IO(0x12, 99)
99#define BLKFRASET _IO(0x12, 100)
100#define BLKFRAGET _IO(0x12, 101)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800101#define BLKSECTSET _IO(0x12, 102)
Tao Baod7db5942015-01-28 10:07:51 -0800102#define BLKSECTGET _IO(0x12, 103)
103#define BLKSSZGET _IO(0x12, 104)
104#define BLKBSZGET _IOR(0x12, 112, size_t)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800105#define BLKBSZSET _IOW(0x12, 113, size_t)
Tao Baod7db5942015-01-28 10:07:51 -0800106#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
107#define BLKTRACESETUP _IOWR(0x12, 115, struct blk_user_trace_setup)
108#define BLKTRACESTART _IO(0x12, 116)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800109#define BLKTRACESTOP _IO(0x12, 117)
Tao Baod7db5942015-01-28 10:07:51 -0800110#define BLKTRACETEARDOWN _IO(0x12, 118)
111#define BLKDISCARD _IO(0x12, 119)
112#define BLKIOMIN _IO(0x12, 120)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800113#define BLKIOOPT _IO(0x12, 121)
Tao Baod7db5942015-01-28 10:07:51 -0800114#define BLKALIGNOFF _IO(0x12, 122)
115#define BLKPBSZGET _IO(0x12, 123)
116#define BLKDISCARDZEROES _IO(0x12, 124)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800117#define BLKSECDISCARD _IO(0x12, 125)
Tao Baod7db5942015-01-28 10:07:51 -0800118#define BLKROTATIONAL _IO(0x12, 126)
119#define BLKZEROOUT _IO(0x12, 127)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700120#define BLKGETDISKSEQ _IOR(0x12, 128, __u64)
Ben Cheng655a7c02013-10-16 16:09:24 -0700121#define BMAP_IOCTL 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800122#define FIBMAP _IO(0x00, 1)
Tao Baod7db5942015-01-28 10:07:51 -0800123#define FIGETBSZ _IO(0x00, 2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700124#define FIFREEZE _IOWR('X', 119, int)
125#define FITHAW _IOWR('X', 120, int)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126#define FITRIM _IOWR('X', 121, struct fstrim_range)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700127#define FICLONE _IOW(0x94, 9, int)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700128#define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
129#define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700130#define FSLABEL_MAX 256
Christopher Ferris82d75042015-01-26 10:57:07 -0800131#define FS_IOC_GETFLAGS _IOR('f', 1, long)
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define FS_IOC_SETFLAGS _IOW('f', 2, long)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700133#define FS_IOC_GETVERSION _IOR('v', 1, long)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800134#define FS_IOC_SETVERSION _IOW('v', 2, long)
Christopher Ferris82d75042015-01-26 10:57:07 -0800135#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
Ben Cheng655a7c02013-10-16 16:09:24 -0700136#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700137#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800138#define FS_IOC32_GETVERSION _IOR('v', 1, int)
Christopher Ferris82d75042015-01-26 10:57:07 -0800139#define FS_IOC32_SETVERSION _IOW('v', 2, int)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700140#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700141#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700142#define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])
143#define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX])
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#define FS_SECRM_FL 0x00000001
145#define FS_UNRM_FL 0x00000002
Christopher Ferris05d08e92016-02-04 13:16:38 -0800146#define FS_COMPR_FL 0x00000004
Christopher Ferris82d75042015-01-26 10:57:07 -0800147#define FS_SYNC_FL 0x00000008
Ben Cheng655a7c02013-10-16 16:09:24 -0700148#define FS_IMMUTABLE_FL 0x00000010
149#define FS_APPEND_FL 0x00000020
Christopher Ferris05d08e92016-02-04 13:16:38 -0800150#define FS_NODUMP_FL 0x00000040
Christopher Ferris82d75042015-01-26 10:57:07 -0800151#define FS_NOATIME_FL 0x00000080
Ben Cheng655a7c02013-10-16 16:09:24 -0700152#define FS_DIRTY_FL 0x00000100
153#define FS_COMPRBLK_FL 0x00000200
Christopher Ferris05d08e92016-02-04 13:16:38 -0800154#define FS_NOCOMP_FL 0x00000400
Christopher Ferris106b3a82016-08-24 12:15:38 -0700155#define FS_ENCRYPT_FL 0x00000800
Ben Cheng655a7c02013-10-16 16:09:24 -0700156#define FS_BTREE_FL 0x00001000
157#define FS_INDEX_FL 0x00001000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800158#define FS_IMAGIC_FL 0x00002000
Christopher Ferris82d75042015-01-26 10:57:07 -0800159#define FS_JOURNAL_DATA_FL 0x00004000
Ben Cheng655a7c02013-10-16 16:09:24 -0700160#define FS_NOTAIL_FL 0x00008000
161#define FS_DIRSYNC_FL 0x00010000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800162#define FS_TOPDIR_FL 0x00020000
Christopher Ferris106b3a82016-08-24 12:15:38 -0700163#define FS_HUGE_FILE_FL 0x00040000
Christopher Ferris82d75042015-01-26 10:57:07 -0800164#define FS_EXTENT_FL 0x00080000
Christopher Ferris9584fa42019-12-09 15:36:13 -0800165#define FS_VERITY_FL 0x00100000
Christopher Ferris106b3a82016-08-24 12:15:38 -0700166#define FS_EA_INODE_FL 0x00200000
167#define FS_EOFBLOCKS_FL 0x00400000
Ben Cheng655a7c02013-10-16 16:09:24 -0700168#define FS_NOCOW_FL 0x00800000
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700169#define FS_DAX_FL 0x02000000
Christopher Ferris106b3a82016-08-24 12:15:38 -0700170#define FS_INLINE_DATA_FL 0x10000000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171#define FS_PROJINHERIT_FL 0x20000000
Christopher Ferris9584fa42019-12-09 15:36:13 -0800172#define FS_CASEFOLD_FL 0x40000000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800173#define FS_RESERVED_FL 0x80000000
Christopher Ferris82d75042015-01-26 10:57:07 -0800174#define FS_FL_USER_VISIBLE 0x0003DFFF
Christopher Ferris106b3a82016-08-24 12:15:38 -0700175#define FS_FL_USER_MODIFIABLE 0x000380FF
Ben Cheng655a7c02013-10-16 16:09:24 -0700176#define SYNC_FILE_RANGE_WAIT_BEFORE 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700177#define SYNC_FILE_RANGE_WRITE 2
Christopher Ferris82d75042015-01-26 10:57:07 -0800178#define SYNC_FILE_RANGE_WAIT_AFTER 4
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700179#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WAIT_AFTER)
Christopher Ferris1308ad32017-11-14 17:32:13 -0800180typedef int __bitwise __kernel_rwf_t;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700181#define RWF_HIPRI (( __kernel_rwf_t) 0x00000001)
182#define RWF_DSYNC (( __kernel_rwf_t) 0x00000002)
183#define RWF_SYNC (( __kernel_rwf_t) 0x00000004)
184#define RWF_NOWAIT (( __kernel_rwf_t) 0x00000008)
185#define RWF_APPEND (( __kernel_rwf_t) 0x00000010)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700186#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT | RWF_APPEND)
Christopher Ferris0f795212024-01-17 14:17:28 -0800187#define PAGEMAP_SCAN _IOWR('f', 16, struct pm_scan_arg)
188#define PAGE_IS_WPALLOWED (1 << 0)
189#define PAGE_IS_WRITTEN (1 << 1)
190#define PAGE_IS_FILE (1 << 2)
191#define PAGE_IS_PRESENT (1 << 3)
192#define PAGE_IS_SWAPPED (1 << 4)
193#define PAGE_IS_PFNZERO (1 << 5)
194#define PAGE_IS_HUGE (1 << 6)
195struct page_region {
196 __u64 start;
197 __u64 end;
198 __u64 categories;
199};
200#define PM_SCAN_WP_MATCHING (1 << 0)
201#define PM_SCAN_CHECK_WPASYNC (1 << 1)
202struct pm_scan_arg {
203 __u64 size;
204 __u64 flags;
205 __u64 start;
206 __u64 end;
207 __u64 walk_end;
208 __u64 vec;
209 __u64 vec_len;
210 __u64 max_pages;
211 __u64 category_inverted;
212 __u64 category_mask;
213 __u64 category_anyof_mask;
214 __u64 return_mask;
215};
Ben Cheng655a7c02013-10-16 16:09:24 -0700216#endif