162306a36Sopenharmony_ci/* SPDX-License-Identifier: LGPL-2.1 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 1995-2005 Silicon Graphics, Inc.
462306a36Sopenharmony_ci * All Rights Reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __XFS_FS_H__
762306a36Sopenharmony_ci#define __XFS_FS_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * SGI's XFS filesystem's major stuff (constants, structures)
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/*
1462306a36Sopenharmony_ci * Direct I/O attribute record used with XFS_IOC_DIOINFO
1562306a36Sopenharmony_ci * d_miniosz is the min xfer size, xfer size multiple and file seek offset
1662306a36Sopenharmony_ci * alignment.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci#ifndef HAVE_DIOATTR
1962306a36Sopenharmony_cistruct dioattr {
2062306a36Sopenharmony_ci	__u32		d_mem;		/* data buffer memory alignment */
2162306a36Sopenharmony_ci	__u32		d_miniosz;	/* min xfer size		*/
2262306a36Sopenharmony_ci	__u32		d_maxiosz;	/* max xfer size		*/
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci#endif
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/*
2762306a36Sopenharmony_ci * Structure for XFS_IOC_GETBMAP.
2862306a36Sopenharmony_ci * On input, fill in bmv_offset and bmv_length of the first structure
2962306a36Sopenharmony_ci * to indicate the area of interest in the file, and bmv_entries with
3062306a36Sopenharmony_ci * the number of array elements given back.  The first structure is
3162306a36Sopenharmony_ci * updated on return to give the offset and length for the next call.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci#ifndef HAVE_GETBMAP
3462306a36Sopenharmony_cistruct getbmap {
3562306a36Sopenharmony_ci	__s64		bmv_offset;	/* file offset of segment in blocks */
3662306a36Sopenharmony_ci	__s64		bmv_block;	/* starting block (64-bit daddr_t)  */
3762306a36Sopenharmony_ci	__s64		bmv_length;	/* length of segment, blocks	    */
3862306a36Sopenharmony_ci	__s32		bmv_count;	/* # of entries in array incl. 1st  */
3962306a36Sopenharmony_ci	__s32		bmv_entries;	/* # of entries filled in (output)  */
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci#endif
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/*
4462306a36Sopenharmony_ci *	Structure for XFS_IOC_GETBMAPX.	 Fields bmv_offset through bmv_entries
4562306a36Sopenharmony_ci *	are used exactly as in the getbmap structure.  The getbmapx structure
4662306a36Sopenharmony_ci *	has additional bmv_iflags and bmv_oflags fields. The bmv_iflags field
4762306a36Sopenharmony_ci *	is only used for the first structure.  It contains input flags
4862306a36Sopenharmony_ci *	specifying XFS_IOC_GETBMAPX actions.  The bmv_oflags field is filled
4962306a36Sopenharmony_ci *	in by the XFS_IOC_GETBMAPX command for each returned structure after
5062306a36Sopenharmony_ci *	the first.
5162306a36Sopenharmony_ci */
5262306a36Sopenharmony_ci#ifndef HAVE_GETBMAPX
5362306a36Sopenharmony_cistruct getbmapx {
5462306a36Sopenharmony_ci	__s64		bmv_offset;	/* file offset of segment in blocks */
5562306a36Sopenharmony_ci	__s64		bmv_block;	/* starting block (64-bit daddr_t)  */
5662306a36Sopenharmony_ci	__s64		bmv_length;	/* length of segment, blocks	    */
5762306a36Sopenharmony_ci	__s32		bmv_count;	/* # of entries in array incl. 1st  */
5862306a36Sopenharmony_ci	__s32		bmv_entries;	/* # of entries filled in (output). */
5962306a36Sopenharmony_ci	__s32		bmv_iflags;	/* input flags (1st structure)	    */
6062306a36Sopenharmony_ci	__s32		bmv_oflags;	/* output flags (after 1st structure)*/
6162306a36Sopenharmony_ci	__s32		bmv_unused1;	/* future use			    */
6262306a36Sopenharmony_ci	__s32		bmv_unused2;	/* future use			    */
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci#endif
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/*	bmv_iflags values - set by XFS_IOC_GETBMAPX caller.	*/
6762306a36Sopenharmony_ci#define BMV_IF_ATTRFORK		0x1	/* return attr fork rather than data */
6862306a36Sopenharmony_ci#define BMV_IF_NO_DMAPI_READ	0x2	/* Deprecated */
6962306a36Sopenharmony_ci#define BMV_IF_PREALLOC		0x4	/* rtn status BMV_OF_PREALLOC if req */
7062306a36Sopenharmony_ci#define BMV_IF_DELALLOC		0x8	/* rtn status BMV_OF_DELALLOC if req */
7162306a36Sopenharmony_ci#define BMV_IF_NO_HOLES		0x10	/* Do not return holes */
7262306a36Sopenharmony_ci#define BMV_IF_COWFORK		0x20	/* return CoW fork rather than data */
7362306a36Sopenharmony_ci#define BMV_IF_VALID	\
7462306a36Sopenharmony_ci	(BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC|	\
7562306a36Sopenharmony_ci	 BMV_IF_DELALLOC|BMV_IF_NO_HOLES|BMV_IF_COWFORK)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*	bmv_oflags values - returned for each non-header segment */
7862306a36Sopenharmony_ci#define BMV_OF_PREALLOC		0x1	/* segment = unwritten pre-allocation */
7962306a36Sopenharmony_ci#define BMV_OF_DELALLOC		0x2	/* segment = delayed allocation */
8062306a36Sopenharmony_ci#define BMV_OF_LAST		0x4	/* segment is the last in the file */
8162306a36Sopenharmony_ci#define BMV_OF_SHARED		0x8	/* segment shared with another file */
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/*	fmr_owner special values for FS_IOC_GETFSMAP */
8462306a36Sopenharmony_ci#define XFS_FMR_OWN_FREE	FMR_OWN_FREE      /* free space */
8562306a36Sopenharmony_ci#define XFS_FMR_OWN_UNKNOWN	FMR_OWN_UNKNOWN   /* unknown owner */
8662306a36Sopenharmony_ci#define XFS_FMR_OWN_FS		FMR_OWNER('X', 1) /* static fs metadata */
8762306a36Sopenharmony_ci#define XFS_FMR_OWN_LOG		FMR_OWNER('X', 2) /* journalling log */
8862306a36Sopenharmony_ci#define XFS_FMR_OWN_AG		FMR_OWNER('X', 3) /* per-AG metadata */
8962306a36Sopenharmony_ci#define XFS_FMR_OWN_INOBT	FMR_OWNER('X', 4) /* inode btree blocks */
9062306a36Sopenharmony_ci#define XFS_FMR_OWN_INODES	FMR_OWNER('X', 5) /* inodes */
9162306a36Sopenharmony_ci#define XFS_FMR_OWN_REFC	FMR_OWNER('X', 6) /* refcount tree */
9262306a36Sopenharmony_ci#define XFS_FMR_OWN_COW		FMR_OWNER('X', 7) /* cow staging */
9362306a36Sopenharmony_ci#define XFS_FMR_OWN_DEFECTIVE	FMR_OWNER('X', 8) /* bad blocks */
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci/*
9662306a36Sopenharmony_ci * File segment locking set data type for 64 bit access.
9762306a36Sopenharmony_ci * Also used for all the RESV/FREE interfaces.
9862306a36Sopenharmony_ci */
9962306a36Sopenharmony_citypedef struct xfs_flock64 {
10062306a36Sopenharmony_ci	__s16		l_type;
10162306a36Sopenharmony_ci	__s16		l_whence;
10262306a36Sopenharmony_ci	__s64		l_start;
10362306a36Sopenharmony_ci	__s64		l_len;		/* len == 0 means until end of file */
10462306a36Sopenharmony_ci	__s32		l_sysid;
10562306a36Sopenharmony_ci	__u32		l_pid;
10662306a36Sopenharmony_ci	__s32		l_pad[4];	/* reserve area			    */
10762306a36Sopenharmony_ci} xfs_flock64_t;
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/*
11062306a36Sopenharmony_ci * Output for XFS_IOC_FSGEOMETRY_V1
11162306a36Sopenharmony_ci */
11262306a36Sopenharmony_cistruct xfs_fsop_geom_v1 {
11362306a36Sopenharmony_ci	__u32		blocksize;	/* filesystem (data) block size */
11462306a36Sopenharmony_ci	__u32		rtextsize;	/* realtime extent size		*/
11562306a36Sopenharmony_ci	__u32		agblocks;	/* fsblocks in an AG		*/
11662306a36Sopenharmony_ci	__u32		agcount;	/* number of allocation groups	*/
11762306a36Sopenharmony_ci	__u32		logblocks;	/* fsblocks in the log		*/
11862306a36Sopenharmony_ci	__u32		sectsize;	/* (data) sector size, bytes	*/
11962306a36Sopenharmony_ci	__u32		inodesize;	/* inode size in bytes		*/
12062306a36Sopenharmony_ci	__u32		imaxpct;	/* max allowed inode space(%)	*/
12162306a36Sopenharmony_ci	__u64		datablocks;	/* fsblocks in data subvolume	*/
12262306a36Sopenharmony_ci	__u64		rtblocks;	/* fsblocks in realtime subvol	*/
12362306a36Sopenharmony_ci	__u64		rtextents;	/* rt extents in realtime subvol*/
12462306a36Sopenharmony_ci	__u64		logstart;	/* starting fsblock of the log	*/
12562306a36Sopenharmony_ci	unsigned char	uuid[16];	/* unique id of the filesystem	*/
12662306a36Sopenharmony_ci	__u32		sunit;		/* stripe unit, fsblocks	*/
12762306a36Sopenharmony_ci	__u32		swidth;		/* stripe width, fsblocks	*/
12862306a36Sopenharmony_ci	__s32		version;	/* structure version		*/
12962306a36Sopenharmony_ci	__u32		flags;		/* superblock version flags	*/
13062306a36Sopenharmony_ci	__u32		logsectsize;	/* log sector size, bytes	*/
13162306a36Sopenharmony_ci	__u32		rtsectsize;	/* realtime sector size, bytes	*/
13262306a36Sopenharmony_ci	__u32		dirblocksize;	/* directory block size, bytes	*/
13362306a36Sopenharmony_ci};
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci/*
13662306a36Sopenharmony_ci * Output for XFS_IOC_FSGEOMETRY_V4
13762306a36Sopenharmony_ci */
13862306a36Sopenharmony_cistruct xfs_fsop_geom_v4 {
13962306a36Sopenharmony_ci	__u32		blocksize;	/* filesystem (data) block size */
14062306a36Sopenharmony_ci	__u32		rtextsize;	/* realtime extent size		*/
14162306a36Sopenharmony_ci	__u32		agblocks;	/* fsblocks in an AG		*/
14262306a36Sopenharmony_ci	__u32		agcount;	/* number of allocation groups	*/
14362306a36Sopenharmony_ci	__u32		logblocks;	/* fsblocks in the log		*/
14462306a36Sopenharmony_ci	__u32		sectsize;	/* (data) sector size, bytes	*/
14562306a36Sopenharmony_ci	__u32		inodesize;	/* inode size in bytes		*/
14662306a36Sopenharmony_ci	__u32		imaxpct;	/* max allowed inode space(%)	*/
14762306a36Sopenharmony_ci	__u64		datablocks;	/* fsblocks in data subvolume	*/
14862306a36Sopenharmony_ci	__u64		rtblocks;	/* fsblocks in realtime subvol	*/
14962306a36Sopenharmony_ci	__u64		rtextents;	/* rt extents in realtime subvol*/
15062306a36Sopenharmony_ci	__u64		logstart;	/* starting fsblock of the log	*/
15162306a36Sopenharmony_ci	unsigned char	uuid[16];	/* unique id of the filesystem	*/
15262306a36Sopenharmony_ci	__u32		sunit;		/* stripe unit, fsblocks	*/
15362306a36Sopenharmony_ci	__u32		swidth;		/* stripe width, fsblocks	*/
15462306a36Sopenharmony_ci	__s32		version;	/* structure version		*/
15562306a36Sopenharmony_ci	__u32		flags;		/* superblock version flags	*/
15662306a36Sopenharmony_ci	__u32		logsectsize;	/* log sector size, bytes	*/
15762306a36Sopenharmony_ci	__u32		rtsectsize;	/* realtime sector size, bytes	*/
15862306a36Sopenharmony_ci	__u32		dirblocksize;	/* directory block size, bytes	*/
15962306a36Sopenharmony_ci	__u32		logsunit;	/* log stripe unit, bytes	*/
16062306a36Sopenharmony_ci};
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci/*
16362306a36Sopenharmony_ci * Output for XFS_IOC_FSGEOMETRY
16462306a36Sopenharmony_ci */
16562306a36Sopenharmony_cistruct xfs_fsop_geom {
16662306a36Sopenharmony_ci	__u32		blocksize;	/* filesystem (data) block size */
16762306a36Sopenharmony_ci	__u32		rtextsize;	/* realtime extent size		*/
16862306a36Sopenharmony_ci	__u32		agblocks;	/* fsblocks in an AG		*/
16962306a36Sopenharmony_ci	__u32		agcount;	/* number of allocation groups	*/
17062306a36Sopenharmony_ci	__u32		logblocks;	/* fsblocks in the log		*/
17162306a36Sopenharmony_ci	__u32		sectsize;	/* (data) sector size, bytes	*/
17262306a36Sopenharmony_ci	__u32		inodesize;	/* inode size in bytes		*/
17362306a36Sopenharmony_ci	__u32		imaxpct;	/* max allowed inode space(%)	*/
17462306a36Sopenharmony_ci	__u64		datablocks;	/* fsblocks in data subvolume	*/
17562306a36Sopenharmony_ci	__u64		rtblocks;	/* fsblocks in realtime subvol	*/
17662306a36Sopenharmony_ci	__u64		rtextents;	/* rt extents in realtime subvol*/
17762306a36Sopenharmony_ci	__u64		logstart;	/* starting fsblock of the log	*/
17862306a36Sopenharmony_ci	unsigned char	uuid[16];	/* unique id of the filesystem	*/
17962306a36Sopenharmony_ci	__u32		sunit;		/* stripe unit, fsblocks	*/
18062306a36Sopenharmony_ci	__u32		swidth;		/* stripe width, fsblocks	*/
18162306a36Sopenharmony_ci	__s32		version;	/* structure version		*/
18262306a36Sopenharmony_ci	__u32		flags;		/* superblock version flags	*/
18362306a36Sopenharmony_ci	__u32		logsectsize;	/* log sector size, bytes	*/
18462306a36Sopenharmony_ci	__u32		rtsectsize;	/* realtime sector size, bytes	*/
18562306a36Sopenharmony_ci	__u32		dirblocksize;	/* directory block size, bytes	*/
18662306a36Sopenharmony_ci	__u32		logsunit;	/* log stripe unit, bytes	*/
18762306a36Sopenharmony_ci	uint32_t	sick;		/* o: unhealthy fs & rt metadata */
18862306a36Sopenharmony_ci	uint32_t	checked;	/* o: checked fs & rt metadata	*/
18962306a36Sopenharmony_ci	__u64		reserved[17];	/* reserved space		*/
19062306a36Sopenharmony_ci};
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_COUNTERS	(1 << 0)  /* summary counters */
19362306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_UQUOTA	(1 << 1)  /* user quota */
19462306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_GQUOTA	(1 << 2)  /* group quota */
19562306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_PQUOTA	(1 << 3)  /* project quota */
19662306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_RT_BITMAP	(1 << 4)  /* realtime bitmap */
19762306a36Sopenharmony_ci#define XFS_FSOP_GEOM_SICK_RT_SUMMARY	(1 << 5)  /* realtime summary */
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci/* Output for XFS_FS_COUNTS */
20062306a36Sopenharmony_citypedef struct xfs_fsop_counts {
20162306a36Sopenharmony_ci	__u64	freedata;	/* free data section blocks */
20262306a36Sopenharmony_ci	__u64	freertx;	/* free rt extents */
20362306a36Sopenharmony_ci	__u64	freeino;	/* free inodes */
20462306a36Sopenharmony_ci	__u64	allocino;	/* total allocated inodes */
20562306a36Sopenharmony_ci} xfs_fsop_counts_t;
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci/* Input/Output for XFS_GET_RESBLKS and XFS_SET_RESBLKS */
20862306a36Sopenharmony_citypedef struct xfs_fsop_resblks {
20962306a36Sopenharmony_ci	__u64  resblks;
21062306a36Sopenharmony_ci	__u64  resblks_avail;
21162306a36Sopenharmony_ci} xfs_fsop_resblks_t;
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci#define XFS_FSOP_GEOM_VERSION		0
21462306a36Sopenharmony_ci#define XFS_FSOP_GEOM_VERSION_V5	5
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_ATTR	(1 << 0)  /* attributes in use	   */
21762306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_NLINK	(1 << 1)  /* 32-bit nlink values   */
21862306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_QUOTA	(1 << 2)  /* quotas enabled	   */
21962306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_IALIGN	(1 << 3)  /* inode alignment	   */
22062306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_DALIGN	(1 << 4)  /* large data alignment  */
22162306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_SHARED	(1 << 5)  /* read-only shared	   */
22262306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_EXTFLG	(1 << 6)  /* special extent flag   */
22362306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_DIRV2	(1 << 7)  /* directory version 2   */
22462306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_LOGV2	(1 << 8)  /* log format version 2  */
22562306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_SECTOR	(1 << 9)  /* sector sizes >1BB	   */
22662306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_ATTR2	(1 << 10) /* inline attributes rework */
22762306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_PROJID32	(1 << 11) /* 32-bit project IDs	   */
22862306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_DIRV2CI	(1 << 12) /* ASCII only CI names   */
22962306a36Sopenharmony_ci	/*  -- Do not use --		(1 << 13)    SGI parent pointers   */
23062306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_LAZYSB	(1 << 14) /* lazy superblock counters */
23162306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_V5SB	(1 << 15) /* version 5 superblock  */
23262306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_FTYPE	(1 << 16) /* inode directory types */
23362306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_FINOBT	(1 << 17) /* free inode btree	   */
23462306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_SPINODES	(1 << 18) /* sparse inode chunks   */
23562306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_RMAPBT	(1 << 19) /* reverse mapping btree */
23662306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_REFLINK	(1 << 20) /* files can share blocks */
23762306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_BIGTIME	(1 << 21) /* 64-bit nsec timestamps */
23862306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_INOBTCNT	(1 << 22) /* inobt btree counter */
23962306a36Sopenharmony_ci#define XFS_FSOP_GEOM_FLAGS_NREXT64	(1 << 23) /* large extent counters */
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci/*
24262306a36Sopenharmony_ci * Minimum and maximum sizes need for growth checks.
24362306a36Sopenharmony_ci *
24462306a36Sopenharmony_ci * Block counts are in units of filesystem blocks, not basic blocks.
24562306a36Sopenharmony_ci */
24662306a36Sopenharmony_ci#define XFS_MIN_AG_BLOCKS	64
24762306a36Sopenharmony_ci#define XFS_MIN_LOG_BLOCKS	512ULL
24862306a36Sopenharmony_ci#define XFS_MAX_LOG_BLOCKS	(1024 * 1024ULL)
24962306a36Sopenharmony_ci#define XFS_MIN_LOG_BYTES	(10 * 1024 * 1024ULL)
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci/*
25262306a36Sopenharmony_ci * Limits on sb_agblocks/sb_agblklog -- mkfs won't format AGs smaller than
25362306a36Sopenharmony_ci * 16MB or larger than 1TB.
25462306a36Sopenharmony_ci */
25562306a36Sopenharmony_ci#define XFS_MIN_AG_BYTES	(1ULL << 24)	/* 16 MB */
25662306a36Sopenharmony_ci#define XFS_MAX_AG_BYTES	(1ULL << 40)	/* 1 TB */
25762306a36Sopenharmony_ci#define XFS_MAX_AG_BLOCKS	(XFS_MAX_AG_BYTES / XFS_MIN_BLOCKSIZE)
25862306a36Sopenharmony_ci#define XFS_MAX_CRC_AG_BLOCKS	(XFS_MAX_AG_BYTES / XFS_MIN_CRC_BLOCKSIZE)
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci#define XFS_MAX_AGNUMBER	((xfs_agnumber_t)(NULLAGNUMBER - 1))
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci/* keep the maximum size under 2^31 by a small amount */
26362306a36Sopenharmony_ci#define XFS_MAX_LOG_BYTES \
26462306a36Sopenharmony_ci	((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES)
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci/* Used for sanity checks on superblock */
26762306a36Sopenharmony_ci#define XFS_MAX_DBLOCKS(s) ((xfs_rfsblock_t)(s)->sb_agcount * (s)->sb_agblocks)
26862306a36Sopenharmony_ci#define XFS_MIN_DBLOCKS(s) ((xfs_rfsblock_t)((s)->sb_agcount - 1) *	\
26962306a36Sopenharmony_ci			 (s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci/*
27262306a36Sopenharmony_ci * Output for XFS_IOC_AG_GEOMETRY
27362306a36Sopenharmony_ci */
27462306a36Sopenharmony_cistruct xfs_ag_geometry {
27562306a36Sopenharmony_ci	uint32_t	ag_number;	/* i/o: AG number */
27662306a36Sopenharmony_ci	uint32_t	ag_length;	/* o: length in blocks */
27762306a36Sopenharmony_ci	uint32_t	ag_freeblks;	/* o: free space */
27862306a36Sopenharmony_ci	uint32_t	ag_icount;	/* o: inodes allocated */
27962306a36Sopenharmony_ci	uint32_t	ag_ifree;	/* o: inodes free */
28062306a36Sopenharmony_ci	uint32_t	ag_sick;	/* o: sick things in ag */
28162306a36Sopenharmony_ci	uint32_t	ag_checked;	/* o: checked metadata in ag */
28262306a36Sopenharmony_ci	uint32_t	ag_flags;	/* i/o: flags for this ag */
28362306a36Sopenharmony_ci	uint64_t	ag_reserved[12];/* o: zero */
28462306a36Sopenharmony_ci};
28562306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_SB	(1 << 0)  /* superblock */
28662306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_AGF	(1 << 1)  /* AGF header */
28762306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_AGFL	(1 << 2)  /* AGFL header */
28862306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_AGI	(1 << 3)  /* AGI header */
28962306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_BNOBT	(1 << 4)  /* free space by block */
29062306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_CNTBT	(1 << 5)  /* free space by length */
29162306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_INOBT	(1 << 6)  /* inode index */
29262306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_FINOBT	(1 << 7)  /* free inode index */
29362306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_RMAPBT	(1 << 8)  /* reverse mappings */
29462306a36Sopenharmony_ci#define XFS_AG_GEOM_SICK_REFCNTBT (1 << 9)  /* reference counts */
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci/*
29762306a36Sopenharmony_ci * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT
29862306a36Sopenharmony_ci */
29962306a36Sopenharmony_citypedef struct xfs_growfs_data {
30062306a36Sopenharmony_ci	__u64		newblocks;	/* new data subvol size, fsblocks */
30162306a36Sopenharmony_ci	__u32		imaxpct;	/* new inode space percentage limit */
30262306a36Sopenharmony_ci} xfs_growfs_data_t;
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_citypedef struct xfs_growfs_log {
30562306a36Sopenharmony_ci	__u32		newblocks;	/* new log size, fsblocks */
30662306a36Sopenharmony_ci	__u32		isint;		/* 1 if new log is internal */
30762306a36Sopenharmony_ci} xfs_growfs_log_t;
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_citypedef struct xfs_growfs_rt {
31062306a36Sopenharmony_ci	__u64		newblocks;	/* new realtime size, fsblocks */
31162306a36Sopenharmony_ci	__u32		extsize;	/* new realtime extent size, fsblocks */
31262306a36Sopenharmony_ci} xfs_growfs_rt_t;
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci/*
31662306a36Sopenharmony_ci * Structures returned from ioctl XFS_IOC_FSBULKSTAT & XFS_IOC_FSBULKSTAT_SINGLE
31762306a36Sopenharmony_ci */
31862306a36Sopenharmony_citypedef struct xfs_bstime {
31962306a36Sopenharmony_ci	__kernel_long_t tv_sec;		/* seconds		*/
32062306a36Sopenharmony_ci	__s32		tv_nsec;	/* and nanoseconds	*/
32162306a36Sopenharmony_ci} xfs_bstime_t;
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_cistruct xfs_bstat {
32462306a36Sopenharmony_ci	__u64		bs_ino;		/* inode number			*/
32562306a36Sopenharmony_ci	__u16		bs_mode;	/* type and mode		*/
32662306a36Sopenharmony_ci	__u16		bs_nlink;	/* number of links		*/
32762306a36Sopenharmony_ci	__u32		bs_uid;		/* user id			*/
32862306a36Sopenharmony_ci	__u32		bs_gid;		/* group id			*/
32962306a36Sopenharmony_ci	__u32		bs_rdev;	/* device value			*/
33062306a36Sopenharmony_ci	__s32		bs_blksize;	/* block size			*/
33162306a36Sopenharmony_ci	__s64		bs_size;	/* file size			*/
33262306a36Sopenharmony_ci	xfs_bstime_t	bs_atime;	/* access time			*/
33362306a36Sopenharmony_ci	xfs_bstime_t	bs_mtime;	/* modify time			*/
33462306a36Sopenharmony_ci	xfs_bstime_t	bs_ctime;	/* inode change time		*/
33562306a36Sopenharmony_ci	int64_t		bs_blocks;	/* number of blocks		*/
33662306a36Sopenharmony_ci	__u32		bs_xflags;	/* extended flags		*/
33762306a36Sopenharmony_ci	__s32		bs_extsize;	/* extent size			*/
33862306a36Sopenharmony_ci	__s32		bs_extents;	/* number of extents		*/
33962306a36Sopenharmony_ci	__u32		bs_gen;		/* generation count		*/
34062306a36Sopenharmony_ci	__u16		bs_projid_lo;	/* lower part of project id	*/
34162306a36Sopenharmony_ci#define	bs_projid	bs_projid_lo	/* (previously just bs_projid)	*/
34262306a36Sopenharmony_ci	__u16		bs_forkoff;	/* inode fork offset in bytes	*/
34362306a36Sopenharmony_ci	__u16		bs_projid_hi;	/* higher part of project id	*/
34462306a36Sopenharmony_ci	uint16_t	bs_sick;	/* sick inode metadata		*/
34562306a36Sopenharmony_ci	uint16_t	bs_checked;	/* checked inode metadata	*/
34662306a36Sopenharmony_ci	unsigned char	bs_pad[2];	/* pad space, unused		*/
34762306a36Sopenharmony_ci	__u32		bs_cowextsize;	/* cow extent size		*/
34862306a36Sopenharmony_ci	__u32		bs_dmevmask;	/* DMIG event mask		*/
34962306a36Sopenharmony_ci	__u16		bs_dmstate;	/* DMIG state info		*/
35062306a36Sopenharmony_ci	__u16		bs_aextents;	/* attribute number of extents	*/
35162306a36Sopenharmony_ci};
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci/* New bulkstat structure that reports v5 features and fixes padding issues */
35462306a36Sopenharmony_cistruct xfs_bulkstat {
35562306a36Sopenharmony_ci	uint64_t	bs_ino;		/* inode number			*/
35662306a36Sopenharmony_ci	uint64_t	bs_size;	/* file size			*/
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci	uint64_t	bs_blocks;	/* number of blocks		*/
35962306a36Sopenharmony_ci	uint64_t	bs_xflags;	/* extended flags		*/
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci	int64_t		bs_atime;	/* access time, seconds		*/
36262306a36Sopenharmony_ci	int64_t		bs_mtime;	/* modify time, seconds		*/
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci	int64_t		bs_ctime;	/* inode change time, seconds	*/
36562306a36Sopenharmony_ci	int64_t		bs_btime;	/* creation time, seconds	*/
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci	uint32_t	bs_gen;		/* generation count		*/
36862306a36Sopenharmony_ci	uint32_t	bs_uid;		/* user id			*/
36962306a36Sopenharmony_ci	uint32_t	bs_gid;		/* group id			*/
37062306a36Sopenharmony_ci	uint32_t	bs_projectid;	/* project id			*/
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci	uint32_t	bs_atime_nsec;	/* access time, nanoseconds	*/
37362306a36Sopenharmony_ci	uint32_t	bs_mtime_nsec;	/* modify time, nanoseconds	*/
37462306a36Sopenharmony_ci	uint32_t	bs_ctime_nsec;	/* inode change time, nanoseconds */
37562306a36Sopenharmony_ci	uint32_t	bs_btime_nsec;	/* creation time, nanoseconds	*/
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci	uint32_t	bs_blksize;	/* block size			*/
37862306a36Sopenharmony_ci	uint32_t	bs_rdev;	/* device value			*/
37962306a36Sopenharmony_ci	uint32_t	bs_cowextsize_blks; /* cow extent size hint, blocks */
38062306a36Sopenharmony_ci	uint32_t	bs_extsize_blks; /* extent size hint, blocks	*/
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci	uint32_t	bs_nlink;	/* number of links		*/
38362306a36Sopenharmony_ci	uint32_t	bs_extents;	/* 32-bit data fork extent counter */
38462306a36Sopenharmony_ci	uint32_t	bs_aextents;	/* attribute number of extents	*/
38562306a36Sopenharmony_ci	uint16_t	bs_version;	/* structure version		*/
38662306a36Sopenharmony_ci	uint16_t	bs_forkoff;	/* inode fork offset in bytes	*/
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci	uint16_t	bs_sick;	/* sick inode metadata		*/
38962306a36Sopenharmony_ci	uint16_t	bs_checked;	/* checked inode metadata	*/
39062306a36Sopenharmony_ci	uint16_t	bs_mode;	/* type and mode		*/
39162306a36Sopenharmony_ci	uint16_t	bs_pad2;	/* zeroed			*/
39262306a36Sopenharmony_ci	uint64_t	bs_extents64;	/* 64-bit data fork extent counter */
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci	uint64_t	bs_pad[6];	/* zeroed			*/
39562306a36Sopenharmony_ci};
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci#define XFS_BULKSTAT_VERSION_V1	(1)
39862306a36Sopenharmony_ci#define XFS_BULKSTAT_VERSION_V5	(5)
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci/* bs_sick flags */
40162306a36Sopenharmony_ci#define XFS_BS_SICK_INODE	(1 << 0)  /* inode core */
40262306a36Sopenharmony_ci#define XFS_BS_SICK_BMBTD	(1 << 1)  /* data fork */
40362306a36Sopenharmony_ci#define XFS_BS_SICK_BMBTA	(1 << 2)  /* attr fork */
40462306a36Sopenharmony_ci#define XFS_BS_SICK_BMBTC	(1 << 3)  /* cow fork */
40562306a36Sopenharmony_ci#define XFS_BS_SICK_DIR		(1 << 4)  /* directory */
40662306a36Sopenharmony_ci#define XFS_BS_SICK_XATTR	(1 << 5)  /* extended attributes */
40762306a36Sopenharmony_ci#define XFS_BS_SICK_SYMLINK	(1 << 6)  /* symbolic link remote target */
40862306a36Sopenharmony_ci#define XFS_BS_SICK_PARENT	(1 << 7)  /* parent pointers */
40962306a36Sopenharmony_ci
41062306a36Sopenharmony_ci/*
41162306a36Sopenharmony_ci * Project quota id helpers (previously projid was 16bit only
41262306a36Sopenharmony_ci * and using two 16bit values to hold new 32bit projid was chosen
41362306a36Sopenharmony_ci * to retain compatibility with "old" filesystems).
41462306a36Sopenharmony_ci */
41562306a36Sopenharmony_cistatic inline uint32_t
41662306a36Sopenharmony_cibstat_get_projid(const struct xfs_bstat *bs)
41762306a36Sopenharmony_ci{
41862306a36Sopenharmony_ci	return (uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
41962306a36Sopenharmony_ci}
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/*
42262306a36Sopenharmony_ci * The user-level BulkStat Request interface structure.
42362306a36Sopenharmony_ci */
42462306a36Sopenharmony_cistruct xfs_fsop_bulkreq {
42562306a36Sopenharmony_ci	__u64		__user *lastip;	/* last inode # pointer		*/
42662306a36Sopenharmony_ci	__s32		icount;		/* count of entries in buffer	*/
42762306a36Sopenharmony_ci	void		__user *ubuffer;/* user buffer for inode desc.	*/
42862306a36Sopenharmony_ci	__s32		__user *ocount;	/* output count pointer		*/
42962306a36Sopenharmony_ci};
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ci/*
43262306a36Sopenharmony_ci * Structures returned from xfs_inumbers routine (XFS_IOC_FSINUMBERS).
43362306a36Sopenharmony_ci */
43462306a36Sopenharmony_cistruct xfs_inogrp {
43562306a36Sopenharmony_ci	__u64		xi_startino;	/* starting inode number	*/
43662306a36Sopenharmony_ci	__s32		xi_alloccount;	/* # bits set in allocmask	*/
43762306a36Sopenharmony_ci	__u64		xi_allocmask;	/* mask of allocated inodes	*/
43862306a36Sopenharmony_ci};
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci/* New inumbers structure that reports v5 features and fixes padding issues */
44162306a36Sopenharmony_cistruct xfs_inumbers {
44262306a36Sopenharmony_ci	uint64_t	xi_startino;	/* starting inode number	*/
44362306a36Sopenharmony_ci	uint64_t	xi_allocmask;	/* mask of allocated inodes	*/
44462306a36Sopenharmony_ci	uint8_t		xi_alloccount;	/* # bits set in allocmask	*/
44562306a36Sopenharmony_ci	uint8_t		xi_version;	/* version			*/
44662306a36Sopenharmony_ci	uint8_t		xi_padding[6];	/* zero				*/
44762306a36Sopenharmony_ci};
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci#define XFS_INUMBERS_VERSION_V1	(1)
45062306a36Sopenharmony_ci#define XFS_INUMBERS_VERSION_V5	(5)
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ci/* Header for bulk inode requests. */
45362306a36Sopenharmony_cistruct xfs_bulk_ireq {
45462306a36Sopenharmony_ci	uint64_t	ino;		/* I/O: start with this inode	*/
45562306a36Sopenharmony_ci	uint32_t	flags;		/* I/O: operation flags		*/
45662306a36Sopenharmony_ci	uint32_t	icount;		/* I: count of entries in buffer */
45762306a36Sopenharmony_ci	uint32_t	ocount;		/* O: count of entries filled out */
45862306a36Sopenharmony_ci	uint32_t	agno;		/* I: see comment for IREQ_AGNO	*/
45962306a36Sopenharmony_ci	uint64_t	reserved[5];	/* must be zero			*/
46062306a36Sopenharmony_ci};
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci/*
46362306a36Sopenharmony_ci * Only return results from the specified @agno.  If @ino is zero, start
46462306a36Sopenharmony_ci * with the first inode of @agno.
46562306a36Sopenharmony_ci */
46662306a36Sopenharmony_ci#define XFS_BULK_IREQ_AGNO	(1U << 0)
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci/*
46962306a36Sopenharmony_ci * Return bulkstat information for a single inode, where @ino value is a
47062306a36Sopenharmony_ci * special value, not a literal inode number.  See the XFS_BULK_IREQ_SPECIAL_*
47162306a36Sopenharmony_ci * values below.  Not compatible with XFS_BULK_IREQ_AGNO.
47262306a36Sopenharmony_ci */
47362306a36Sopenharmony_ci#define XFS_BULK_IREQ_SPECIAL	(1U << 1)
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci/*
47662306a36Sopenharmony_ci * Return data fork extent count via xfs_bulkstat->bs_extents64 field and assign
47762306a36Sopenharmony_ci * 0 to xfs_bulkstat->bs_extents when the flag is set.  Otherwise, use
47862306a36Sopenharmony_ci * xfs_bulkstat->bs_extents for returning data fork extent count and set
47962306a36Sopenharmony_ci * xfs_bulkstat->bs_extents64 to 0. In the second case, return -EOVERFLOW and
48062306a36Sopenharmony_ci * assign 0 to xfs_bulkstat->bs_extents if data fork extent count is larger than
48162306a36Sopenharmony_ci * XFS_MAX_EXTCNT_DATA_FORK_OLD.
48262306a36Sopenharmony_ci */
48362306a36Sopenharmony_ci#define XFS_BULK_IREQ_NREXT64	(1U << 2)
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci#define XFS_BULK_IREQ_FLAGS_ALL	(XFS_BULK_IREQ_AGNO |	 \
48662306a36Sopenharmony_ci				 XFS_BULK_IREQ_SPECIAL | \
48762306a36Sopenharmony_ci				 XFS_BULK_IREQ_NREXT64)
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci/* Operate on the root directory inode. */
49062306a36Sopenharmony_ci#define XFS_BULK_IREQ_SPECIAL_ROOT	(1)
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci/*
49362306a36Sopenharmony_ci * ioctl structures for v5 bulkstat and inumbers requests
49462306a36Sopenharmony_ci */
49562306a36Sopenharmony_cistruct xfs_bulkstat_req {
49662306a36Sopenharmony_ci	struct xfs_bulk_ireq	hdr;
49762306a36Sopenharmony_ci	struct xfs_bulkstat	bulkstat[];
49862306a36Sopenharmony_ci};
49962306a36Sopenharmony_ci#define XFS_BULKSTAT_REQ_SIZE(nr)	(sizeof(struct xfs_bulkstat_req) + \
50062306a36Sopenharmony_ci					 (nr) * sizeof(struct xfs_bulkstat))
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_cistruct xfs_inumbers_req {
50362306a36Sopenharmony_ci	struct xfs_bulk_ireq	hdr;
50462306a36Sopenharmony_ci	struct xfs_inumbers	inumbers[];
50562306a36Sopenharmony_ci};
50662306a36Sopenharmony_ci#define XFS_INUMBERS_REQ_SIZE(nr)	(sizeof(struct xfs_inumbers_req) + \
50762306a36Sopenharmony_ci					 (nr) * sizeof(struct xfs_inumbers))
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci/*
51062306a36Sopenharmony_ci * Error injection.
51162306a36Sopenharmony_ci */
51262306a36Sopenharmony_citypedef struct xfs_error_injection {
51362306a36Sopenharmony_ci	__s32		fd;
51462306a36Sopenharmony_ci	__s32		errtag;
51562306a36Sopenharmony_ci} xfs_error_injection_t;
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci/*
51962306a36Sopenharmony_ci * Speculative preallocation trimming.
52062306a36Sopenharmony_ci */
52162306a36Sopenharmony_ci#define XFS_EOFBLOCKS_VERSION		1
52262306a36Sopenharmony_cistruct xfs_fs_eofblocks {
52362306a36Sopenharmony_ci	__u32		eof_version;
52462306a36Sopenharmony_ci	__u32		eof_flags;
52562306a36Sopenharmony_ci	uid_t		eof_uid;
52662306a36Sopenharmony_ci	gid_t		eof_gid;
52762306a36Sopenharmony_ci	prid_t		eof_prid;
52862306a36Sopenharmony_ci	__u32		pad32;
52962306a36Sopenharmony_ci	__u64		eof_min_file_size;
53062306a36Sopenharmony_ci	__u64		pad64[12];
53162306a36Sopenharmony_ci};
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ci/* eof_flags values */
53462306a36Sopenharmony_ci#define XFS_EOF_FLAGS_SYNC		(1 << 0) /* sync/wait mode scan */
53562306a36Sopenharmony_ci#define XFS_EOF_FLAGS_UID		(1 << 1) /* filter by uid */
53662306a36Sopenharmony_ci#define XFS_EOF_FLAGS_GID		(1 << 2) /* filter by gid */
53762306a36Sopenharmony_ci#define XFS_EOF_FLAGS_PRID		(1 << 3) /* filter by project id */
53862306a36Sopenharmony_ci#define XFS_EOF_FLAGS_MINFILESIZE	(1 << 4) /* filter by min file size */
53962306a36Sopenharmony_ci#define XFS_EOF_FLAGS_UNION		(1 << 5) /* union filter algorithm;
54062306a36Sopenharmony_ci						  * kernel only, not included in
54162306a36Sopenharmony_ci						  * valid mask */
54262306a36Sopenharmony_ci#define XFS_EOF_FLAGS_VALID	\
54362306a36Sopenharmony_ci	(XFS_EOF_FLAGS_SYNC |	\
54462306a36Sopenharmony_ci	 XFS_EOF_FLAGS_UID |	\
54562306a36Sopenharmony_ci	 XFS_EOF_FLAGS_GID |	\
54662306a36Sopenharmony_ci	 XFS_EOF_FLAGS_PRID |	\
54762306a36Sopenharmony_ci	 XFS_EOF_FLAGS_MINFILESIZE)
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci/*
55162306a36Sopenharmony_ci * The user-level Handle Request interface structure.
55262306a36Sopenharmony_ci */
55362306a36Sopenharmony_citypedef struct xfs_fsop_handlereq {
55462306a36Sopenharmony_ci	__u32		fd;		/* fd for FD_TO_HANDLE		*/
55562306a36Sopenharmony_ci	void		__user *path;	/* user pathname		*/
55662306a36Sopenharmony_ci	__u32		oflags;		/* open flags			*/
55762306a36Sopenharmony_ci	void		__user *ihandle;/* user supplied handle		*/
55862306a36Sopenharmony_ci	__u32		ihandlen;	/* user supplied length		*/
55962306a36Sopenharmony_ci	void		__user *ohandle;/* user buffer for handle	*/
56062306a36Sopenharmony_ci	__u32		__user *ohandlen;/* user buffer length		*/
56162306a36Sopenharmony_ci} xfs_fsop_handlereq_t;
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci/*
56462306a36Sopenharmony_ci * Compound structures for passing args through Handle Request interfaces
56562306a36Sopenharmony_ci * xfs_attrlist_by_handle, xfs_attrmulti_by_handle
56662306a36Sopenharmony_ci * - ioctls: XFS_IOC_ATTRLIST_BY_HANDLE, and XFS_IOC_ATTRMULTI_BY_HANDLE
56762306a36Sopenharmony_ci */
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ci/*
57062306a36Sopenharmony_ci * Flags passed in xfs_attr_multiop.am_flags for the attr ioctl interface.
57162306a36Sopenharmony_ci *
57262306a36Sopenharmony_ci * NOTE: Must match the values declared in libattr without the XFS_IOC_ prefix.
57362306a36Sopenharmony_ci */
57462306a36Sopenharmony_ci#define XFS_IOC_ATTR_ROOT	0x0002	/* use attrs in root namespace */
57562306a36Sopenharmony_ci#define XFS_IOC_ATTR_SECURE	0x0008	/* use attrs in security namespace */
57662306a36Sopenharmony_ci#define XFS_IOC_ATTR_CREATE	0x0010	/* fail if attr already exists */
57762306a36Sopenharmony_ci#define XFS_IOC_ATTR_REPLACE	0x0020	/* fail if attr does not exist */
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_citypedef struct xfs_attrlist_cursor {
58062306a36Sopenharmony_ci	__u32		opaque[4];
58162306a36Sopenharmony_ci} xfs_attrlist_cursor_t;
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci/*
58462306a36Sopenharmony_ci * Define how lists of attribute names are returned to userspace from the
58562306a36Sopenharmony_ci * XFS_IOC_ATTRLIST_BY_HANDLE ioctl.  struct xfs_attrlist is the header at the
58662306a36Sopenharmony_ci * beginning of the returned buffer, and a each entry in al_offset contains the
58762306a36Sopenharmony_ci * relative offset of an xfs_attrlist_ent containing the actual entry.
58862306a36Sopenharmony_ci *
58962306a36Sopenharmony_ci * NOTE: struct xfs_attrlist must match struct attrlist defined in libattr, and
59062306a36Sopenharmony_ci * struct xfs_attrlist_ent must match struct attrlist_ent defined in libattr.
59162306a36Sopenharmony_ci */
59262306a36Sopenharmony_cistruct xfs_attrlist {
59362306a36Sopenharmony_ci	__s32	al_count;	/* number of entries in attrlist */
59462306a36Sopenharmony_ci	__s32	al_more;	/* T/F: more attrs (do call again) */
59562306a36Sopenharmony_ci	__s32	al_offset[];	/* byte offsets of attrs [var-sized] */
59662306a36Sopenharmony_ci};
59762306a36Sopenharmony_ci
59862306a36Sopenharmony_cistruct xfs_attrlist_ent {	/* data from attr_list() */
59962306a36Sopenharmony_ci	__u32	a_valuelen;	/* number bytes in value of attr */
60062306a36Sopenharmony_ci	char	a_name[];	/* attr name (NULL terminated) */
60162306a36Sopenharmony_ci};
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_citypedef struct xfs_fsop_attrlist_handlereq {
60462306a36Sopenharmony_ci	struct xfs_fsop_handlereq	hreq; /* handle interface structure */
60562306a36Sopenharmony_ci	struct xfs_attrlist_cursor	pos; /* opaque cookie, list offset */
60662306a36Sopenharmony_ci	__u32				flags;	/* which namespace to use */
60762306a36Sopenharmony_ci	__u32				buflen;	/* length of buffer supplied */
60862306a36Sopenharmony_ci	void				__user *buffer;	/* returned names */
60962306a36Sopenharmony_ci} xfs_fsop_attrlist_handlereq_t;
61062306a36Sopenharmony_ci
61162306a36Sopenharmony_citypedef struct xfs_attr_multiop {
61262306a36Sopenharmony_ci	__u32		am_opcode;
61362306a36Sopenharmony_ci#define ATTR_OP_GET	1	/* return the indicated attr's value */
61462306a36Sopenharmony_ci#define ATTR_OP_SET	2	/* set/create the indicated attr/value pair */
61562306a36Sopenharmony_ci#define ATTR_OP_REMOVE	3	/* remove the indicated attr */
61662306a36Sopenharmony_ci	__s32		am_error;
61762306a36Sopenharmony_ci	void		__user *am_attrname;
61862306a36Sopenharmony_ci	void		__user *am_attrvalue;
61962306a36Sopenharmony_ci	__u32		am_length;
62062306a36Sopenharmony_ci	__u32		am_flags; /* XFS_IOC_ATTR_* */
62162306a36Sopenharmony_ci} xfs_attr_multiop_t;
62262306a36Sopenharmony_ci
62362306a36Sopenharmony_citypedef struct xfs_fsop_attrmulti_handlereq {
62462306a36Sopenharmony_ci	struct xfs_fsop_handlereq	hreq; /* handle interface structure */
62562306a36Sopenharmony_ci	__u32				opcount;/* count of following multiop */
62662306a36Sopenharmony_ci	struct xfs_attr_multiop		__user *ops; /* attr_multi data */
62762306a36Sopenharmony_ci} xfs_fsop_attrmulti_handlereq_t;
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci/*
63062306a36Sopenharmony_ci * per machine unique filesystem identifier types.
63162306a36Sopenharmony_ci */
63262306a36Sopenharmony_citypedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_citypedef struct xfs_fid {
63562306a36Sopenharmony_ci	__u16	fid_len;		/* length of remainder	*/
63662306a36Sopenharmony_ci	__u16	fid_pad;
63762306a36Sopenharmony_ci	__u32	fid_gen;		/* generation number	*/
63862306a36Sopenharmony_ci	__u64	fid_ino;		/* 64 bits inode number */
63962306a36Sopenharmony_ci} xfs_fid_t;
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_citypedef struct xfs_handle {
64262306a36Sopenharmony_ci	union {
64362306a36Sopenharmony_ci		__s64	    align;	/* force alignment of ha_fid	 */
64462306a36Sopenharmony_ci		xfs_fsid_t  _ha_fsid;	/* unique file system identifier */
64562306a36Sopenharmony_ci	} ha_u;
64662306a36Sopenharmony_ci	xfs_fid_t	ha_fid;		/* file system specific file ID	 */
64762306a36Sopenharmony_ci} xfs_handle_t;
64862306a36Sopenharmony_ci#define ha_fsid ha_u._ha_fsid
64962306a36Sopenharmony_ci
65062306a36Sopenharmony_ci/*
65162306a36Sopenharmony_ci * Structure passed to XFS_IOC_SWAPEXT
65262306a36Sopenharmony_ci */
65362306a36Sopenharmony_citypedef struct xfs_swapext
65462306a36Sopenharmony_ci{
65562306a36Sopenharmony_ci	int64_t		sx_version;	/* version */
65662306a36Sopenharmony_ci#define XFS_SX_VERSION		0
65762306a36Sopenharmony_ci	int64_t		sx_fdtarget;	/* fd of target file */
65862306a36Sopenharmony_ci	int64_t		sx_fdtmp;	/* fd of tmp file */
65962306a36Sopenharmony_ci	xfs_off_t	sx_offset;	/* offset into file */
66062306a36Sopenharmony_ci	xfs_off_t	sx_length;	/* leng from offset */
66162306a36Sopenharmony_ci	char		sx_pad[16];	/* pad space, unused */
66262306a36Sopenharmony_ci	struct xfs_bstat sx_stat;	/* stat of target b4 copy */
66362306a36Sopenharmony_ci} xfs_swapext_t;
66462306a36Sopenharmony_ci
66562306a36Sopenharmony_ci/*
66662306a36Sopenharmony_ci * Flags for going down operation
66762306a36Sopenharmony_ci */
66862306a36Sopenharmony_ci#define XFS_FSOP_GOING_FLAGS_DEFAULT		0x0	/* going down */
66962306a36Sopenharmony_ci#define XFS_FSOP_GOING_FLAGS_LOGFLUSH		0x1	/* flush log but not data */
67062306a36Sopenharmony_ci#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH		0x2	/* don't flush log nor data */
67162306a36Sopenharmony_ci
67262306a36Sopenharmony_ci/* metadata scrubbing */
67362306a36Sopenharmony_cistruct xfs_scrub_metadata {
67462306a36Sopenharmony_ci	__u32 sm_type;		/* What to check? */
67562306a36Sopenharmony_ci	__u32 sm_flags;		/* flags; see below. */
67662306a36Sopenharmony_ci	__u64 sm_ino;		/* inode number. */
67762306a36Sopenharmony_ci	__u32 sm_gen;		/* inode generation. */
67862306a36Sopenharmony_ci	__u32 sm_agno;		/* ag number. */
67962306a36Sopenharmony_ci	__u64 sm_reserved[5];	/* pad to 64 bytes */
68062306a36Sopenharmony_ci};
68162306a36Sopenharmony_ci
68262306a36Sopenharmony_ci/*
68362306a36Sopenharmony_ci * Metadata types and flags for scrub operation.
68462306a36Sopenharmony_ci */
68562306a36Sopenharmony_ci
68662306a36Sopenharmony_ci/* Scrub subcommands. */
68762306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_PROBE	0	/* presence test ioctl */
68862306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_SB	1	/* superblock */
68962306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_AGF	2	/* AG free header */
69062306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_AGFL	3	/* AG free list */
69162306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_AGI	4	/* AG inode header */
69262306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_BNOBT	5	/* freesp by block btree */
69362306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_CNTBT	6	/* freesp by length btree */
69462306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_INOBT	7	/* inode btree */
69562306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_FINOBT	8	/* free inode btree */
69662306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_RMAPBT	9	/* reverse mapping btree */
69762306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_REFCNTBT	10	/* reference count btree */
69862306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_INODE	11	/* inode record */
69962306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_BMBTD	12	/* data fork block mapping */
70062306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_BMBTA	13	/* attr fork block mapping */
70162306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_BMBTC	14	/* CoW fork block mapping */
70262306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_DIR	15	/* directory */
70362306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_XATTR	16	/* extended attribute */
70462306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_SYMLINK	17	/* symbolic link */
70562306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_PARENT	18	/* parent pointers */
70662306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_RTBITMAP	19	/* realtime bitmap */
70762306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_RTSUM	20	/* realtime summary */
70862306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_UQUOTA	21	/* user quotas */
70962306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_GQUOTA	22	/* group quotas */
71062306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_PQUOTA	23	/* project quotas */
71162306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_FSCOUNTERS 24	/* fs summary counters */
71262306a36Sopenharmony_ci
71362306a36Sopenharmony_ci/* Number of scrub subcommands. */
71462306a36Sopenharmony_ci#define XFS_SCRUB_TYPE_NR	25
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_ci/* i: Repair this metadata. */
71762306a36Sopenharmony_ci#define XFS_SCRUB_IFLAG_REPAIR		(1u << 0)
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ci/* o: Metadata object needs repair. */
72062306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_CORRUPT		(1u << 1)
72162306a36Sopenharmony_ci
72262306a36Sopenharmony_ci/*
72362306a36Sopenharmony_ci * o: Metadata object could be optimized.  It's not corrupt, but
72462306a36Sopenharmony_ci *    we could improve on it somehow.
72562306a36Sopenharmony_ci */
72662306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_PREEN		(1u << 2)
72762306a36Sopenharmony_ci
72862306a36Sopenharmony_ci/* o: Cross-referencing failed. */
72962306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_XFAIL		(1u << 3)
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci/* o: Metadata object disagrees with cross-referenced metadata. */
73262306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_XCORRUPT	(1u << 4)
73362306a36Sopenharmony_ci
73462306a36Sopenharmony_ci/* o: Scan was not complete. */
73562306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_INCOMPLETE	(1u << 5)
73662306a36Sopenharmony_ci
73762306a36Sopenharmony_ci/* o: Metadata object looked funny but isn't corrupt. */
73862306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_WARNING		(1u << 6)
73962306a36Sopenharmony_ci
74062306a36Sopenharmony_ci/*
74162306a36Sopenharmony_ci * o: IFLAG_REPAIR was set but metadata object did not need fixing or
74262306a36Sopenharmony_ci *    optimization and has therefore not been altered.
74362306a36Sopenharmony_ci */
74462306a36Sopenharmony_ci#define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1u << 7)
74562306a36Sopenharmony_ci
74662306a36Sopenharmony_ci/* i: Rebuild the data structure. */
74762306a36Sopenharmony_ci#define XFS_SCRUB_IFLAG_FORCE_REBUILD	(1u << 8)
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ci#define XFS_SCRUB_FLAGS_IN	(XFS_SCRUB_IFLAG_REPAIR | \
75062306a36Sopenharmony_ci				 XFS_SCRUB_IFLAG_FORCE_REBUILD)
75162306a36Sopenharmony_ci#define XFS_SCRUB_FLAGS_OUT	(XFS_SCRUB_OFLAG_CORRUPT | \
75262306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_PREEN | \
75362306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_XFAIL | \
75462306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_XCORRUPT | \
75562306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_INCOMPLETE | \
75662306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_WARNING | \
75762306a36Sopenharmony_ci				 XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED)
75862306a36Sopenharmony_ci#define XFS_SCRUB_FLAGS_ALL	(XFS_SCRUB_FLAGS_IN | XFS_SCRUB_FLAGS_OUT)
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci/*
76162306a36Sopenharmony_ci * ioctl limits
76262306a36Sopenharmony_ci */
76362306a36Sopenharmony_ci#ifdef XATTR_LIST_MAX
76462306a36Sopenharmony_ci#  define XFS_XATTR_LIST_MAX XATTR_LIST_MAX
76562306a36Sopenharmony_ci#else
76662306a36Sopenharmony_ci#  define XFS_XATTR_LIST_MAX 65536
76762306a36Sopenharmony_ci#endif
76862306a36Sopenharmony_ci
76962306a36Sopenharmony_ci
77062306a36Sopenharmony_ci/*
77162306a36Sopenharmony_ci * ioctl commands that are used by Linux filesystems
77262306a36Sopenharmony_ci */
77362306a36Sopenharmony_ci#define XFS_IOC_GETXFLAGS	FS_IOC_GETFLAGS
77462306a36Sopenharmony_ci#define XFS_IOC_SETXFLAGS	FS_IOC_SETFLAGS
77562306a36Sopenharmony_ci#define XFS_IOC_GETVERSION	FS_IOC_GETVERSION
77662306a36Sopenharmony_ci
77762306a36Sopenharmony_ci/*
77862306a36Sopenharmony_ci * ioctl commands that replace IRIX fcntl()'s
77962306a36Sopenharmony_ci * For 'documentation' purposed more than anything else,
78062306a36Sopenharmony_ci * the "cmd #" field reflects the IRIX fcntl number.
78162306a36Sopenharmony_ci */
78262306a36Sopenharmony_ci/*	XFS_IOC_ALLOCSP ------- deprecated 10	 */
78362306a36Sopenharmony_ci/*	XFS_IOC_FREESP -------- deprecated 11	 */
78462306a36Sopenharmony_ci#define XFS_IOC_DIOINFO		_IOR ('X', 30, struct dioattr)
78562306a36Sopenharmony_ci#define XFS_IOC_FSGETXATTR	FS_IOC_FSGETXATTR
78662306a36Sopenharmony_ci#define XFS_IOC_FSSETXATTR	FS_IOC_FSSETXATTR
78762306a36Sopenharmony_ci/*	XFS_IOC_ALLOCSP64 ----- deprecated 36	 */
78862306a36Sopenharmony_ci/*	XFS_IOC_FREESP64 ------ deprecated 37	 */
78962306a36Sopenharmony_ci#define XFS_IOC_GETBMAP		_IOWR('X', 38, struct getbmap)
79062306a36Sopenharmony_ci/*      XFS_IOC_FSSETDM ------- deprecated 39    */
79162306a36Sopenharmony_ci#define XFS_IOC_RESVSP		_IOW ('X', 40, struct xfs_flock64)
79262306a36Sopenharmony_ci#define XFS_IOC_UNRESVSP	_IOW ('X', 41, struct xfs_flock64)
79362306a36Sopenharmony_ci#define XFS_IOC_RESVSP64	_IOW ('X', 42, struct xfs_flock64)
79462306a36Sopenharmony_ci#define XFS_IOC_UNRESVSP64	_IOW ('X', 43, struct xfs_flock64)
79562306a36Sopenharmony_ci#define XFS_IOC_GETBMAPA	_IOWR('X', 44, struct getbmap)
79662306a36Sopenharmony_ci#define XFS_IOC_FSGETXATTRA	_IOR ('X', 45, struct fsxattr)
79762306a36Sopenharmony_ci/*	XFS_IOC_SETBIOSIZE ---- deprecated 46	   */
79862306a36Sopenharmony_ci/*	XFS_IOC_GETBIOSIZE ---- deprecated 47	   */
79962306a36Sopenharmony_ci#define XFS_IOC_GETBMAPX	_IOWR('X', 56, struct getbmap)
80062306a36Sopenharmony_ci#define XFS_IOC_ZERO_RANGE	_IOW ('X', 57, struct xfs_flock64)
80162306a36Sopenharmony_ci#define XFS_IOC_FREE_EOFBLOCKS	_IOR ('X', 58, struct xfs_fs_eofblocks)
80262306a36Sopenharmony_ci/*	XFS_IOC_GETFSMAP ------ hoisted 59         */
80362306a36Sopenharmony_ci#define XFS_IOC_SCRUB_METADATA	_IOWR('X', 60, struct xfs_scrub_metadata)
80462306a36Sopenharmony_ci#define XFS_IOC_AG_GEOMETRY	_IOWR('X', 61, struct xfs_ag_geometry)
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ci/*
80762306a36Sopenharmony_ci * ioctl commands that replace IRIX syssgi()'s
80862306a36Sopenharmony_ci */
80962306a36Sopenharmony_ci#define XFS_IOC_FSGEOMETRY_V1	     _IOR ('X', 100, struct xfs_fsop_geom_v1)
81062306a36Sopenharmony_ci#define XFS_IOC_FSBULKSTAT	     _IOWR('X', 101, struct xfs_fsop_bulkreq)
81162306a36Sopenharmony_ci#define XFS_IOC_FSBULKSTAT_SINGLE    _IOWR('X', 102, struct xfs_fsop_bulkreq)
81262306a36Sopenharmony_ci#define XFS_IOC_FSINUMBERS	     _IOWR('X', 103, struct xfs_fsop_bulkreq)
81362306a36Sopenharmony_ci#define XFS_IOC_PATH_TO_FSHANDLE     _IOWR('X', 104, struct xfs_fsop_handlereq)
81462306a36Sopenharmony_ci#define XFS_IOC_PATH_TO_HANDLE	     _IOWR('X', 105, struct xfs_fsop_handlereq)
81562306a36Sopenharmony_ci#define XFS_IOC_FD_TO_HANDLE	     _IOWR('X', 106, struct xfs_fsop_handlereq)
81662306a36Sopenharmony_ci#define XFS_IOC_OPEN_BY_HANDLE	     _IOWR('X', 107, struct xfs_fsop_handlereq)
81762306a36Sopenharmony_ci#define XFS_IOC_READLINK_BY_HANDLE   _IOWR('X', 108, struct xfs_fsop_handlereq)
81862306a36Sopenharmony_ci#define XFS_IOC_SWAPEXT		     _IOWR('X', 109, struct xfs_swapext)
81962306a36Sopenharmony_ci#define XFS_IOC_FSGROWFSDATA	     _IOW ('X', 110, struct xfs_growfs_data)
82062306a36Sopenharmony_ci#define XFS_IOC_FSGROWFSLOG	     _IOW ('X', 111, struct xfs_growfs_log)
82162306a36Sopenharmony_ci#define XFS_IOC_FSGROWFSRT	     _IOW ('X', 112, struct xfs_growfs_rt)
82262306a36Sopenharmony_ci#define XFS_IOC_FSCOUNTS	     _IOR ('X', 113, struct xfs_fsop_counts)
82362306a36Sopenharmony_ci#define XFS_IOC_SET_RESBLKS	     _IOWR('X', 114, struct xfs_fsop_resblks)
82462306a36Sopenharmony_ci#define XFS_IOC_GET_RESBLKS	     _IOR ('X', 115, struct xfs_fsop_resblks)
82562306a36Sopenharmony_ci#define XFS_IOC_ERROR_INJECTION	     _IOW ('X', 116, struct xfs_error_injection)
82662306a36Sopenharmony_ci#define XFS_IOC_ERROR_CLEARALL	     _IOW ('X', 117, struct xfs_error_injection)
82762306a36Sopenharmony_ci/*	XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118	 */
82862306a36Sopenharmony_ci
82962306a36Sopenharmony_ci#define XFS_IOC_FREEZE		     _IOWR('X', 119, int)	/* aka FIFREEZE */
83062306a36Sopenharmony_ci#define XFS_IOC_THAW		     _IOWR('X', 120, int)	/* aka FITHAW */
83162306a36Sopenharmony_ci
83262306a36Sopenharmony_ci/*      XFS_IOC_FSSETDM_BY_HANDLE -- deprecated 121      */
83362306a36Sopenharmony_ci#define XFS_IOC_ATTRLIST_BY_HANDLE   _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
83462306a36Sopenharmony_ci#define XFS_IOC_ATTRMULTI_BY_HANDLE  _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
83562306a36Sopenharmony_ci#define XFS_IOC_FSGEOMETRY_V4	     _IOR ('X', 124, struct xfs_fsop_geom_v4)
83662306a36Sopenharmony_ci#define XFS_IOC_GOINGDOWN	     _IOR ('X', 125, uint32_t)
83762306a36Sopenharmony_ci#define XFS_IOC_FSGEOMETRY	     _IOR ('X', 126, struct xfs_fsop_geom)
83862306a36Sopenharmony_ci#define XFS_IOC_BULKSTAT	     _IOR ('X', 127, struct xfs_bulkstat_req)
83962306a36Sopenharmony_ci#define XFS_IOC_INUMBERS	     _IOR ('X', 128, struct xfs_inumbers_req)
84062306a36Sopenharmony_ci/*	XFS_IOC_GETFSUUID ---------- deprecated 140	 */
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci
84362306a36Sopenharmony_ci#ifndef HAVE_BBMACROS
84462306a36Sopenharmony_ci/*
84562306a36Sopenharmony_ci * Block I/O parameterization.	A basic block (BB) is the lowest size of
84662306a36Sopenharmony_ci * filesystem allocation, and must equal 512.  Length units given to bio
84762306a36Sopenharmony_ci * routines are in BB's.
84862306a36Sopenharmony_ci */
84962306a36Sopenharmony_ci#define BBSHIFT		9
85062306a36Sopenharmony_ci#define BBSIZE		(1<<BBSHIFT)
85162306a36Sopenharmony_ci#define BBMASK		(BBSIZE-1)
85262306a36Sopenharmony_ci#define BTOBB(bytes)	(((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
85362306a36Sopenharmony_ci#define BTOBBT(bytes)	((__u64)(bytes) >> BBSHIFT)
85462306a36Sopenharmony_ci#define BBTOB(bbs)	((bbs) << BBSHIFT)
85562306a36Sopenharmony_ci#endif
85662306a36Sopenharmony_ci
85762306a36Sopenharmony_ci#endif	/* __XFS_FS_H__ */
858