1N/A/*
1N/A * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify it
1N/A * under the terms of version 3 of the GNU General Public License as
1N/A * published by the Free Software Foundation.
1N/A *
1N/A * This program is distributed in the hope that it would be useful, but
1N/A * WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1N/A *
1N/A * Further, this software is distributed without any warranty that it is
1N/A * free of the rightful claim of any third person regarding infringement
1N/A * or the like. Any license provided herein, whether implied or
1N/A * otherwise, applies only to this software file. Patent licenses, if
1N/A * any, provided herein do not apply to combinations of this program with
1N/A * other software, or any other product whatsoever.
1N/A *
1N/A * You should have received a copy of the GNU General Public License along
1N/A * with this program. If not, see <http://www.gnu.org/licenses/>.
1N/A *
1N/A * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
1N/A * Mountain View, CA 94043, or:
1N/A *
1N/A * http://www.sgi.com
1N/A *
1N/A * For further information regarding this notice, see:
1N/A *
1N/A * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
1N/A */
1N/A#ifndef __XFS_TYPES_H__
1N/A#define __XFS_TYPES_H__
1N/A
1N/A/*
1N/A * Some types are conditional based on the selected configuration.
1N/A * Set XFS_BIG_FILES=1 or 0 and XFS_BIG_FILESYSTEMS=1 or 0 depending
1N/A * on the desired configuration.
1N/A * XFS_BIG_FILES needs pgno_t to be 64 bits (64-bit kernels).
1N/A * XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits (N32 and 64-bit kernels).
1N/A *
1N/A * Expect these to be set from klocaldefs, or from the machine-type
1N/A * defs files for the normal case.
1N/A */
1N/A
1N/A#define XFS_BIG_FILES 1
1N/A#define XFS_BIG_FILESYSTEMS 1
1N/A
1N/Atypedef uint32_t xfs_agblock_t; /* blockno in alloc. group */
1N/Atypedef uint32_t xfs_extlen_t; /* extent length in blocks */
1N/Atypedef uint32_t xfs_agnumber_t; /* allocation group number */
1N/Atypedef int32_t xfs_extnum_t; /* # of extents in a file */
1N/Atypedef int16_t xfs_aextnum_t; /* # extents in an attribute fork */
1N/Atypedef int64_t xfs_fsize_t; /* bytes in a file */
1N/Atypedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
1N/A
1N/Atypedef int32_t xfs_suminfo_t; /* type of bitmap summary info */
1N/Atypedef int32_t xfs_rtword_t; /* word type for bitmap manipulations */
1N/A
1N/Atypedef int64_t xfs_lsn_t; /* log sequence number */
1N/Atypedef int32_t xfs_tid_t; /* transaction identifier */
1N/A
1N/Atypedef uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
1N/Atypedef uint32_t xfs_dahash_t; /* dir/attr hash value */
1N/A
1N/Atypedef uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */
1N/A
1N/A/*
1N/A * These types are 64 bits on disk but are either 32 or 64 bits in memory.
1N/A * Disk based types:
1N/A */
1N/Atypedef uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
1N/Atypedef uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
1N/Atypedef uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
1N/Atypedef uint64_t xfs_dfiloff_t; /* block number in a file */
1N/Atypedef uint64_t xfs_dfilblks_t; /* number of blocks in a file */
1N/A
1N/A/*
1N/A * Memory based types are conditional.
1N/A */
1N/A#if XFS_BIG_FILESYSTEMS
1N/Atypedef uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
1N/Atypedef uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
1N/Atypedef uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
1N/Atypedef int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
1N/A#else
1N/Atypedef uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
1N/Atypedef uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
1N/Atypedef uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
1N/Atypedef int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
1N/A#endif
1N/A#if XFS_BIG_FILES
1N/Atypedef uint64_t xfs_fileoff_t; /* block number in a file */
1N/Atypedef int64_t xfs_sfiloff_t; /* signed block number in a file */
1N/Atypedef uint64_t xfs_filblks_t; /* number of blocks in a file */
1N/A#else
1N/Atypedef uint32_t xfs_fileoff_t; /* block number in a file */
1N/Atypedef int32_t xfs_sfiloff_t; /* signed block number in a file */
1N/Atypedef uint32_t xfs_filblks_t; /* number of blocks in a file */
1N/A#endif
1N/A
1N/Atypedef uint8_t xfs_arch_t; /* architecutre of an xfs fs */
1N/A
1N/A/*
1N/A * Null values for the types.
1N/A */
1N/A#define NULLDFSBNO ((xfs_dfsbno_t)-1)
1N/A#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
1N/A#define NULLDRTBNO ((xfs_drtbno_t)-1)
1N/A#define NULLDFILOFF ((xfs_dfiloff_t)-1)
1N/A
1N/A#define NULLFSBLOCK ((xfs_fsblock_t)-1)
1N/A#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
1N/A#define NULLRTBLOCK ((xfs_rtblock_t)-1)
1N/A#define NULLFILEOFF ((xfs_fileoff_t)-1)
1N/A
1N/A#define NULLAGBLOCK ((xfs_agblock_t)-1)
1N/A#define NULLAGNUMBER ((xfs_agnumber_t)-1)
1N/A#define NULLEXTNUM ((xfs_extnum_t)-1)
1N/A
1N/A#define NULLCOMMITLSN ((xfs_lsn_t)-1)
1N/A
1N/A/*
1N/A * Max values for extlen, extnum, aextnum.
1N/A */
1N/A#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
1N/A#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
1N/A#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
1N/A
1N/A/*
1N/A * MAXNAMELEN is the length (including the terminating null) of
1N/A * the longest permissible file (component) name.
1N/A */
1N/A#define MAXNAMELEN 256
1N/A
1N/Atypedef enum {
1N/A XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
1N/A} xfs_lookup_t;
1N/A
1N/Atypedef enum {
1N/A XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
1N/A XFS_BTNUM_MAX
1N/A} xfs_btnum_t;
1N/A
1N/A
1N/A#ifdef CONFIG_PROC_FS
1N/A/*
1N/A * XFS global statistics
1N/A */
1N/Astruct xfsstats {
1N/A# define XFSSTAT_END_EXTENT_ALLOC 4
1N/A uint32_t xs_allocx;
1N/A uint32_t xs_allocb;
1N/A uint32_t xs_freex;
1N/A uint32_t xs_freeb;
1N/A# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
1N/A uint32_t xs_abt_lookup;
1N/A uint32_t xs_abt_compare;
1N/A uint32_t xs_abt_insrec;
1N/A uint32_t xs_abt_delrec;
1N/A# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
1N/A uint32_t xs_blk_mapr;
1N/A uint32_t xs_blk_mapw;
1N/A uint32_t xs_blk_unmap;
1N/A uint32_t xs_add_exlist;
1N/A uint32_t xs_del_exlist;
1N/A uint32_t xs_look_exlist;
1N/A uint32_t xs_cmp_exlist;
1N/A# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
1N/A uint32_t xs_bmbt_lookup;
1N/A uint32_t xs_bmbt_compare;
1N/A uint32_t xs_bmbt_insrec;
1N/A uint32_t xs_bmbt_delrec;
1N/A# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
1N/A uint32_t xs_dir_lookup;
1N/A uint32_t xs_dir_create;
1N/A uint32_t xs_dir_remove;
1N/A uint32_t xs_dir_getdents;
1N/A# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
1N/A uint32_t xs_trans_sync;
1N/A uint32_t xs_trans_async;
1N/A uint32_t xs_trans_empty;
1N/A# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
1N/A uint32_t xs_ig_attempts;
1N/A uint32_t xs_ig_found;
1N/A uint32_t xs_ig_frecycle;
1N/A uint32_t xs_ig_missed;
1N/A uint32_t xs_ig_dup;
1N/A uint32_t xs_ig_reclaims;
1N/A uint32_t xs_ig_attrchg;
1N/A# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
1N/A uint32_t xs_log_writes;
1N/A uint32_t xs_log_blocks;
1N/A uint32_t xs_log_noiclogs;
1N/A uint32_t xs_log_force;
1N/A uint32_t xs_log_force_sleep;
1N/A# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
1N/A uint32_t xs_try_logspace;
1N/A uint32_t xs_sleep_logspace;
1N/A uint32_t xs_push_ail;
1N/A uint32_t xs_push_ail_success;
1N/A uint32_t xs_push_ail_pushbuf;
1N/A uint32_t xs_push_ail_pinned;
1N/A uint32_t xs_push_ail_locked;
1N/A uint32_t xs_push_ail_flushing;
1N/A uint32_t xs_push_ail_restarts;
1N/A uint32_t xs_push_ail_flush;
1N/A# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
1N/A uint32_t xs_xstrat_quick;
1N/A uint32_t xs_xstrat_split;
1N/A# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
1N/A uint32_t xs_write_calls;
1N/A uint32_t xs_read_calls;
1N/A# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
1N/A uint32_t xs_attr_get;
1N/A uint32_t xs_attr_set;
1N/A uint32_t xs_attr_remove;
1N/A uint32_t xs_attr_list;
1N/A# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
1N/A uint32_t xs_qm_dqreclaims;
1N/A uint32_t xs_qm_dqreclaim_misses;
1N/A uint32_t xs_qm_dquot_dups;
1N/A uint32_t xs_qm_dqcachemisses;
1N/A uint32_t xs_qm_dqcachehits;
1N/A uint32_t xs_qm_dqwants;
1N/A uint32_t xs_qm_dqshake_reclaims;
1N/A uint32_t xs_qm_dqinact_reclaims;
1N/A# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
1N/A uint32_t xs_iflush_count;
1N/A uint32_t xs_icluster_flushcnt;
1N/A uint32_t xs_icluster_flushinode;
1N/A# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
1N/A uint32_t vn_active; /* # vnodes not on free lists */
1N/A uint32_t vn_alloc; /* # times vn_alloc called */
1N/A uint32_t vn_get; /* # times vn_get called */
1N/A uint32_t vn_hold; /* # times vn_hold called */
1N/A uint32_t vn_rele; /* # times vn_rele called */
1N/A uint32_t vn_reclaim; /* # times vn_reclaim called */
1N/A uint32_t vn_remove; /* # times vn_remove called */
1N/A uint32_t vn_free; /* # times vn_free called */
1N/A struct xfsstats_xpc {
1N/A uint64_t xs_xstrat_bytes;
1N/A uint64_t xs_write_bytes;
1N/A uint64_t xs_read_bytes;
1N/A } xpc;
1N/A} xfsstats;
1N/A
1N/A# define XFS_STATS_INC(count) ( xfsstats.##count ++ )
1N/A# define XFS_STATS_DEC(count) ( xfsstats.##count -- )
1N/A# define XFS_STATS_ADD(count, inc) ( xfsstats.##count += (inc) )
1N/A# define XFS_STATS64_INC(count) ( xfsstats.xpc.##count ++ )
1N/A# define XFS_STATS64_ADD(count, inc) ( xfsstats.xpc.##count += (inc) )
1N/A#else /* !CONFIG_PROC_FS */
1N/A# define XFS_STATS_INC(count)
1N/A# define XFS_STATS_DEC(count)
1N/A# define XFS_STATS_ADD(count, inc)
1N/A# define XFS_STATS64_INC(count)
1N/A# define XFS_STATS64_ADD(count, inc)
1N/A#endif /* !CONFIG_PROC_FS */
1N/A
1N/A
1N/A#ifdef __KERNEL__
1N/A
1N/A/* juggle IRIX device numbers - still used in ondisk structures */
1N/A
1N/A#define IRIX_DEV_BITSMAJOR 14
1N/A#define IRIX_DEV_BITSMINOR 18
1N/A#define IRIX_DEV_MAXMAJ 0x1ff
1N/A#define IRIX_DEV_MAXMIN 0x3ffff
1N/A#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>IRIX_DEV_BITSMINOR) \
1N/A & IRIX_DEV_MAXMAJ))
1N/A#define IRIX_DEV_MINOR(dev) ((int)((dev)&IRIX_DEV_MAXMIN))
1N/A#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major)<<IRIX_DEV_BITSMINOR) \
1N/A | (minor&IRIX_DEV_MAXMIN)))
1N/A
1N/A#define IRIX_DEV_TO_KDEVT(dev) MKDEV(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
1N/A#define IRIX_DEV_TO_DEVT(dev) ((IRIX_DEV_MAJOR(dev)<<8)|IRIX_DEV_MINOR(dev))
1N/A
1N/A/* __psint_t is the same size as a pointer */
1N/A#if (BITS_PER_LONG == 32)
1N/Atypedef int32_t __psint_t;
1N/Atypedef uint32_t __psunsigned_t;
1N/A#elif (BITS_PER_LONG == 64)
1N/Atypedef int64_t __psint_t;
1N/Atypedef uint64_t __psunsigned_t;
1N/A#else
1N/A#error BITS_PER_LONG must be 32 or 64
1N/A#endif
1N/A
1N/A
1N/A/*
1N/A * struct for passing owner/requestor id
1N/A */
1N/Atypedef struct flid {
1N/A#ifdef CELL_CAPABLE
1N/A pid_t fl_pid;
1N/A sysid_t fl_sysid;
1N/A#endif
1N/A} flid_t;
1N/A
1N/A#endif /* __KERNEL__ */
1N/A
1N/A#endif /* !__XFS_TYPES_H */