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 __uint32_t prid_t; /* project ID */
59 typedef __uint32_t inst_t; /* an instruction */
61 typedef __s64 xfs_off_t; /* <file offset> type */
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;
66 typedef __u32 xfs_nlink_t;
68 /* __psint_t is the same size as a pointer */
69 #if (BITS_PER_LONG == 32)
70 typedef __int32_t __psint_t;
71 typedef __uint32_t __psunsigned_t;
72 #elif (BITS_PER_LONG == 64)
73 typedef __int64_t __psint_t;
74 typedef __uint64_t __psunsigned_t;
76 #error BITS_PER_LONG must be 32 or 64
79 #endif /* __KERNEL__ */
81 typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
82 typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
83 typedef __uint32_t xfs_agnumber_t; /* allocation group number */
84 typedef __int32_t xfs_extnum_t; /* # of extents in a file */
85 typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
86 typedef __int64_t xfs_fsize_t; /* bytes in a file */
87 typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
89 typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
90 typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
92 typedef __int64_t xfs_lsn_t; /* log sequence number */
93 typedef __int32_t xfs_tid_t; /* transaction identifier */
95 typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
96 typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
98 typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */
101 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
104 typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
105 typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
106 typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
107 typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
108 typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
111 * Memory based types are conditional.
114 typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
115 typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
116 typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
117 typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
119 typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
120 typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
121 typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
122 typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
124 typedef __uint64_t xfs_fileoff_t; /* block number in a file */
125 typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
126 typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
128 typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
131 * Null values for the types.
133 #define NULLDFSBNO ((xfs_dfsbno_t)-1)
134 #define NULLDRFSBNO ((xfs_drfsbno_t)-1)
135 #define NULLDRTBNO ((xfs_drtbno_t)-1)
136 #define NULLDFILOFF ((xfs_dfiloff_t)-1)
138 #define NULLFSBLOCK ((xfs_fsblock_t)-1)
139 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
140 #define NULLRTBLOCK ((xfs_rtblock_t)-1)
141 #define NULLFILEOFF ((xfs_fileoff_t)-1)
143 #define NULLAGBLOCK ((xfs_agblock_t)-1)
144 #define NULLAGNUMBER ((xfs_agnumber_t)-1)
145 #define NULLEXTNUM ((xfs_extnum_t)-1)
147 #define NULLCOMMITLSN ((xfs_lsn_t)-1)
150 * Max values for extlen, extnum, aextnum.
152 #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
153 #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
154 #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
157 * MAXNAMELEN is the length (including the terminating null) of
158 * the longest permissible file (component) name.
160 #define MAXNAMELEN 256
162 typedef struct xfs_dirent { /* data from readdir() */
163 xfs_ino_t d_ino; /* inode number of entry */
164 xfs_off_t d_off; /* offset of disk directory entry */
165 unsigned short d_reclen; /* length of this record */
166 char d_name[1]; /* name of file */
169 #define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
170 #define DIRENTSIZE(namelen) \
171 ((DIRENTBASESIZE + (namelen) + \
172 sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
175 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
179 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
183 #endif /* __XFS_TYPES_H__ */