1*519fe1baSJosh Triplett /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*519fe1baSJosh Triplett 3*519fe1baSJosh Triplett #ifndef _UAPI_LINUX_EXT4_H 4*519fe1baSJosh Triplett #define _UAPI_LINUX_EXT4_H 5*519fe1baSJosh Triplett #include <linux/fiemap.h> 6*519fe1baSJosh Triplett #include <linux/fs.h> 7*519fe1baSJosh Triplett #include <linux/ioctl.h> 8*519fe1baSJosh Triplett #include <linux/types.h> 9*519fe1baSJosh Triplett 10*519fe1baSJosh Triplett /* 11*519fe1baSJosh Triplett * ext4-specific ioctl commands 12*519fe1baSJosh Triplett */ 13*519fe1baSJosh Triplett #define EXT4_IOC_GETVERSION _IOR('f', 3, long) 14*519fe1baSJosh Triplett #define EXT4_IOC_SETVERSION _IOW('f', 4, long) 15*519fe1baSJosh Triplett #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION 16*519fe1baSJosh Triplett #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION 17*519fe1baSJosh Triplett #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 18*519fe1baSJosh Triplett #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) 19*519fe1baSJosh Triplett #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) 20*519fe1baSJosh Triplett #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input) 21*519fe1baSJosh Triplett #define EXT4_IOC_MIGRATE _IO('f', 9) 22*519fe1baSJosh Triplett /* note ioctl 10 reserved for an early version of the FIEMAP ioctl */ 23*519fe1baSJosh Triplett /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ 24*519fe1baSJosh Triplett #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) 25*519fe1baSJosh Triplett #define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) 26*519fe1baSJosh Triplett #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) 27*519fe1baSJosh Triplett #define EXT4_IOC_SWAP_BOOT _IO('f', 17) 28*519fe1baSJosh Triplett #define EXT4_IOC_PRECACHE_EXTENTS _IO('f', 18) 29*519fe1baSJosh Triplett /* ioctl codes 19--39 are reserved for fscrypt */ 30*519fe1baSJosh Triplett #define EXT4_IOC_CLEAR_ES_CACHE _IO('f', 40) 31*519fe1baSJosh Triplett #define EXT4_IOC_GETSTATE _IOW('f', 41, __u32) 32*519fe1baSJosh Triplett #define EXT4_IOC_GET_ES_CACHE _IOWR('f', 42, struct fiemap) 33*519fe1baSJosh Triplett #define EXT4_IOC_CHECKPOINT _IOW('f', 43, __u32) 34*519fe1baSJosh Triplett #define EXT4_IOC_GETFSUUID _IOR('f', 44, struct fsuuid) 35*519fe1baSJosh Triplett #define EXT4_IOC_SETFSUUID _IOW('f', 44, struct fsuuid) 36*519fe1baSJosh Triplett 37*519fe1baSJosh Triplett #define EXT4_IOC_SHUTDOWN _IOR('X', 125, __u32) 38*519fe1baSJosh Triplett 39*519fe1baSJosh Triplett /* 40*519fe1baSJosh Triplett * ioctl commands in 32 bit emulation 41*519fe1baSJosh Triplett */ 42*519fe1baSJosh Triplett #define EXT4_IOC32_GETVERSION _IOR('f', 3, int) 43*519fe1baSJosh Triplett #define EXT4_IOC32_SETVERSION _IOW('f', 4, int) 44*519fe1baSJosh Triplett #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) 45*519fe1baSJosh Triplett #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) 46*519fe1baSJosh Triplett #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) 47*519fe1baSJosh Triplett #define EXT4_IOC32_GROUP_ADD _IOW('f', 8, struct compat_ext4_new_group_input) 48*519fe1baSJosh Triplett #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION 49*519fe1baSJosh Triplett #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION 50*519fe1baSJosh Triplett 51*519fe1baSJosh Triplett /* 52*519fe1baSJosh Triplett * Flags returned by EXT4_IOC_GETSTATE 53*519fe1baSJosh Triplett * 54*519fe1baSJosh Triplett * We only expose to userspace a subset of the state flags in 55*519fe1baSJosh Triplett * i_state_flags 56*519fe1baSJosh Triplett */ 57*519fe1baSJosh Triplett #define EXT4_STATE_FLAG_EXT_PRECACHED 0x00000001 58*519fe1baSJosh Triplett #define EXT4_STATE_FLAG_NEW 0x00000002 59*519fe1baSJosh Triplett #define EXT4_STATE_FLAG_NEWENTRY 0x00000004 60*519fe1baSJosh Triplett #define EXT4_STATE_FLAG_DA_ALLOC_CLOSE 0x00000008 61*519fe1baSJosh Triplett 62*519fe1baSJosh Triplett /* 63*519fe1baSJosh Triplett * Flags for ioctl EXT4_IOC_CHECKPOINT 64*519fe1baSJosh Triplett */ 65*519fe1baSJosh Triplett #define EXT4_IOC_CHECKPOINT_FLAG_DISCARD 0x1 66*519fe1baSJosh Triplett #define EXT4_IOC_CHECKPOINT_FLAG_ZEROOUT 0x2 67*519fe1baSJosh Triplett #define EXT4_IOC_CHECKPOINT_FLAG_DRY_RUN 0x4 68*519fe1baSJosh Triplett #define EXT4_IOC_CHECKPOINT_FLAG_VALID (EXT4_IOC_CHECKPOINT_FLAG_DISCARD | \ 69*519fe1baSJosh Triplett EXT4_IOC_CHECKPOINT_FLAG_ZEROOUT | \ 70*519fe1baSJosh Triplett EXT4_IOC_CHECKPOINT_FLAG_DRY_RUN) 71*519fe1baSJosh Triplett 72*519fe1baSJosh Triplett /* 73*519fe1baSJosh Triplett * Structure for EXT4_IOC_GETFSUUID/EXT4_IOC_SETFSUUID 74*519fe1baSJosh Triplett */ 75*519fe1baSJosh Triplett struct fsuuid { 76*519fe1baSJosh Triplett __u32 fsu_len; 77*519fe1baSJosh Triplett __u32 fsu_flags; 78*519fe1baSJosh Triplett __u8 fsu_uuid[]; 79*519fe1baSJosh Triplett }; 80*519fe1baSJosh Triplett 81*519fe1baSJosh Triplett /* 82*519fe1baSJosh Triplett * Structure for EXT4_IOC_MOVE_EXT 83*519fe1baSJosh Triplett */ 84*519fe1baSJosh Triplett struct move_extent { 85*519fe1baSJosh Triplett __u32 reserved; /* should be zero */ 86*519fe1baSJosh Triplett __u32 donor_fd; /* donor file descriptor */ 87*519fe1baSJosh Triplett __u64 orig_start; /* logical start offset in block for orig */ 88*519fe1baSJosh Triplett __u64 donor_start; /* logical start offset in block for donor */ 89*519fe1baSJosh Triplett __u64 len; /* block length to be moved */ 90*519fe1baSJosh Triplett __u64 moved_len; /* moved block length */ 91*519fe1baSJosh Triplett }; 92*519fe1baSJosh Triplett 93*519fe1baSJosh Triplett /* 94*519fe1baSJosh Triplett * Flags used by EXT4_IOC_SHUTDOWN 95*519fe1baSJosh Triplett */ 96*519fe1baSJosh Triplett #define EXT4_GOING_FLAGS_DEFAULT 0x0 /* going down */ 97*519fe1baSJosh Triplett #define EXT4_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */ 98*519fe1baSJosh Triplett #define EXT4_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */ 99*519fe1baSJosh Triplett 100*519fe1baSJosh Triplett /* Used to pass group descriptor data when online resize is done */ 101*519fe1baSJosh Triplett struct ext4_new_group_input { 102*519fe1baSJosh Triplett __u32 group; /* Group number for this data */ 103*519fe1baSJosh Triplett __u64 block_bitmap; /* Absolute block number of block bitmap */ 104*519fe1baSJosh Triplett __u64 inode_bitmap; /* Absolute block number of inode bitmap */ 105*519fe1baSJosh Triplett __u64 inode_table; /* Absolute block number of inode table start */ 106*519fe1baSJosh Triplett __u32 blocks_count; /* Total number of blocks in this group */ 107*519fe1baSJosh Triplett __u16 reserved_blocks; /* Number of reserved blocks in this group */ 108*519fe1baSJosh Triplett __u16 unused; 109*519fe1baSJosh Triplett }; 110*519fe1baSJosh Triplett 111*519fe1baSJosh Triplett /* 112*519fe1baSJosh Triplett * Returned by EXT4_IOC_GET_ES_CACHE as an additional possible flag. 113*519fe1baSJosh Triplett * It indicates that the entry in extent status cache is for a hole. 114*519fe1baSJosh Triplett */ 115*519fe1baSJosh Triplett #define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 116*519fe1baSJosh Triplett 117*519fe1baSJosh Triplett #endif /* _UAPI_LINUX_EXT4_H */ 118