1
2
3
4
5
6 #ifndef __XFS_TYPES_H__
7 #define __XFS_TYPES_H__
8
9 typedef uint32_t prid_t;
10
11 typedef uint32_t xfs_agblock_t;
12 typedef uint32_t xfs_agino_t;
13 typedef uint32_t xfs_extlen_t;
14 typedef uint32_t xfs_agnumber_t;
15 typedef int32_t xfs_extnum_t;
16 typedef int16_t xfs_aextnum_t;
17 typedef int64_t xfs_fsize_t;
18 typedef uint64_t xfs_ufsize_t;
19
20 typedef int32_t xfs_suminfo_t;
21 typedef uint32_t xfs_rtword_t;
22
23 typedef int64_t xfs_lsn_t;
24 typedef int32_t xfs_tid_t;
25
26 typedef uint32_t xfs_dablk_t;
27 typedef uint32_t xfs_dahash_t;
28
29 typedef uint64_t xfs_fsblock_t;
30 typedef uint64_t xfs_rfsblock_t;
31 typedef uint64_t xfs_rtblock_t;
32 typedef uint64_t xfs_fileoff_t;
33 typedef uint64_t xfs_filblks_t;
34
35 typedef int64_t xfs_srtblock_t;
36 typedef int64_t xfs_sfiloff_t;
37
38
39
40
41
42 typedef void * xfs_failaddr_t;
43
44
45
46
47 #define NULLFSBLOCK ((xfs_fsblock_t)-1)
48 #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
49 #define NULLRTBLOCK ((xfs_rtblock_t)-1)
50 #define NULLFILEOFF ((xfs_fileoff_t)-1)
51
52 #define NULLAGBLOCK ((xfs_agblock_t)-1)
53 #define NULLAGNUMBER ((xfs_agnumber_t)-1)
54
55 #define NULLCOMMITLSN ((xfs_lsn_t)-1)
56
57 #define NULLFSINO ((xfs_ino_t)-1)
58 #define NULLAGINO ((xfs_agino_t)-1)
59
60
61
62
63 #define MAXEXTLEN ((xfs_extlen_t)0x001fffff)
64 #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff)
65 #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff)
66
67
68
69
70
71
72
73
74 #define XFS_MIN_BLOCKSIZE_LOG 9
75 #define XFS_MAX_BLOCKSIZE_LOG 16
76 #define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
77 #define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
78 #define XFS_MIN_CRC_BLOCKSIZE (1 << (XFS_MIN_BLOCKSIZE_LOG + 1))
79 #define XFS_MIN_SECTORSIZE_LOG 9
80 #define XFS_MAX_SECTORSIZE_LOG 15
81 #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
82 #define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
83
84
85
86
87 #define XFS_DATA_FORK 0
88 #define XFS_ATTR_FORK 1
89 #define XFS_COW_FORK 2
90
91
92
93
94 #define MINDBTPTRS 3
95 #define MINABTPTRS 2
96
97
98
99
100
101 #define MAXNAMELEN 256
102
103
104
105
106
107 typedef enum {
108 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
109 } xfs_lookup_t;
110
111 #define XFS_AG_BTREE_CMP_FORMAT_STR \
112 { XFS_LOOKUP_EQi, "eq" }, \
113 { XFS_LOOKUP_LEi, "le" }, \
114 { XFS_LOOKUP_GEi, "ge" }
115
116
117
118
119
120 typedef enum {
121 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_RMAPi, XFS_BTNUM_BMAPi,
122 XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_MAX
123 } xfs_btnum_t;
124
125 #define XFS_BTNUM_STRINGS \
126 { XFS_BTNUM_BNOi, "bnobt" }, \
127 { XFS_BTNUM_CNTi, "cntbt" }, \
128 { XFS_BTNUM_RMAPi, "rmapbt" }, \
129 { XFS_BTNUM_BMAPi, "bmbt" }, \
130 { XFS_BTNUM_INOi, "inobt" }, \
131 { XFS_BTNUM_FINOi, "finobt" }, \
132 { XFS_BTNUM_REFCi, "refcbt" }
133
134 struct xfs_name {
135 const unsigned char *name;
136 int len;
137 int type;
138 };
139
140
141
142
143
144 typedef uint32_t xfs_dqid_t;
145
146
147
148
149 #define XFS_NBBYLOG 3
150 #define XFS_WORDLOG 2
151 #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
152 #define XFS_NBWORD (1 << XFS_NBWORDLOG)
153 #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
154
155 struct xfs_iext_cursor {
156 struct xfs_iext_leaf *leaf;
157 int pos;
158 };
159
160 typedef enum {
161 XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
162 } xfs_exntst_t;
163
164 typedef struct xfs_bmbt_irec
165 {
166 xfs_fileoff_t br_startoff;
167 xfs_fsblock_t br_startblock;
168 xfs_filblks_t br_blockcount;
169 xfs_exntst_t br_state;
170 } xfs_bmbt_irec_t;
171
172
173 enum xfs_ag_resv_type {
174 XFS_AG_RESV_NONE = 0,
175 XFS_AG_RESV_AGFL,
176 XFS_AG_RESV_METADATA,
177 XFS_AG_RESV_RMAPBT,
178 };
179
180
181
182
183 struct xfs_mount;
184
185 xfs_agblock_t xfs_ag_block_count(struct xfs_mount *mp, xfs_agnumber_t agno);
186 bool xfs_verify_agbno(struct xfs_mount *mp, xfs_agnumber_t agno,
187 xfs_agblock_t agbno);
188 bool xfs_verify_fsbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
189
190 void xfs_agino_range(struct xfs_mount *mp, xfs_agnumber_t agno,
191 xfs_agino_t *first, xfs_agino_t *last);
192 bool xfs_verify_agino(struct xfs_mount *mp, xfs_agnumber_t agno,
193 xfs_agino_t agino);
194 bool xfs_verify_agino_or_null(struct xfs_mount *mp, xfs_agnumber_t agno,
195 xfs_agino_t agino);
196 bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino);
197 bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino);
198 bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino);
199 bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
200 bool xfs_verify_icount(struct xfs_mount *mp, unsigned long long icount);
201 bool xfs_verify_dablk(struct xfs_mount *mp, xfs_fileoff_t off);
202 void xfs_icount_range(struct xfs_mount *mp, unsigned long long *min,
203 unsigned long long *max);
204
205 #endif