Linux 3.16-rc2
[linux/fpc-iii.git] / fs / xfs / xfs_types.h
blob65c6e6650b1a5e86f586d7bbbc7b352758dd842b
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef __XFS_TYPES_H__
19 #define __XFS_TYPES_H__
21 typedef __uint32_t prid_t; /* project ID */
23 typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
24 typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */
25 typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
26 typedef __uint32_t xfs_agnumber_t; /* allocation group number */
27 typedef __int32_t xfs_extnum_t; /* # of extents in a file */
28 typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
29 typedef __int64_t xfs_fsize_t; /* bytes in a file */
30 typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
32 typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
33 typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
35 typedef __int64_t xfs_lsn_t; /* log sequence number */
36 typedef __int32_t xfs_tid_t; /* transaction identifier */
38 typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
39 typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
42 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
43 * Disk based types:
45 typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
46 typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
47 typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
48 typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
49 typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
52 * Memory based types are conditional.
54 #if XFS_BIG_BLKNOS
55 typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
56 typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
57 typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
58 typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
59 #else
60 typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
61 typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
62 typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
63 typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
64 #endif
65 typedef __uint64_t xfs_fileoff_t; /* block number in a file */
66 typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
67 typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
71 * Null values for the types.
73 #define NULLDFSBNO ((xfs_dfsbno_t)-1)
74 #define NULLDRFSBNO ((xfs_drfsbno_t)-1)
75 #define NULLDRTBNO ((xfs_drtbno_t)-1)
76 #define NULLDFILOFF ((xfs_dfiloff_t)-1)
78 #define NULLFSBLOCK ((xfs_fsblock_t)-1)
79 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
80 #define NULLRTBLOCK ((xfs_rtblock_t)-1)
81 #define NULLFILEOFF ((xfs_fileoff_t)-1)
83 #define NULLAGBLOCK ((xfs_agblock_t)-1)
84 #define NULLAGNUMBER ((xfs_agnumber_t)-1)
85 #define NULLEXTNUM ((xfs_extnum_t)-1)
87 #define NULLCOMMITLSN ((xfs_lsn_t)-1)
89 #define NULLFSINO ((xfs_ino_t)-1)
90 #define NULLAGINO ((xfs_agino_t)-1)
93 * Max values for extlen, extnum, aextnum.
95 #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
96 #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
97 #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
100 * Minimum and maximum blocksize and sectorsize.
101 * The blocksize upper limit is pretty much arbitrary.
102 * The sectorsize upper limit is due to sizeof(sb_sectsize).
104 #define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
105 #define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
106 #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
107 #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
108 #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
109 #define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
110 #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
111 #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
114 * Inode fork identifiers.
116 #define XFS_DATA_FORK 0
117 #define XFS_ATTR_FORK 1
120 * Min numbers of data/attr fork btree root pointers.
122 #define MINDBTPTRS 3
123 #define MINABTPTRS 2
126 * MAXNAMELEN is the length (including the terminating null) of
127 * the longest permissible file (component) name.
129 #define MAXNAMELEN 256
131 typedef enum {
132 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
133 } xfs_lookup_t;
135 typedef enum {
136 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
137 XFS_BTNUM_FINOi, XFS_BTNUM_MAX
138 } xfs_btnum_t;
140 struct xfs_name {
141 const unsigned char *name;
142 int len;
143 int type;
147 * uid_t and gid_t are hard-coded to 32 bits in the inode.
148 * Hence, an 'id' in a dquot is 32 bits..
150 typedef __uint32_t xfs_dqid_t;
153 * Constants for bit manipulations.
155 #define XFS_NBBYLOG 3 /* log2(NBBY) */
156 #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */
157 #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
158 #define XFS_NBWORD (1 << XFS_NBWORDLOG)
159 #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
162 #endif /* __XFS_TYPES_H__ */