1
2
3
4
5
6#ifndef __XFS_TYPES_H__
7#define __XFS_TYPES_H__
8
9typedef uint32_t prid_t;
10
11typedef uint32_t xfs_agblock_t;
12typedef uint32_t xfs_agino_t;
13typedef uint32_t xfs_extlen_t;
14typedef uint32_t xfs_agnumber_t;
15typedef int32_t xfs_extnum_t;
16typedef int16_t xfs_aextnum_t;
17typedef int64_t xfs_fsize_t;
18typedef uint64_t xfs_ufsize_t;
19
20typedef int32_t xfs_suminfo_t;
21typedef uint32_t xfs_rtword_t;
22
23typedef int64_t xfs_lsn_t;
24typedef int32_t xfs_tid_t;
25
26typedef uint32_t xfs_dablk_t;
27typedef uint32_t xfs_dahash_t;
28
29typedef uint64_t xfs_fsblock_t;
30typedef uint64_t xfs_rfsblock_t;
31typedef uint64_t xfs_rtblock_t;
32typedef uint64_t xfs_fileoff_t;
33typedef uint64_t xfs_filblks_t;
34
35typedef int64_t xfs_srtblock_t;
36typedef int64_t xfs_sfiloff_t;
37
38
39
40
41
42typedef 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
103typedef enum {
104 XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
105} xfs_lookup_t;
106
107typedef enum {
108 XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_RMAPi, XFS_BTNUM_BMAPi,
109 XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_MAX
110} xfs_btnum_t;
111
112struct xfs_name {
113 const unsigned char *name;
114 int len;
115 int type;
116};
117
118
119
120
121
122typedef uint32_t xfs_dqid_t;
123
124
125
126
127#define XFS_NBBYLOG 3
128#define XFS_WORDLOG 2
129#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
130#define XFS_NBWORD (1 << XFS_NBWORDLOG)
131#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
132
133struct xfs_iext_cursor {
134 struct xfs_iext_leaf *leaf;
135 int pos;
136};
137
138typedef enum {
139 XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
140} xfs_exntst_t;
141
142typedef struct xfs_bmbt_irec
143{
144 xfs_fileoff_t br_startoff;
145 xfs_fsblock_t br_startblock;
146 xfs_filblks_t br_blockcount;
147 xfs_exntst_t br_state;
148} xfs_bmbt_irec_t;
149
150
151
152
153struct xfs_mount;
154
155xfs_agblock_t xfs_ag_block_count(struct xfs_mount *mp, xfs_agnumber_t agno);
156bool xfs_verify_agbno(struct xfs_mount *mp, xfs_agnumber_t agno,
157 xfs_agblock_t agbno);
158bool xfs_verify_fsbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
159
160void xfs_agino_range(struct xfs_mount *mp, xfs_agnumber_t agno,
161 xfs_agino_t *first, xfs_agino_t *last);
162bool xfs_verify_agino(struct xfs_mount *mp, xfs_agnumber_t agno,
163 xfs_agino_t agino);
164bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino);
165bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino);
166bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino);
167bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
168bool xfs_verify_icount(struct xfs_mount *mp, unsigned long long icount);
169
170#endif
171