2 * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #ifndef __XFS_TYPES_H__
33 #define __XFS_TYPES_H__
40 typedef unsigned char uchar_t
;
41 typedef unsigned short ushort_t
;
42 typedef unsigned int uint_t
;
43 typedef unsigned long ulong_t
;
46 * Additional type declarations for XFS
48 typedef signed char __int8_t
;
49 typedef unsigned char __uint8_t
;
50 typedef signed short int __int16_t
;
51 typedef unsigned short int __uint16_t
;
52 typedef signed int __int32_t
;
53 typedef unsigned int __uint32_t
;
54 typedef signed long long int __int64_t
;
55 typedef unsigned long long int __uint64_t
;
57 typedef enum { B_FALSE
,B_TRUE
} boolean_t
;
58 typedef __int64_t prid_t
; /* project ID */
59 typedef __uint32_t inst_t
; /* an instruction */
61 typedef __u64 xfs_off_t
;
62 typedef __u64 xfs_ino_t
; /* <inode> type */
63 typedef __s64 xfs_daddr_t
; /* <disk address> type */
64 typedef char * xfs_caddr_t
; /* <core address> type */
65 typedef __u32 xfs_dev_t
;
67 /* __psint_t is the same size as a pointer */
68 #if (BITS_PER_LONG == 32)
69 typedef __int32_t __psint_t
;
70 typedef __uint32_t __psunsigned_t
;
71 #elif (BITS_PER_LONG == 64)
72 typedef __int64_t __psint_t
;
73 typedef __uint64_t __psunsigned_t
;
75 #error BITS_PER_LONG must be 32 or 64
78 #endif /* __KERNEL__ */
81 * Some types are conditional based on the selected configuration.
82 * Set XFS_BIG_FILESYSTEMS=1 or 0 depending on the desired configuration.
83 * XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits
85 * On linux right now we are limited to 2^32 512 byte blocks in a
86 * filesystem, Once this limit is changed, setting this to 1
87 * will allow XFS to go larger. With BIG_FILESYSTEMS set to 0
88 * a 4K block filesystem could still theoretically be 16Gbytes
89 * long, so on an ia32 box the 32 bit page index will then be
90 * the limiting factor.
93 #if defined(CONFIG_LBD) || (defined(HAVE_SECTOR_T) && (BITS_PER_LONG == 64))
94 # ifndef XFS_BIG_FILESYSTEMS
95 # define XFS_BIG_FILESYSTEMS 1
98 # ifndef XFS_BIG_FILESYSTEMS
99 # define XFS_BIG_FILESYSTEMS 0
103 typedef __uint32_t xfs_agblock_t
; /* blockno in alloc. group */
104 typedef __uint32_t xfs_extlen_t
; /* extent length in blocks */
105 typedef __uint32_t xfs_agnumber_t
; /* allocation group number */
106 typedef __int32_t xfs_extnum_t
; /* # of extents in a file */
107 typedef __int16_t xfs_aextnum_t
; /* # extents in an attribute fork */
108 typedef __int64_t xfs_fsize_t
; /* bytes in a file */
109 typedef __uint64_t xfs_ufsize_t
; /* unsigned bytes in a file */
111 typedef __int32_t xfs_suminfo_t
; /* type of bitmap summary info */
112 typedef __int32_t xfs_rtword_t
; /* word type for bitmap manipulations */
114 typedef __int64_t xfs_lsn_t
; /* log sequence number */
115 typedef __int32_t xfs_tid_t
; /* transaction identifier */
117 typedef __uint32_t xfs_dablk_t
; /* dir/attr block number (in file) */
118 typedef __uint32_t xfs_dahash_t
; /* dir/attr hash value */
120 typedef __uint16_t xfs_prid_t
; /* prid_t truncated to 16bits in XFS */
123 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
126 typedef __uint64_t xfs_dfsbno_t
; /* blockno in filesystem (agno|agbno) */
127 typedef __uint64_t xfs_drfsbno_t
; /* blockno in filesystem (raw) */
128 typedef __uint64_t xfs_drtbno_t
; /* extent (block) in realtime area */
129 typedef __uint64_t xfs_dfiloff_t
; /* block number in a file */
130 typedef __uint64_t xfs_dfilblks_t
; /* number of blocks in a file */
133 * Memory based types are conditional.
135 #if XFS_BIG_FILESYSTEMS
136 typedef __uint64_t xfs_fsblock_t
; /* blockno in filesystem (agno|agbno) */
137 typedef __uint64_t xfs_rfsblock_t
; /* blockno in filesystem (raw) */
138 typedef __uint64_t xfs_rtblock_t
; /* extent (block) in realtime area */
139 typedef __int64_t xfs_srtblock_t
; /* signed version of xfs_rtblock_t */
141 typedef __uint32_t xfs_fsblock_t
; /* blockno in filesystem (agno|agbno) */
142 typedef __uint32_t xfs_rfsblock_t
; /* blockno in filesystem (raw) */
143 typedef __uint32_t xfs_rtblock_t
; /* extent (block) in realtime area */
144 typedef __int32_t xfs_srtblock_t
; /* signed version of xfs_rtblock_t */
146 typedef __uint64_t xfs_fileoff_t
; /* block number in a file */
147 typedef __int64_t xfs_sfiloff_t
; /* signed block number in a file */
148 typedef __uint64_t xfs_filblks_t
; /* number of blocks in a file */
150 typedef __uint8_t xfs_arch_t
; /* architecture of an xfs fs */
153 * Null values for the types.
155 #define NULLDFSBNO ((xfs_dfsbno_t)-1)
156 #define NULLDRFSBNO ((xfs_drfsbno_t)-1)
157 #define NULLDRTBNO ((xfs_drtbno_t)-1)
158 #define NULLDFILOFF ((xfs_dfiloff_t)-1)
160 #define NULLFSBLOCK ((xfs_fsblock_t)-1)
161 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
162 #define NULLRTBLOCK ((xfs_rtblock_t)-1)
163 #define NULLFILEOFF ((xfs_fileoff_t)-1)
165 #define NULLAGBLOCK ((xfs_agblock_t)-1)
166 #define NULLAGNUMBER ((xfs_agnumber_t)-1)
167 #define NULLEXTNUM ((xfs_extnum_t)-1)
169 #define NULLCOMMITLSN ((xfs_lsn_t)-1)
172 * Max values for extlen, extnum, aextnum.
174 #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
175 #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
176 #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
179 * MAXNAMELEN is the length (including the terminating null) of
180 * the longest permissible file (component) name.
182 #define MAXNAMELEN 256
184 typedef struct xfs_dirent
{ /* data from readdir() */
185 xfs_ino_t d_ino
; /* inode number of entry */
186 xfs_off_t d_off
; /* offset of disk directory entry */
187 unsigned short d_reclen
; /* length of this record */
188 char d_name
[1]; /* name of file */
191 #define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
192 #define DIRENTSIZE(namelen) \
193 ((DIRENTBASESIZE + (namelen) + \
194 sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
197 XFS_LOOKUP_EQi
, XFS_LOOKUP_LEi
, XFS_LOOKUP_GEi
201 XFS_BTNUM_BNOi
, XFS_BTNUM_CNTi
, XFS_BTNUM_BMAPi
, XFS_BTNUM_INOi
,
207 * Juggle IRIX device numbers - still used in ondisk structures
209 #define XFS_DEV_BITSMAJOR 14
210 #define XFS_DEV_BITSMINOR 18
211 #define XFS_DEV_MAXMAJ 0x1ff
212 #define XFS_DEV_MAXMIN 0x3ffff
213 #define XFS_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>XFS_DEV_BITSMINOR) \
215 #define XFS_DEV_MINOR(dev) ((int)((dev)&XFS_DEV_MAXMIN))
216 #define XFS_MKDEV(major,minor) ((xfs_dev_t)(((major)<<XFS_DEV_BITSMINOR) \
217 | (minor&XFS_DEV_MAXMIN)))
219 #define XFS_DEV_TO_KDEVT(dev) mk_kdev(XFS_DEV_MAJOR(dev),XFS_DEV_MINOR(dev))
221 #endif /* !__XFS_TYPES_H */