xref: /linux/fs/xfs/xfs_exchrange.h (revision 266aa3b4812e97942a8ce5c7aafa7da059f7b5b8)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (c) 2020-2024 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <djwong@kernel.org>
5  */
6 #ifndef __XFS_EXCHRANGE_H__
7 #define __XFS_EXCHRANGE_H__
8 
9 /* Update the mtime/cmtime of file1 and file2 */
10 #define __XFS_EXCHANGE_RANGE_UPD_CMTIME1	(1ULL << 63)
11 #define __XFS_EXCHANGE_RANGE_UPD_CMTIME2	(1ULL << 62)
12 
13 #define XFS_EXCHANGE_RANGE_PRIV_FLAGS	(__XFS_EXCHANGE_RANGE_UPD_CMTIME1 | \
14 					 __XFS_EXCHANGE_RANGE_UPD_CMTIME2)
15 
16 struct xfs_exchrange {
17 	struct file		*file1;
18 	struct file		*file2;
19 
20 	loff_t			file1_offset;
21 	loff_t			file2_offset;
22 	u64			length;
23 
24 	u64			flags;	/* XFS_EXCHANGE_RANGE flags */
25 };
26 
27 long xfs_ioc_exchange_range(struct file *file,
28 		struct xfs_exchange_range __user *argp);
29 
30 struct xfs_exchmaps_req;
31 
32 void xfs_exchrange_ilock(struct xfs_trans *tp, struct xfs_inode *ip1,
33 		struct xfs_inode *ip2);
34 void xfs_exchrange_iunlock(struct xfs_inode *ip1, struct xfs_inode *ip2);
35 
36 int xfs_exchrange_estimate(struct xfs_exchmaps_req *req);
37 
38 #endif /* __XFS_EXCHRANGE_H__ */
39