diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.h')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.h | 350 |
1 files changed, 134 insertions, 216 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h index 3303cd6f4c00..1393993d61e9 100644 --- a/fs/xfs/xfs_dir2_leaf.h +++ b/fs/xfs/xfs_dir2_leaf.h | |||
@@ -1,41 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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. | ||
18 | * | ||
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. | ||
22 | * | ||
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
24 | * Mountain View, CA 94043, or: | ||
25 | * | ||
26 | * http://www.sgi.com | ||
27 | * | ||
28 | * For further information regarding this notice, see: | ||
29 | * | ||
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
31 | */ | 17 | */ |
32 | #ifndef __XFS_DIR2_LEAF_H__ | 18 | #ifndef __XFS_DIR2_LEAF_H__ |
33 | #define __XFS_DIR2_LEAF_H__ | 19 | #define __XFS_DIR2_LEAF_H__ |
34 | 20 | ||
35 | /* | ||
36 | * Directory version 2, leaf block structures. | ||
37 | */ | ||
38 | |||
39 | struct uio; | 21 | struct uio; |
40 | struct xfs_dabuf; | 22 | struct xfs_dabuf; |
41 | struct xfs_da_args; | 23 | struct xfs_da_args; |
@@ -44,10 +26,6 @@ struct xfs_mount; | |||
44 | struct xfs_trans; | 26 | struct xfs_trans; |
45 | 27 | ||
46 | /* | 28 | /* |
47 | * Constants. | ||
48 | */ | ||
49 | |||
50 | /* | ||
51 | * Offset of the leaf/node space. First block in this space | 29 | * Offset of the leaf/node space. First block in this space |
52 | * is the btree root. | 30 | * is the btree root. |
53 | */ | 31 | */ |
@@ -57,10 +35,6 @@ struct xfs_trans; | |||
57 | XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) | 35 | XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) |
58 | 36 | ||
59 | /* | 37 | /* |
60 | * Types. | ||
61 | */ | ||
62 | |||
63 | /* | ||
64 | * Offset in data space of a data entry. | 38 | * Offset in data space of a data entry. |
65 | */ | 39 | */ |
66 | typedef __uint32_t xfs_dir2_dataptr_t; | 40 | typedef __uint32_t xfs_dir2_dataptr_t; |
@@ -68,10 +42,6 @@ typedef __uint32_t xfs_dir2_dataptr_t; | |||
68 | #define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) | 42 | #define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) |
69 | 43 | ||
70 | /* | 44 | /* |
71 | * Structures. | ||
72 | */ | ||
73 | |||
74 | /* | ||
75 | * Leaf block header. | 45 | * Leaf block header. |
76 | */ | 46 | */ |
77 | typedef struct xfs_dir2_leaf_hdr { | 47 | typedef struct xfs_dir2_leaf_hdr { |
@@ -109,245 +79,193 @@ typedef struct xfs_dir2_leaf { | |||
109 | } xfs_dir2_leaf_t; | 79 | } xfs_dir2_leaf_t; |
110 | 80 | ||
111 | /* | 81 | /* |
112 | * Macros. | 82 | * DB blocks here are logical directory block numbers, not filesystem blocks. |
113 | * The DB blocks are logical directory block numbers, not filesystem blocks. | ||
114 | */ | 83 | */ |
115 | 84 | ||
116 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_MAX_LEAF_ENTS) | 85 | #define XFS_DIR2_MAX_LEAF_ENTS(mp) xfs_dir2_max_leaf_ents(mp) |
117 | int | 86 | static inline int xfs_dir2_max_leaf_ents(struct xfs_mount *mp) |
118 | xfs_dir2_max_leaf_ents(struct xfs_mount *mp); | 87 | { |
119 | #define XFS_DIR2_MAX_LEAF_ENTS(mp) \ | 88 | return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / |
120 | xfs_dir2_max_leaf_ents(mp) | 89 | (uint)sizeof(xfs_dir2_leaf_entry_t)); |
121 | #else | 90 | } |
122 | #define XFS_DIR2_MAX_LEAF_ENTS(mp) \ | ||
123 | ((int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / \ | ||
124 | (uint)sizeof(xfs_dir2_leaf_entry_t))) | ||
125 | #endif | ||
126 | 91 | ||
127 | /* | 92 | /* |
128 | * Get address of the bestcount field in the single-leaf block. | 93 | * Get address of the bestcount field in the single-leaf block. |
129 | */ | 94 | */ |
130 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_TAIL_P) | 95 | #define XFS_DIR2_LEAF_TAIL_P(mp,lp) xfs_dir2_leaf_tail_p(mp, lp) |
131 | xfs_dir2_leaf_tail_t * | 96 | static inline xfs_dir2_leaf_tail_t * |
132 | xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); | 97 | xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp) |
133 | #define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ | 98 | { |
134 | xfs_dir2_leaf_tail_p(mp, lp) | 99 | return (xfs_dir2_leaf_tail_t *) |
135 | #else | 100 | ((char *)(lp) + (mp)->m_dirblksize - |
136 | #define XFS_DIR2_LEAF_TAIL_P(mp,lp) \ | 101 | (uint)sizeof(xfs_dir2_leaf_tail_t)); |
137 | ((xfs_dir2_leaf_tail_t *)\ | 102 | } |
138 | ((char *)(lp) + (mp)->m_dirblksize - \ | ||
139 | (uint)sizeof(xfs_dir2_leaf_tail_t))) | ||
140 | #endif | ||
141 | 103 | ||
142 | /* | 104 | /* |
143 | * Get address of the bests array in the single-leaf block. | 105 | * Get address of the bests array in the single-leaf block. |
144 | */ | 106 | */ |
145 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P) | ||
146 | xfs_dir2_data_off_t * | ||
147 | xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp); | ||
148 | #define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) | 107 | #define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) |
149 | #else | 108 | static inline xfs_dir2_data_off_t * |
150 | #define XFS_DIR2_LEAF_BESTS_P(ltp) \ | 109 | xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp) |
151 | ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT)) | 110 | { |
152 | #endif | 111 | return (xfs_dir2_data_off_t *) |
112 | (ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT); | ||
113 | } | ||
153 | 114 | ||
154 | /* | 115 | /* |
155 | * Convert dataptr to byte in file space | 116 | * Convert dataptr to byte in file space |
156 | */ | 117 | */ |
157 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_BYTE) | ||
158 | xfs_dir2_off_t | ||
159 | xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); | ||
160 | #define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) | 118 | #define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp) |
161 | #else | 119 | static inline xfs_dir2_off_t |
162 | #define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \ | 120 | xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) |
163 | ((xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG) | 121 | { |
164 | #endif | 122 | return (xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG; |
123 | } | ||
165 | 124 | ||
166 | /* | 125 | /* |
167 | * Convert byte in file space to dataptr. It had better be aligned. | 126 | * Convert byte in file space to dataptr. It had better be aligned. |
168 | */ | 127 | */ |
169 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DATAPTR) | ||
170 | xfs_dir2_dataptr_t | ||
171 | xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by); | ||
172 | #define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) | 128 | #define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by) |
173 | #else | 129 | static inline xfs_dir2_dataptr_t |
174 | #define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \ | 130 | xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by) |
175 | ((xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG)) | 131 | { |
176 | #endif | 132 | return (xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG); |
133 | } | ||
134 | |||
135 | /* | ||
136 | * Convert byte in space to (DB) block | ||
137 | */ | ||
138 | #define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) | ||
139 | static inline xfs_dir2_db_t | ||
140 | xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by) | ||
141 | { | ||
142 | return (xfs_dir2_db_t)((by) >> \ | ||
143 | ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)); | ||
144 | } | ||
177 | 145 | ||
178 | /* | 146 | /* |
179 | * Convert dataptr to a block number | 147 | * Convert dataptr to a block number |
180 | */ | 148 | */ |
181 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_DB) | ||
182 | xfs_dir2_db_t | ||
183 | xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); | ||
184 | #define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) | 149 | #define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp) |
185 | #else | 150 | static inline xfs_dir2_db_t |
186 | #define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \ | 151 | xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) |
187 | XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) | 152 | { |
188 | #endif | 153 | return XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)); |
154 | } | ||
155 | |||
156 | /* | ||
157 | * Convert byte in space to offset in a block | ||
158 | */ | ||
159 | #define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by) | ||
160 | static inline xfs_dir2_data_aoff_t | ||
161 | xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by) | ||
162 | { | ||
163 | return (xfs_dir2_data_aoff_t)((by) & \ | ||
164 | ((1 << ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) - 1)); | ||
165 | } | ||
189 | 166 | ||
190 | /* | 167 | /* |
191 | * Convert dataptr to a byte offset in a block | 168 | * Convert dataptr to a byte offset in a block |
192 | */ | 169 | */ |
193 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_OFF) | ||
194 | xfs_dir2_data_aoff_t | ||
195 | xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp); | ||
196 | #define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) | 170 | #define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp) |
197 | #else | 171 | static inline xfs_dir2_data_aoff_t |
198 | #define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \ | 172 | xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp) |
199 | XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)) | 173 | { |
200 | #endif | 174 | return XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp)); |
175 | } | ||
201 | 176 | ||
202 | /* | 177 | /* |
203 | * Convert block and offset to byte in space | 178 | * Convert block and offset to byte in space |
204 | */ | 179 | */ |
205 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_BYTE) | ||
206 | xfs_dir2_off_t | ||
207 | xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, | ||
208 | xfs_dir2_data_aoff_t o); | ||
209 | #define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ | 180 | #define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ |
210 | xfs_dir2_db_off_to_byte(mp, db, o) | 181 | xfs_dir2_db_off_to_byte(mp, db, o) |
211 | #else | 182 | static inline xfs_dir2_off_t |
212 | #define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \ | 183 | xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db, |
213 | (((xfs_dir2_off_t)(db) << \ | 184 | xfs_dir2_data_aoff_t o) |
214 | ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o)) | 185 | { |
215 | #endif | 186 | return ((xfs_dir2_off_t)(db) << \ |
187 | ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o); | ||
188 | } | ||
216 | 189 | ||
217 | /* | 190 | /* |
218 | * Convert byte in space to (DB) block | 191 | * Convert block (DB) to block (dablk) |
219 | */ | 192 | */ |
220 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB) | 193 | #define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db) |
221 | xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by); | 194 | static inline xfs_dablk_t |
222 | #define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by) | 195 | xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db) |
223 | #else | 196 | { |
224 | #define XFS_DIR2_BYTE_TO_DB(mp,by) \ | 197 | return (xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog); |
225 | ((xfs_dir2_db_t)((by) >> \ | 198 | } |
226 | ((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog))) | ||
227 | #endif | ||
228 | 199 | ||
229 | /* | 200 | /* |
230 | * Convert byte in space to (DA) block | 201 | * Convert byte in space to (DA) block |
231 | */ | 202 | */ |
232 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA) | ||
233 | xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by); | ||
234 | #define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) | 203 | #define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by) |
235 | #else | 204 | static inline xfs_dablk_t |
236 | #define XFS_DIR2_BYTE_TO_DA(mp,by) \ | 205 | xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by) |
237 | XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)) | 206 | { |
238 | #endif | 207 | return XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by)); |
239 | 208 | } | |
240 | /* | ||
241 | * Convert byte in space to offset in a block | ||
242 | */ | ||
243 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_OFF) | ||
244 | xfs_dir2_data_aoff_t | ||
245 | xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by); | ||
246 | #define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by) | ||
247 | #else | ||
248 | #define XFS_DIR2_BYTE_TO_OFF(mp,by) \ | ||
249 | ((xfs_dir2_data_aoff_t)((by) & \ | ||
250 | ((1 << ((mp)->m_sb.sb_blocklog + \ | ||
251 | (mp)->m_sb.sb_dirblklog)) - 1))) | ||
252 | #endif | ||
253 | 209 | ||
254 | /* | 210 | /* |
255 | * Convert block and offset to dataptr | 211 | * Convert block and offset to dataptr |
256 | */ | 212 | */ |
257 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_OFF_TO_DATAPTR) | ||
258 | xfs_dir2_dataptr_t | ||
259 | xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, | ||
260 | xfs_dir2_data_aoff_t o); | ||
261 | #define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ | 213 | #define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ |
262 | xfs_dir2_db_off_to_dataptr(mp, db, o) | 214 | xfs_dir2_db_off_to_dataptr(mp, db, o) |
263 | #else | 215 | static inline xfs_dir2_dataptr_t |
264 | #define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \ | 216 | xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db, |
265 | XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)) | 217 | xfs_dir2_data_aoff_t o) |
266 | #endif | 218 | { |
267 | 219 | return XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o)); | |
268 | /* | 220 | } |
269 | * Convert block (DB) to block (dablk) | ||
270 | */ | ||
271 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_DA) | ||
272 | xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db); | ||
273 | #define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db) | ||
274 | #else | ||
275 | #define XFS_DIR2_DB_TO_DA(mp,db) \ | ||
276 | ((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog)) | ||
277 | #endif | ||
278 | 221 | ||
279 | /* | 222 | /* |
280 | * Convert block (dablk) to block (DB) | 223 | * Convert block (dablk) to block (DB) |
281 | */ | 224 | */ |
282 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_DB) | ||
283 | xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da); | ||
284 | #define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) | 225 | #define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da) |
285 | #else | 226 | static inline xfs_dir2_db_t |
286 | #define XFS_DIR2_DA_TO_DB(mp,da) \ | 227 | xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da) |
287 | ((xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog)) | 228 | { |
288 | #endif | 229 | return (xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog); |
230 | } | ||
289 | 231 | ||
290 | /* | 232 | /* |
291 | * Convert block (dablk) to byte offset in space | 233 | * Convert block (dablk) to byte offset in space |
292 | */ | 234 | */ |
293 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_BYTE) | ||
294 | xfs_dir2_off_t xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da); | ||
295 | #define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da) | 235 | #define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da) |
296 | #else | 236 | static inline xfs_dir2_off_t |
297 | #define XFS_DIR2_DA_TO_BYTE(mp,da) \ | 237 | xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da) |
298 | XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0) | 238 | { |
299 | #endif | 239 | return XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0); |
240 | } | ||
300 | 241 | ||
301 | /* | 242 | /* |
302 | * Function declarations. | 243 | * Function declarations. |
303 | */ | 244 | */ |
304 | 245 | extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args, | |
305 | extern int | 246 | struct xfs_dabuf *dbp); |
306 | xfs_dir2_block_to_leaf(struct xfs_da_args *args, struct xfs_dabuf *dbp); | 247 | extern int xfs_dir2_leaf_addname(struct xfs_da_args *args); |
307 | 248 | extern void xfs_dir2_leaf_compact(struct xfs_da_args *args, | |
308 | extern int | 249 | struct xfs_dabuf *bp); |
309 | xfs_dir2_leaf_addname(struct xfs_da_args *args); | 250 | extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, |
310 | 251 | int *lowstalep, int *highstalep, | |
311 | extern void | 252 | int *lowlogp, int *highlogp); |
312 | xfs_dir2_leaf_compact(struct xfs_da_args *args, struct xfs_dabuf *bp); | 253 | extern int xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, |
313 | 254 | struct uio *uio, int *eofp, | |
314 | extern void | 255 | struct xfs_dirent *dbp, xfs_dir2_put_t put); |
315 | xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, | 256 | extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, |
316 | int *lowstalep, int *highstalep, int *lowlogp, | 257 | struct xfs_dabuf **bpp, int magic); |
317 | int *highlogp); | 258 | extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp, |
318 | 259 | int first, int last); | |
319 | extern int | 260 | extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp, |
320 | xfs_dir2_leaf_getdents(struct xfs_trans *tp, struct xfs_inode *dp, | 261 | struct xfs_dabuf *bp); |
321 | struct uio *uio, int *eofp, struct xfs_dirent *dbp, | 262 | extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args); |
322 | xfs_dir2_put_t put); | 263 | extern int xfs_dir2_leaf_removename(struct xfs_da_args *args); |
323 | 264 | extern int xfs_dir2_leaf_replace(struct xfs_da_args *args); | |
324 | extern int | 265 | extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args, |
325 | xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, | 266 | struct xfs_dabuf *lbp); |
326 | struct xfs_dabuf **bpp, int magic); | 267 | extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args, |
327 | 268 | struct xfs_dabuf *lbp, xfs_dir2_db_t db); | |
328 | extern void | 269 | extern int xfs_dir2_node_to_leaf(struct xfs_da_state *state); |
329 | xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp, | ||
330 | int first, int last); | ||
331 | |||
332 | extern void | ||
333 | xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); | ||
334 | |||
335 | extern int | ||
336 | xfs_dir2_leaf_lookup(struct xfs_da_args *args); | ||
337 | |||
338 | extern int | ||
339 | xfs_dir2_leaf_removename(struct xfs_da_args *args); | ||
340 | |||
341 | extern int | ||
342 | xfs_dir2_leaf_replace(struct xfs_da_args *args); | ||
343 | |||
344 | extern int | ||
345 | xfs_dir2_leaf_search_hash(struct xfs_da_args *args, | ||
346 | struct xfs_dabuf *lbp); | ||
347 | extern int | ||
348 | xfs_dir2_leaf_trim_data(struct xfs_da_args *args, struct xfs_dabuf *lbp, xfs_dir2_db_t db); | ||
349 | |||
350 | extern int | ||
351 | xfs_dir2_node_to_leaf(struct xfs_da_state *state); | ||
352 | 270 | ||
353 | #endif /* __XFS_DIR2_LEAF_H__ */ | 271 | #endif /* __XFS_DIR2_LEAF_H__ */ |