| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 
|---|
| 2 | #ifndef _FALLOC_H_ | 
|---|
| 3 | #define _FALLOC_H_ | 
|---|
| 4 |  | 
|---|
| 5 | #include <uapi/linux/falloc.h> | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 | /* | 
|---|
| 9 | * Space reservation ioctls and argument structure | 
|---|
| 10 | * are designed to be compatible with the legacy XFS ioctls. | 
|---|
| 11 | */ | 
|---|
| 12 | struct space_resv { | 
|---|
| 13 | __s16		l_type; | 
|---|
| 14 | __s16		l_whence; | 
|---|
| 15 | __s64		l_start; | 
|---|
| 16 | __s64		l_len;		/* len == 0 means until end of file */ | 
|---|
| 17 | __s32		l_sysid; | 
|---|
| 18 | __u32		l_pid; | 
|---|
| 19 | __s32		l_pad[4];	/* reserved area */ | 
|---|
| 20 | }; | 
|---|
| 21 |  | 
|---|
| 22 | #define FS_IOC_RESVSP		_IOW('X', 40, struct space_resv) | 
|---|
| 23 | #define FS_IOC_UNRESVSP		_IOW('X', 41, struct space_resv) | 
|---|
| 24 | #define FS_IOC_RESVSP64		_IOW('X', 42, struct space_resv) | 
|---|
| 25 | #define FS_IOC_UNRESVSP64	_IOW('X', 43, struct space_resv) | 
|---|
| 26 | #define FS_IOC_ZERO_RANGE	_IOW('X', 57, struct space_resv) | 
|---|
| 27 |  | 
|---|
| 28 | /* | 
|---|
| 29 | * Mask of all supported fallocate modes.  Only one can be set at a time. | 
|---|
| 30 | * | 
|---|
| 31 | * In addition to the mode bit, the mode argument can also encode flags. | 
|---|
| 32 | * FALLOC_FL_KEEP_SIZE is the only supported flag so far. | 
|---|
| 33 | */ | 
|---|
| 34 | #define FALLOC_FL_MODE_MASK	(FALLOC_FL_ALLOCATE_RANGE |	\ | 
|---|
| 35 | FALLOC_FL_PUNCH_HOLE |		\ | 
|---|
| 36 | FALLOC_FL_COLLAPSE_RANGE |	\ | 
|---|
| 37 | FALLOC_FL_ZERO_RANGE |		\ | 
|---|
| 38 | FALLOC_FL_INSERT_RANGE |	\ | 
|---|
| 39 | FALLOC_FL_UNSHARE_RANGE |	\ | 
|---|
| 40 | FALLOC_FL_WRITE_ZEROES) | 
|---|
| 41 |  | 
|---|
| 42 | /* on ia32 l_start is on a 32-bit boundary */ | 
|---|
| 43 | #if defined(CONFIG_X86_64) | 
|---|
| 44 | struct space_resv_32 { | 
|---|
| 45 | __s16		l_type; | 
|---|
| 46 | __s16		l_whence; | 
|---|
| 47 | __s64		l_start	__attribute__((packed)); | 
|---|
| 48 | /* len == 0 means until end of file */ | 
|---|
| 49 | __s64		l_len __attribute__((packed)); | 
|---|
| 50 | __s32		l_sysid; | 
|---|
| 51 | __u32		l_pid; | 
|---|
| 52 | __s32		l_pad[4];	/* reserve area */ | 
|---|
| 53 | }; | 
|---|
| 54 |  | 
|---|
| 55 | #define FS_IOC_RESVSP_32	_IOW ('X', 40, struct space_resv_32) | 
|---|
| 56 | #define FS_IOC_UNRESVSP_32	_IOW ('X', 41, struct space_resv_32) | 
|---|
| 57 | #define FS_IOC_RESVSP64_32	_IOW ('X', 42, struct space_resv_32) | 
|---|
| 58 | #define FS_IOC_UNRESVSP64_32	_IOW ('X', 43, struct space_resv_32) | 
|---|
| 59 | #define FS_IOC_ZERO_RANGE_32	_IOW ('X', 57, struct space_resv_32) | 
|---|
| 60 |  | 
|---|
| 61 | #endif | 
|---|
| 62 |  | 
|---|
| 63 | #endif /* _FALLOC_H_ */ | 
|---|
| 64 |  | 
|---|