xfs_sb.h revision 7e7bd3dccbfe8f79e25e5c1554b5bc3a9aaca321
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * This program is free software; you can redistribute it and/or modify it
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * under the terms of version 3 of the GNU General Public License as
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * published by the Free Software Foundation.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * This program is distributed in the hope that it would be useful, but
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * WITHOUT ANY WARRANTY; without even the implied warranty of
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Further, this software is distributed without any warranty that it is
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * free of the rightful claim of any third person regarding infringement
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * or the like. Any license provided herein, whether implied or
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * otherwise, applies only to this software file. Patent licenses, if
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * any, provided herein do not apply to combinations of this program with
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * other software, or any other product whatsoever.
cb241c1aa2096e51864b45398cc15850b0ce4d8cjamiebowen * You should have received a copy of the GNU General Public License along
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * with this program. If not, see <http://www.gnu.org/licenses/>.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
cb241c1aa2096e51864b45398cc15850b0ce4d8cjamiebowen * Mountain View, CA 94043, or:
cb241c1aa2096e51864b45398cc15850b0ce4d8cjamiebowen * For further information regarding this notice, see:
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Super block
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Fits into a 512-byte buffer at daddr_t 0 of each allocation group.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * Only the first of these is ever updated except during growfs.
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2) \
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowentypedef struct xfs_sb
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
cb241c1aa2096e51864b45398cc15850b0ce4d8cjamiebowen uint32_t sb_blocksize; /* logical block size, bytes */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_drfsbno_t sb_dblocks; /* number of data blocks */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_drtbno_t sb_rextents; /* number of realtime extents */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_dfsbno_t sb_logstart; /* starting block of log if internal */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_agblock_t sb_agblocks; /* size of an allocation group */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_agnumber_t sb_agcount; /* number of allocation groups */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen xfs_extlen_t sb_logblocks; /* number of log blocks */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint16_t sb_sectsize; /* volume sector size, bytes */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint8_t sb_inprogress; /* mkfs is in progress, don't mount */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint8_t sb_imax_pct; /* max % of fs for inode space */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen /* statistics */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * These fields must remain contiguous. If you really
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * want to change their layout, make sure you fix the
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * code in xfs_trans_apply_sb_deltas().
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen uint64_t sb_frextents; /* free realtime extents */
5c124de5c36bfc236d55578429df5f048f0d0a07Jamie Bowen * End contiguous fields.
} xfs_sb_t;
#define XFS_SB_MOD_BITS \
#define XFS_SB_MAX_SHARED_VN 0
#ifdef __KERNEL__
unsigned xfs_sb_version_tonew(unsigned v);
#define XFS_SB_VERSION_TONEW(v) \
((((v) == XFS_SB_VERSION_1) ? \
(((v) == XFS_SB_VERSION_2) ? \
unsigned xfs_sb_version_toold(unsigned v);
#define XFS_SB_VERSION_TOOLD(v) \
(((v) & XFS_SB_VERSION_NLINKBIT) ? \
XFS_SB_VERSION_3 : \
(((v) & XFS_SB_VERSION_ATTRBIT) ? \
XFS_SB_VERSION_2 : \
XFS_SB_VERSION_2 : \
XFS_SB_VERSION_3 : \