xref: /OK3568_Linux_fs/kernel/fs/xfs/xfs_fsmap.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0+
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 2017 Oracle.  All Rights Reserved.
4*4882a593Smuzhiyun  * Author: Darrick J. Wong <darrick.wong@oracle.com>
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun #ifndef __XFS_FSMAP_H__
7*4882a593Smuzhiyun #define __XFS_FSMAP_H__
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun struct fsmap;
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /* internal fsmap representation */
12*4882a593Smuzhiyun struct xfs_fsmap {
13*4882a593Smuzhiyun 	dev_t		fmr_device;	/* device id */
14*4882a593Smuzhiyun 	uint32_t	fmr_flags;	/* mapping flags */
15*4882a593Smuzhiyun 	uint64_t	fmr_physical;	/* device offset of segment */
16*4882a593Smuzhiyun 	uint64_t	fmr_owner;	/* owner id */
17*4882a593Smuzhiyun 	xfs_fileoff_t	fmr_offset;	/* file offset of segment */
18*4882a593Smuzhiyun 	xfs_filblks_t	fmr_length;	/* length of segment, blocks */
19*4882a593Smuzhiyun };
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun struct xfs_fsmap_head {
22*4882a593Smuzhiyun 	uint32_t	fmh_iflags;	/* control flags */
23*4882a593Smuzhiyun 	uint32_t	fmh_oflags;	/* output flags */
24*4882a593Smuzhiyun 	unsigned int	fmh_count;	/* # of entries in array incl. input */
25*4882a593Smuzhiyun 	unsigned int	fmh_entries;	/* # of entries filled in (output). */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun 	struct xfs_fsmap fmh_keys[2];	/* low and high keys */
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun void xfs_fsmap_to_internal(struct xfs_fsmap *dest, struct fsmap *src);
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun int xfs_getfsmap(struct xfs_mount *mp, struct xfs_fsmap_head *head,
33*4882a593Smuzhiyun 		struct fsmap *out_recs);
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #endif /* __XFS_FSMAP_H__ */
36