/* SPDX-License-Identifier: LGPL-2.1 */ /* * Copyright (c) 1995-2005 Silicon Graphics, Inc. * All Rights Reserved.
*/ #ifndef __XFS_FS_H__ #define __XFS_FS_H__
/* * SGI's XFS filesystem's major stuff (constants, structures) * NOTE: This file must be compile-able with C++ compilers.
*/
/* * Direct I/O attribute record used with XFS_IOC_DIOINFO * d_miniosz is the min xfer size, xfer size multiple and file seek offset * alignment.
*/ #ifndef HAVE_DIOATTR struct dioattr {
__u32 d_mem; /* data buffer memory alignment */
__u32 d_miniosz; /* min xfer size */
__u32 d_maxiosz; /* max xfer size */
}; #endif
/* * Structure for XFS_IOC_GETBMAP. * On input, fill in bmv_offset and bmv_length of the first structure * to indicate the area of interest in the file, and bmv_entries with * the number of array elements given back. The first structure is * updated on return to give the offset and length for the next call.
*/ #ifndef HAVE_GETBMAP struct getbmap {
__s64 bmv_offset; /* file offset of segment in blocks */
__s64 bmv_block; /* starting block (64-bit daddr_t) */
__s64 bmv_length; /* length of segment, blocks */
__s32 bmv_count; /* # of entries in array incl. 1st */
__s32 bmv_entries; /* # of entries filled in (output) */
}; #endif
/* * Structure for XFS_IOC_GETBMAPX. Fields bmv_offset through bmv_entries * are used exactly as in the getbmap structure. The getbmapx structure * has additional bmv_iflags and bmv_oflags fields. The bmv_iflags field * is only used for the first structure. It contains input flags * specifying XFS_IOC_GETBMAPX actions. The bmv_oflags field is filled * in by the XFS_IOC_GETBMAPX command for each returned structure after * the first.
*/ #ifndef HAVE_GETBMAPX struct getbmapx {
__s64 bmv_offset; /* file offset of segment in blocks */
__s64 bmv_block; /* starting block (64-bit daddr_t) */
__s64 bmv_length; /* length of segment, blocks */
__s32 bmv_count; /* # of entries in array incl. 1st */
__s32 bmv_entries; /* # of entries filled in (output). */
__s32 bmv_iflags; /* input flags (1st structure) */
__s32 bmv_oflags; /* output flags (after 1st structure)*/
__s32 bmv_unused1; /* future use */
__s32 bmv_unused2; /* future use */
}; #endif
/* bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */ #define BMV_IF_ATTRFORK 0x1 /* return attr fork rather than data */ #define BMV_IF_NO_DMAPI_READ 0x2 /* Deprecated */ #define BMV_IF_PREALLOC 0x4 /* rtn status BMV_OF_PREALLOC if req */ #define BMV_IF_DELALLOC 0x8 /* rtn status BMV_OF_DELALLOC if req */ #define BMV_IF_NO_HOLES 0x10 /* Do not return holes */ #define BMV_IF_COWFORK 0x20 /* return CoW fork rather than data */ #define BMV_IF_VALID \
(BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC| \
BMV_IF_DELALLOC|BMV_IF_NO_HOLES|BMV_IF_COWFORK)
/* bmv_oflags values - returned for each non-header segment */ #define BMV_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */ #define BMV_OF_DELALLOC 0x2 /* segment = delayed allocation */ #define BMV_OF_LAST 0x4 /* segment is the last in the file */ #define BMV_OF_SHARED 0x8 /* segment shared with another file */
/* * File segment locking set data type for 64 bit access. * Also used for all the RESV/FREE interfaces.
*/ typedefstruct xfs_flock64 {
__s16 l_type;
__s16 l_whence;
__s64 l_start;
__s64 l_len; /* len == 0 means until end of file */
__s32 l_sysid;
__u32 l_pid;
__s32 l_pad[4]; /* reserve area */
} xfs_flock64_t;
/* * Output for XFS_IOC_FSGEOMETRY_V1
*/ struct xfs_fsop_geom_v1 {
__u32 blocksize; /* filesystem (data) block size */
__u32 rtextsize; /* realtime extent size */
__u32 agblocks; /* fsblocks in an AG */
__u32 agcount; /* number of allocation groups */
__u32 logblocks; /* fsblocks in the log */
__u32 sectsize; /* (data) sector size, bytes */
__u32 inodesize; /* inode size in bytes */
__u32 imaxpct; /* max allowed inode space(%) */
__u64 datablocks; /* fsblocks in data subvolume */
__u64 rtblocks; /* fsblocks in realtime subvol */
__u64 rtextents; /* rt extents in realtime subvol*/
__u64 logstart; /* starting fsblock of the log */ unsignedchar uuid[16]; /* unique id of the filesystem */
__u32 sunit; /* stripe unit, fsblocks */
__u32 swidth; /* stripe width, fsblocks */
__s32 version; /* structure version */
__u32 flags; /* superblock version flags */
__u32 logsectsize; /* log sector size, bytes */
__u32 rtsectsize; /* realtime sector size, bytes */
__u32 dirblocksize; /* directory block size, bytes */
};
/* * Output for XFS_IOC_FSGEOMETRY_V4
*/ struct xfs_fsop_geom_v4 {
__u32 blocksize; /* filesystem (data) block size */
__u32 rtextsize; /* realtime extent size */
__u32 agblocks; /* fsblocks in an AG */
__u32 agcount; /* number of allocation groups */
__u32 logblocks; /* fsblocks in the log */
__u32 sectsize; /* (data) sector size, bytes */
__u32 inodesize; /* inode size in bytes */
__u32 imaxpct; /* max allowed inode space(%) */
__u64 datablocks; /* fsblocks in data subvolume */
__u64 rtblocks; /* fsblocks in realtime subvol */
__u64 rtextents; /* rt extents in realtime subvol*/
__u64 logstart; /* starting fsblock of the log */ unsignedchar uuid[16]; /* unique id of the filesystem */
__u32 sunit; /* stripe unit, fsblocks */
__u32 swidth; /* stripe width, fsblocks */
__s32 version; /* structure version */
__u32 flags; /* superblock version flags */
__u32 logsectsize; /* log sector size, bytes */
__u32 rtsectsize; /* realtime sector size, bytes */
__u32 dirblocksize; /* directory block size, bytes */
__u32 logsunit; /* log stripe unit, bytes */
};
/* * Output for XFS_IOC_FSGEOMETRY
*/ struct xfs_fsop_geom {
__u32 blocksize; /* filesystem (data) block size */
__u32 rtextsize; /* realtime extent size */
__u32 agblocks; /* fsblocks in an AG */
__u32 agcount; /* number of allocation groups */
__u32 logblocks; /* fsblocks in the log */
__u32 sectsize; /* (data) sector size, bytes */
__u32 inodesize; /* inode size in bytes */
__u32 imaxpct; /* max allowed inode space(%) */
__u64 datablocks; /* fsblocks in data subvolume */
__u64 rtblocks; /* fsblocks in realtime subvol */
__u64 rtextents; /* rt extents in realtime subvol*/
__u64 logstart; /* starting fsblock of the log */ unsignedchar uuid[16]; /* unique id of the filesystem */
__u32 sunit; /* stripe unit, fsblocks */
__u32 swidth; /* stripe width, fsblocks */
__s32 version; /* structure version */
__u32 flags; /* superblock version flags */
__u32 logsectsize; /* log sector size, bytes */
__u32 rtsectsize; /* realtime sector size, bytes */
__u32 dirblocksize; /* directory block size, bytes */
__u32 logsunit; /* log stripe unit, bytes */
uint32_t sick; /* o: unhealthy fs & rt metadata */
uint32_t checked; /* o: checked fs & rt metadata */
__u32 rgextents; /* rt extents in a realtime group */
__u32 rgcount; /* number of realtime groups */
__u64 rtstart; /* start of internal rt section */
__u64 rtreserved; /* RT (zoned) reserved blocks */
__u64 reserved[14]; /* reserved space */
};
/* * Minimum and maximum sizes need for growth checks. * * Block counts are in units of filesystem blocks, not basic blocks.
*/ #define XFS_MIN_AG_BLOCKS 64 #define XFS_MIN_LOG_BLOCKS 512ULL #define XFS_MAX_LOG_BLOCKS (1024 * 1024ULL) #define XFS_MIN_LOG_BYTES (10 * 1024 * 1024ULL)
/* * Limits on sb_agblocks/sb_agblklog -- mkfs won't format AGs smaller than * 16MB or larger than 1TB.
*/ #define XFS_MIN_AG_BYTES (1ULL << 24) /* 16 MB */ #define XFS_MAX_AG_BYTES (1ULL << 40) /* 1 TB */ #define XFS_MAX_AG_BLOCKS (XFS_MAX_AG_BYTES / XFS_MIN_BLOCKSIZE) #define XFS_MAX_CRC_AG_BLOCKS (XFS_MAX_AG_BYTES / XFS_MIN_CRC_BLOCKSIZE)
/* * Project quota id helpers (previously projid was 16bit only * and using two 16bit values to hold new 32bit projid was chosen * to retain compatibility with "old" filesystems).
*/ staticinline uint32_t
bstat_get_projid(conststruct xfs_bstat *bs)
{ return (uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
}
/* * The user-level BulkStat Request interface structure.
*/ struct xfs_fsop_bulkreq {
__u64 __user *lastip; /* last inode # pointer */
__s32 icount; /* count of entries in buffer */ void __user *ubuffer;/* user buffer for inode desc. */
__s32 __user *ocount; /* output count pointer */
};
/* * Structures returned from xfs_inumbers routine (XFS_IOC_FSINUMBERS).
*/ struct xfs_inogrp {
__u64 xi_startino; /* starting inode number */
__s32 xi_alloccount; /* # bits set in allocmask */
__u64 xi_allocmask; /* mask of allocated inodes */
};
/* New inumbers structure that reports v5 features and fixes padding issues */ struct xfs_inumbers {
uint64_t xi_startino; /* starting inode number */
uint64_t xi_allocmask; /* mask of allocated inodes */
uint8_t xi_alloccount; /* # bits set in allocmask */
uint8_t xi_version; /* version */
uint8_t xi_padding[6]; /* zero */
};
/* Header for bulk inode requests. */ struct xfs_bulk_ireq {
uint64_t ino; /* I/O: start with this inode */
uint32_t flags; /* I/O: operation flags */
uint32_t icount; /* I: count of entries in buffer */
uint32_t ocount; /* O: count of entries filled out */
uint32_t agno; /* I: see comment for IREQ_AGNO */
uint64_t reserved[5]; /* must be zero */
};
/* * Only return results from the specified @agno. If @ino is zero, start * with the first inode of @agno.
*/ #define XFS_BULK_IREQ_AGNO (1U << 0)
/* * Return bulkstat information for a single inode, where @ino value is a * special value, not a literal inode number. See the XFS_BULK_IREQ_SPECIAL_* * values below. Not compatible with XFS_BULK_IREQ_AGNO.
*/ #define XFS_BULK_IREQ_SPECIAL (1U << 1)
/* * Return data fork extent count via xfs_bulkstat->bs_extents64 field and assign * 0 to xfs_bulkstat->bs_extents when the flag is set. Otherwise, use * xfs_bulkstat->bs_extents for returning data fork extent count and set * xfs_bulkstat->bs_extents64 to 0. In the second case, return -EOVERFLOW and * assign 0 to xfs_bulkstat->bs_extents if data fork extent count is larger than * XFS_MAX_EXTCNT_DATA_FORK_OLD.
*/ #define XFS_BULK_IREQ_NREXT64 (1U << 2)
/* * Allow bulkstat to return information about metadata directories. This * enables xfs_scrub to find them for scanning, as they are otherwise ordinary * directories.
*/ #define XFS_BULK_IREQ_METADIR (1U << 3)
/* eof_flags values */ #define XFS_EOF_FLAGS_SYNC (1 << 0) /* sync/wait mode scan */ #define XFS_EOF_FLAGS_UID (1 << 1) /* filter by uid */ #define XFS_EOF_FLAGS_GID (1 << 2) /* filter by gid */ #define XFS_EOF_FLAGS_PRID (1 << 3) /* filter by project id */ #define XFS_EOF_FLAGS_MINFILESIZE (1 << 4) /* filter by min file size */ #define XFS_EOF_FLAGS_UNION (1 << 5) /* union filter algorithm; * kernel only, not included in
* valid mask */ #define XFS_EOF_FLAGS_VALID \
(XFS_EOF_FLAGS_SYNC | \
XFS_EOF_FLAGS_UID | \
XFS_EOF_FLAGS_GID | \
XFS_EOF_FLAGS_PRID | \
XFS_EOF_FLAGS_MINFILESIZE)
/* * The user-level Handle Request interface structure.
*/ typedefstruct xfs_fsop_handlereq {
__u32 fd; /* fd for FD_TO_HANDLE */ void __user *path; /* user pathname */
__u32 oflags; /* open flags */ void __user *ihandle;/* user supplied handle */
__u32 ihandlen; /* user supplied length */ void __user *ohandle;/* user buffer for handle */
__u32 __user *ohandlen;/* user buffer length */
} xfs_fsop_handlereq_t;
/* * Compound structures for passing args through Handle Request interfaces * xfs_attrlist_by_handle, xfs_attrmulti_by_handle * - ioctls: XFS_IOC_ATTRLIST_BY_HANDLE, and XFS_IOC_ATTRMULTI_BY_HANDLE
*/
/* * Flags passed in xfs_attr_multiop.am_flags for the attr ioctl interface. * * NOTE: Must match the values declared in libattr without the XFS_IOC_ prefix.
*/ #define XFS_IOC_ATTR_ROOT 0x0002 /* use attrs in root namespace */ #define XFS_IOC_ATTR_SECURE 0x0008 /* use attrs in security namespace */ #define XFS_IOC_ATTR_CREATE 0x0010 /* fail if attr already exists */ #define XFS_IOC_ATTR_REPLACE 0x0020 /* fail if attr does not exist */
/* * Define how lists of attribute names are returned to userspace from the * XFS_IOC_ATTRLIST_BY_HANDLE ioctl. struct xfs_attrlist is the header at the * beginning of the returned buffer, and a each entry in al_offset contains the * relative offset of an xfs_attrlist_ent containing the actual entry. * * NOTE: struct xfs_attrlist must match struct attrlist defined in libattr, and * struct xfs_attrlist_ent must match struct attrlist_ent defined in libattr.
*/ struct xfs_attrlist {
__s32 al_count; /* number of entries in attrlist */
__s32 al_more; /* T/F: more attrs (do call again) */
__s32 al_offset[]; /* byte offsets of attrs [var-sized] */
};
struct xfs_attrlist_ent { /* data from attr_list() */
__u32 a_valuelen; /* number bytes in value of attr */ char a_name[]; /* attr name (NULL terminated) */
};
typedefstruct xfs_fsop_attrlist_handlereq { struct xfs_fsop_handlereq hreq; /* handle interface structure */ struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */
__u32 flags; /* which namespace to use */
__u32 buflen; /* length of buffer supplied */ void __user *buffer; /* returned names */
} xfs_fsop_attrlist_handlereq_t;
typedefstruct xfs_fsop_attrmulti_handlereq { struct xfs_fsop_handlereq hreq; /* handle interface structure */
__u32 opcount;/* count of following multiop */ struct xfs_attr_multiop __user *ops; /* attr_multi data */
} xfs_fsop_attrmulti_handlereq_t;
/* * per machine unique filesystem identifier types.
*/ typedefstruct xfs_fsid {
__u32 val[2]; /* file system id type */
} xfs_fsid_t;
typedefstruct xfs_fid {
__u16 fid_len; /* length of remainder */
__u16 fid_pad;
__u32 fid_gen; /* generation number */
__u64 fid_ino; /* 64 bits inode number */
} xfs_fid_t;
typedefstruct xfs_handle { union {
__s64 align; /* force alignment of ha_fid */
xfs_fsid_t _ha_fsid; /* unique file system identifier */
} ha_u;
xfs_fid_t ha_fid; /* file system specific file ID */
} xfs_handle_t; #define ha_fsid ha_u._ha_fsid
/* * Structure passed to XFS_IOC_SWAPEXT
*/ typedefstruct xfs_swapext
{
int64_t sx_version; /* version */ #define XFS_SX_VERSION 0
int64_t sx_fdtarget; /* fd of target file */
int64_t sx_fdtmp; /* fd of tmp file */
xfs_off_t sx_offset; /* offset into file */
xfs_off_t sx_length; /* leng from offset */ char sx_pad[16]; /* pad space, unused */ struct xfs_bstat sx_stat; /* stat of target b4 copy */
} xfs_swapext_t;
/* * Flags for going down operation
*/ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */ #define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */ #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */
/* metadata scrubbing */ struct xfs_scrub_metadata {
__u32 sm_type; /* What to check? */
__u32 sm_flags; /* flags; see below. */
__u64 sm_ino; /* inode number. */
__u32 sm_gen; /* inode generation. */
__u32 sm_agno; /* ag number. */
__u64 sm_reserved[5]; /* pad to 64 bytes */
};
/* * Metadata types and flags for scrub operation.
*/
/* Number of scrub subcommands. */ #define XFS_SCRUB_TYPE_NR 33
/* * This special type code only applies to the vectored scrub implementation. * * If any of the previous scrub vectors recorded runtime errors or have * sv_flags bits set that match the OFLAG bits in the barrier vector's * sv_flags, set the barrier's sv_ret to -ECANCELED and return to userspace.
*/ #define XFS_SCRUB_TYPE_BARRIER (0xFFFFFFFF)
/* * o: IFLAG_REPAIR was set but metadata object did not need fixing or * optimization and has therefore not been altered.
*/ #define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1u << 7)
/* i: Rebuild the data structure. */ #define XFS_SCRUB_IFLAG_FORCE_REBUILD (1u << 8)
/* * Exchange part of file1 with part of the file that this ioctl that is being * called against (which we'll call file2). Filesystems must be able to * restart and complete the operation even after the system goes down.
*/ struct xfs_exchange_range {
__s32 file1_fd;
__u32 pad; /* must be zeroes */
__u64 file1_offset; /* file1 offset, bytes */
__u64 file2_offset; /* file2 offset, bytes */
__u64 length; /* bytes to exchange */
__u64 flags; /* see XFS_EXCHANGE_RANGE_* below */
};
/* * Using the same definition of file2 as struct xfs_exchange_range, commit the * contents of file1 into file2 if file2 has the same inode number, mtime, and * ctime as the arguments provided to the call. The old contents of file2 will * be moved to file1. * * Returns -EBUSY if there isn't an exact match for the file2 fields. * * Filesystems must be able to restart and complete the operation even after * the system goes down.
*/ struct xfs_commit_range {
__s32 file1_fd;
__u32 pad; /* must be zeroes */
__u64 file1_offset; /* file1 offset, bytes */
__u64 file2_offset; /* file2 offset, bytes */
__u64 length; /* bytes to exchange */
/* * Exchange file data all the way to the ends of both files, and then exchange * the file sizes. This flag can be used to replace a file's contents with a * different amount of data. length will be ignored.
*/ #define XFS_EXCHANGE_RANGE_TO_EOF (1ULL << 0)
/* Flush all changes in file data and file metadata to disk before returning. */ #define XFS_EXCHANGE_RANGE_DSYNC (1ULL << 1)
/* Dry run; do all the parameter verification but do not change anything. */ #define XFS_EXCHANGE_RANGE_DRY_RUN (1ULL << 2)
/* * Exchange only the parts of the two files where the file allocation units * mapped to file1's range have been written to. This can accelerate * scatter-gather atomic writes with a temp file if all writes are aligned to * the file allocation unit.
*/ #define XFS_EXCHANGE_RANGE_FILE1_WRITTEN (1ULL << 3)
struct xfs_getparents_rec { struct xfs_handle gpr_parent; /* Handle to parent */
__u32 gpr_reclen; /* Length of entire record */
__u32 gpr_reserved; /* zero */ char gpr_name[]; /* Null-terminated filename */
};
/* Iterate through this file's directory parent pointers */ struct xfs_getparents { /* * Structure to track progress in iterating the parent pointers. * Must be initialized to zeroes before the first ioctl call, and * not touched by callers after that.
*/ struct xfs_attrlist_cursor gp_cursor;
/* Iterate through this file handle's directory parent pointers. */ struct xfs_getparents_by_handle { /* Handle to file whose parents we want. */ struct xfs_handle gph_handle;
struct xfs_getparents gph_request;
};
/* * Output for XFS_IOC_RTGROUP_GEOMETRY
*/ struct xfs_rtgroup_geometry {
__u32 rg_number; /* i/o: rtgroup number */
__u32 rg_length; /* o: length in blocks */
__u32 rg_sick; /* o: sick things in ag */
__u32 rg_checked; /* o: checked metadata in ag */
__u32 rg_flags; /* i/o: flags for this ag */
__u32 rg_reserved[27]; /* o: zero */
}; #define XFS_RTGROUP_GEOM_SICK_SUPER (1U << 0) /* superblock */ #define XFS_RTGROUP_GEOM_SICK_BITMAP (1U << 1) /* rtbitmap */ #define XFS_RTGROUP_GEOM_SICK_SUMMARY (1U << 2) /* rtsummary */ #define XFS_RTGROUP_GEOM_SICK_RMAPBT (1U << 3) /* reverse mappings */ #define XFS_RTGROUP_GEOM_SICK_REFCNTBT (1U << 4) /* reference counts */
/* * ioctl commands that are used by Linux filesystems
*/ #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS #define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS #define XFS_IOC_GETVERSION FS_IOC_GETVERSION
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.