📄 xfs.h
字号:
/* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file *//* * GRUB -- GRand Unified Bootloader * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. * Copyright (C) 2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, * Mountain View, CA 94043, or: * * http://www.sgi.com * * For further information regarding this notice, see: * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */#ifndef _BITS_TYPES_Htypedef signed char __int8_t;typedef unsigned char __uint8_t;typedef short __int16_t;typedef unsigned short __uint16_t;typedef int __int32_t;typedef unsigned int __uint32_t;typedef long long __int64_t;typedef unsigned long long __uint64_t;#endiftypedef __uint64_t xfs_ino_t;typedef __uint32_t xfs_agino_t;typedef __int64_t xfs_daddr_t;typedef __int64_t xfs_off_t;typedef __uint8_t uuid_t[16];/* those are from xfs_types.h */typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */typedef __uint32_t xfs_extlen_t; /* extent length in blocks */typedef __uint32_t xfs_agnumber_t; /* allocation group number */typedef __int32_t xfs_extnum_t; /* # of extents in a file */typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */typedef __int64_t xfs_fsize_t; /* bytes in a file */typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */typedef __uint32_t xfs_dahash_t; /* dir/attr hash value *//* * Disk based types: */typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */typedef __uint64_t xfs_dfiloff_t; /* block number in a file */typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */typedef __uint64_t xfs_fileoff_t; /* block number in a file */typedef __uint64_t xfs_filblks_t; /* number of blocks in a file *//* those are from xfs_sb.h */#define XFS_SB_MAGIC 0x58465342 /* 'XFSB'*/#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */#define XFS_SB_VERSION_NUMBITS 0x000ftypedef struct xfs_sb{ __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ __uint32_t sb_blocksize; /* logical block size, bytes */ xfs_drfsbno_t sb_dblocks; /* number of data blocks */ xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */ xfs_drtbno_t sb_rextents; /* number of realtime extents */ uuid_t sb_uuid; /* file system unique id */ xfs_dfsbno_t sb_logstart; /* starting block of log if internal */ xfs_ino_t sb_rootino; /* root inode number */ xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */ xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */ xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */ xfs_agblock_t sb_agblocks; /* size of an allocation group */ xfs_agnumber_t sb_agcount; /* number of allocation groups */ xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */ xfs_extlen_t sb_logblocks; /* number of log blocks */ __uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */ __uint16_t sb_sectsize; /* volume sector size, bytes */ __uint16_t sb_inodesize; /* inode size, bytes */ __uint16_t sb_inopblock; /* inodes per block */ char sb_fname[12]; /* file system name */ __uint8_t sb_blocklog; /* log2 of sb_blocksize */ __uint8_t sb_sectlog; /* log2 of sb_sectsize */ __uint8_t sb_inodelog; /* log2 of sb_inodesize */ __uint8_t sb_inopblog; /* log2 of sb_inopblock */ __uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */ __uint8_t sb_rextslog; /* log2 of sb_rextents */ __uint8_t sb_inprogress; /* mkfs is in progress, don't mount */ __uint8_t sb_imax_pct; /* max % of fs for inode space */ /* statistics */ /* * These fields must remain contiguous. If you really * want to change their layout, make sure you fix the * code in xfs_trans_apply_sb_deltas(). */ __uint64_t sb_icount; /* allocated inodes */ __uint64_t sb_ifree; /* free inodes */ __uint64_t sb_fdblocks; /* free data blocks */ __uint64_t sb_frextents; /* free realtime extents */ /* * End contiguous fields. */ xfs_ino_t sb_uquotino; /* user quota inode */ xfs_ino_t sb_gquotino; /* group quota inode */ __uint16_t sb_qflags; /* quota flags */ __uint8_t sb_flags; /* misc. flags */ __uint8_t sb_shared_vn; /* shared version number */ xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */ __uint32_t sb_unit; /* stripe or raid unit */ __uint32_t sb_width; /* stripe or raid width */ __uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */ __uint8_t sb_dummy[7]; /* padding */} xfs_sb_t;/* those are from xfs_btree.h *//* * Long form header: bmap btrees. */typedef struct xfs_btree_lblock{ __uint32_t bb_magic; /* magic number for block type */ __uint16_t bb_level; /* 0 is a leaf */ __uint16_t bb_numrecs; /* current # of data records */ xfs_dfsbno_t bb_leftsib; /* left sibling block or NULLDFSBNO */ xfs_dfsbno_t bb_rightsib; /* right sibling block or NULLDFSBNO */} xfs_btree_lblock_t;/* * Combined header and structure, used by common code. */typedef struct xfs_btree_hdr{ __uint32_t bb_magic; /* magic number for block type */ __uint16_t bb_level; /* 0 is a leaf */ __uint16_t bb_numrecs; /* current # of data records */} xfs_btree_hdr_t;typedef struct xfs_btree_block{ xfs_btree_hdr_t bb_h; /* header */ union { struct { xfs_agblock_t bb_leftsib; xfs_agblock_t bb_rightsib; } s; /* short form pointers */ struct { xfs_dfsbno_t bb_leftsib; xfs_dfsbno_t bb_rightsib; } l; /* long form pointers */ } bb_u; /* rest */} xfs_btree_block_t;/* those are from xfs_bmap_btree.h *//* * Bmap root header, on-disk form only. */typedef struct xfs_bmdr_block{ __uint16_t bb_level; /* 0 is a leaf */ __uint16_t bb_numrecs; /* current # of data records */} xfs_bmdr_block_t;/* * Bmap btree record and extent descriptor. * For 32-bit kernels, * l0:31 is an extent flag (value 1 indicates non-normal). * l0:0-30 and l1:9-31 are startoff. * l1:0-8, l2:0-31, and l3:21-31 are startblock. * l3:0-20 are blockcount. * For 64-bit kernels, * l0:63 is an extent flag (value 1 indicates non-normal). * l0:9-62 are startoff. * l0:0-8 and l1:21-63 are startblock. * l1:0-20 are blockcount. */#define BMBT_USE_64 1typedef struct xfs_bmbt_rec_32{ __uint32_t l0, l1, l2, l3;} xfs_bmbt_rec_32_t;typedef struct xfs_bmbt_rec_64{ __uint64_t l0, l1;} xfs_bmbt_rec_64_t;#if BMBT_USE_64typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;#else /* !BMBT_USE_64 */typedef __uint32_t xfs_bmbt_rec_base_t; /* use this for casts */typedef xfs_bmbt_rec_32_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;#endif /* BMBT_USE_64 *//* * Key structure for non-leaf levels of the tree. */typedef struct xfs_bmbt_key{ xfs_dfiloff_t br_startoff; /* starting file offset */} xfs_bmbt_key_t, xfs_bmdr_key_t;typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */ /* btree block header type */typedef struct xfs_btree_lblock xfs_bmbt_block_t;/* those are from xfs_dir2.h *//* * Directory version 2. * There are 4 possible formats: * shortform * single block - data with embedded leaf at the end * multiple data blocks, single leaf+freeindex block * data blocks, node&leaf blocks (btree), freeindex blocks * * The shortform format is in xfs_dir2_sf.h. * The single block format is in xfs_dir2_block.h. * The data block format is in xfs_dir2_data.h. * The leaf and freeindex block formats are in xfs_dir2_leaf.h. * Node blocks are the same as the other version, in xfs_da_btree.h. *//* * Byte offset in data block and shortform entry. */typedef __uint16_t xfs_dir2_data_off_t;/* * Byte offset in a directory. */typedef xfs_off_t xfs_dir2_off_t;/* those are from xfs_da_btree.h *//*======================================================================== * Directory Structure when greater than XFS_LBSIZE(mp) bytes. *========================================================================*//* * This structure is common to both leaf nodes and non-leaf nodes in the Btree. * * Is is used to manage a doubly linked list of all blocks at the same * level in the Btree, and to identify which type of block this is. */#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -