xref: /linux-6.15/include/linux/falloc.h (revision 011da44b)
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_RESVSP64		_IOW('X', 42, struct space_resv)
24 
25 #define	FALLOC_FL_SUPPORTED_MASK	(FALLOC_FL_KEEP_SIZE |		\
26 					 FALLOC_FL_PUNCH_HOLE |		\
27 					 FALLOC_FL_COLLAPSE_RANGE |	\
28 					 FALLOC_FL_ZERO_RANGE |		\
29 					 FALLOC_FL_INSERT_RANGE |	\
30 					 FALLOC_FL_UNSHARE_RANGE)
31 
32 /* on ia32 l_start is on a 32-bit boundary */
33 #if defined(CONFIG_X86_64)
34 struct space_resv_32 {
35 	__s16		l_type;
36 	__s16		l_whence;
37 	__s64		l_start	__attribute__((packed));
38 			/* len == 0 means until end of file */
39 	__s64		l_len __attribute__((packed));
40 	__s32		l_sysid;
41 	__u32		l_pid;
42 	__s32		l_pad[4];	/* reserve area */
43 };
44 
45 #define FS_IOC_RESVSP_32		_IOW ('X', 40, struct space_resv_32)
46 #define FS_IOC_RESVSP64_32	_IOW ('X', 42, struct space_resv_32)
47 
48 int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *);
49 
50 #endif
51 
52 #endif /* _FALLOC_H_ */
53