]> Pileus Git - ~andy/linux/blob - fs/xfs/xfs_types.h
Linux 3.14
[~andy/linux] / fs / xfs / xfs_types.h
1 /*
2  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
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.
8  *
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.
13  *
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
17  */
18 #ifndef __XFS_TYPES_H__
19 #define __XFS_TYPES_H__
20
21 typedef __uint32_t      prid_t;         /* project ID */
22
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 */
31
32 typedef __int32_t       xfs_suminfo_t;  /* type of bitmap summary info */
33 typedef __int32_t       xfs_rtword_t;   /* word type for bitmap manipulations */
34
35 typedef __int64_t       xfs_lsn_t;      /* log sequence number */
36 typedef __int32_t       xfs_tid_t;      /* transaction identifier */
37
38 typedef __uint32_t      xfs_dablk_t;    /* dir/attr block number (in file) */
39 typedef __uint32_t      xfs_dahash_t;   /* dir/attr hash value */
40
41 /*
42  * These types are 64 bits on disk but are either 32 or 64 bits in memory.
43  * Disk based types:
44  */
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 */
50
51 /*
52  * Memory based types are conditional.
53  */
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 */
68
69
70 /*
71  * Null values for the types.
72  */
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)
77
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)
82
83 #define NULLAGBLOCK     ((xfs_agblock_t)-1)
84 #define NULLAGNUMBER    ((xfs_agnumber_t)-1)
85 #define NULLEXTNUM      ((xfs_extnum_t)-1)
86
87 #define NULLCOMMITLSN   ((xfs_lsn_t)-1)
88
89 #define NULLFSINO       ((xfs_ino_t)-1)
90 #define NULLAGINO       ((xfs_agino_t)-1)
91
92 /*
93  * Max values for extlen, extnum, aextnum.
94  */
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 */
98
99 /*
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).
103  */
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)
112
113 /*
114  * Inode fork identifiers.
115  */
116 #define XFS_DATA_FORK   0
117 #define XFS_ATTR_FORK   1
118
119 /*
120  * Min numbers of data/attr fork btree root pointers.
121  */
122 #define MINDBTPTRS      3
123 #define MINABTPTRS      2
124
125 /*
126  * MAXNAMELEN is the length (including the terminating null) of
127  * the longest permissible file (component) name.
128  */
129 #define MAXNAMELEN      256
130
131 typedef enum {
132         XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
133 } xfs_lookup_t;
134
135 typedef enum {
136         XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
137         XFS_BTNUM_MAX
138 } xfs_btnum_t;
139
140 struct xfs_name {
141         const unsigned char     *name;
142         int                     len;
143         int                     type;
144 };
145
146 /*
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..
149  */
150 typedef __uint32_t      xfs_dqid_t;
151
152 /*
153  * Constants for bit manipulations.
154  */
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)
160
161
162 #endif  /* __XFS_TYPES_H__ */