/src/e2fsprogs/lib/ext2fs/bitops.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * bitops.h --- Bitmap frobbing code. The byte swapping routines are |
3 | | * also included here. |
4 | | * |
5 | | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
6 | | * |
7 | | * %Begin-Header% |
8 | | * This file may be redistributed under the terms of the GNU Library |
9 | | * General Public License, version 2. |
10 | | * %End-Header% |
11 | | */ |
12 | | |
13 | | #ifdef WORDS_BIGENDIAN |
14 | | #define ext2fs_cpu_to_le64(x) ((__force __le64)ext2fs_swab64((__u64)(x))) |
15 | | #define ext2fs_le64_to_cpu(x) ext2fs_swab64((__force __u64)(__le64)(x)) |
16 | | #define ext2fs_cpu_to_le32(x) ((__force __le32)ext2fs_swab32((__u32)(x))) |
17 | | #define ext2fs_le32_to_cpu(x) ext2fs_swab32((__force __u32)(__le32)(x)) |
18 | | #define ext2fs_cpu_to_le16(x) ((__force __le16)ext2fs_swab16((__u16)(x))) |
19 | | #define ext2fs_le16_to_cpu(x) ext2fs_swab16((__force __u16)(__le16)(x)) |
20 | | |
21 | | #define ext2fs_cpu_to_be64(x) ((__force __be64)(__u64)(x)) |
22 | | #define ext2fs_be64_to_cpu(x) ((__force __u64)(__be64)(x)) |
23 | | #define ext2fs_cpu_to_be32(x) ((__force __be32)(__u32)(x)) |
24 | | #define ext2fs_be32_to_cpu(x) ((__force __u32)(__be32)(x)) |
25 | | #define ext2fs_cpu_to_be16(x) ((__force __be16)(__u16)(x)) |
26 | | #define ext2fs_be16_to_cpu(x) ((__force __u16)(__be16)(x)) |
27 | | #else |
28 | 0 | #define ext2fs_cpu_to_le64(x) ((__force __le64)(__u64)(x)) |
29 | | #define ext2fs_le64_to_cpu(x) ((__force __u64)(__le64)(x)) |
30 | 0 | #define ext2fs_cpu_to_le32(x) ((__force __le32)(__u32)(x)) |
31 | 0 | #define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x)) |
32 | 0 | #define ext2fs_cpu_to_le16(x) ((__force __le16)(__u16)(x)) |
33 | 0 | #define ext2fs_le16_to_cpu(x) ((__force __u16)(__le16)(x)) |
34 | | |
35 | | #define ext2fs_cpu_to_be64(x) ((__force __be64)ext2fs_swab64((__u64)(x))) |
36 | | #define ext2fs_be64_to_cpu(x) ext2fs_swab64((__force __u64)(__be64)(x)) |
37 | 0 | #define ext2fs_cpu_to_be32(x) ((__force __be32)ext2fs_swab32((__u32)(x))) |
38 | 0 | #define ext2fs_be32_to_cpu(x) ext2fs_swab32((__force __u32)(__be32)(x)) |
39 | | #define ext2fs_cpu_to_be16(x) ((__force __be16)ext2fs_swab16((__u16)(x))) |
40 | | #define ext2fs_be16_to_cpu(x) ext2fs_swab16((__force __u16)(__be16)(x)) |
41 | | #endif |
42 | | |
43 | | /* |
44 | | * EXT2FS bitmap manipulation routines. |
45 | | */ |
46 | | |
47 | | /* Support for sending warning messages from the inline subroutines */ |
48 | | extern const char *ext2fs_block_string; |
49 | | extern const char *ext2fs_inode_string; |
50 | | extern const char *ext2fs_mark_string; |
51 | | extern const char *ext2fs_unmark_string; |
52 | | extern const char *ext2fs_test_string; |
53 | | extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, |
54 | | const char *description); |
55 | | extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, |
56 | | int code, unsigned long arg); |
57 | | |
58 | | #ifdef NO_INLINE_FUNCS |
59 | | extern void ext2fs_fast_set_bit(unsigned int nr,void * addr); |
60 | | extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr); |
61 | | extern void ext2fs_fast_set_bit64(__u64 nr,void * addr); |
62 | | extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr); |
63 | | extern __u16 ext2fs_swab16(__u16 val); |
64 | | extern __u32 ext2fs_swab32(__u32 val); |
65 | | extern __u64 ext2fs_swab64(__u64 val); |
66 | | |
67 | | extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); |
68 | | extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
69 | | blk_t block); |
70 | | extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); |
71 | | |
72 | | extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); |
73 | | extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
74 | | ext2_ino_t inode); |
75 | | extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); |
76 | | |
77 | | extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, |
78 | | blk_t block); |
79 | | extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
80 | | blk_t block); |
81 | | extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, |
82 | | blk_t block); |
83 | | |
84 | | extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
85 | | ext2_ino_t inode); |
86 | | extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
87 | | ext2_ino_t inode); |
88 | | extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
89 | | ext2_ino_t inode); |
90 | | extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap); |
91 | | extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap); |
92 | | extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap); |
93 | | extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap); |
94 | | |
95 | | extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
96 | | blk_t block, int num); |
97 | | extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
98 | | blk_t block, int num); |
99 | | extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, |
100 | | blk_t block, int num); |
101 | | #endif |
102 | | |
103 | | /* These functions routines moved to gen_bitmap.c */ |
104 | | extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
105 | | blk_t block, int num); |
106 | | extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
107 | | blk_t block, int num); |
108 | | extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, |
109 | | blk_t block, int num); |
110 | | extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap, |
111 | | ext2_ino_t inode, int num); |
112 | | extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, |
113 | | __u32 bitno); |
114 | | extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, |
115 | | blk_t bitno); |
116 | | extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, |
117 | | blk_t bitno); |
118 | | extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, |
119 | | blk_t block, int num); |
120 | | extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map); |
121 | | extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap); |
122 | | extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); |
123 | | |
124 | | /* 64-bit versions */ |
125 | | |
126 | | #ifdef NO_INLINE_FUNCS |
127 | | extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, |
128 | | blk64_t block); |
129 | | extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, |
130 | | blk64_t block); |
131 | | extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, |
132 | | blk64_t block); |
133 | | |
134 | | extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
135 | | ext2_ino_t inode); |
136 | | extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
137 | | ext2_ino_t inode); |
138 | | extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
139 | | ext2_ino_t inode); |
140 | | |
141 | | extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, |
142 | | blk64_t block); |
143 | | extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, |
144 | | blk64_t block); |
145 | | extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, |
146 | | blk64_t block); |
147 | | |
148 | | extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
149 | | ext2_ino_t inode); |
150 | | extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
151 | | ext2_ino_t inode); |
152 | | extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
153 | | ext2_ino_t inode); |
154 | | extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, |
155 | | blk64_t start, |
156 | | blk64_t end, |
157 | | blk64_t *out); |
158 | | extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
159 | | ext2_ino_t start, |
160 | | ext2_ino_t end, |
161 | | ext2_ino_t *out); |
162 | | extern errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap, |
163 | | blk64_t start, |
164 | | blk64_t end, |
165 | | blk64_t *out); |
166 | | extern errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
167 | | ext2_ino_t start, |
168 | | ext2_ino_t end, |
169 | | ext2_ino_t *out); |
170 | | extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap); |
171 | | extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap); |
172 | | extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap); |
173 | | extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap); |
174 | | |
175 | | extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
176 | | blk64_t block, |
177 | | unsigned int num); |
178 | | extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
179 | | blk64_t block, |
180 | | unsigned int num); |
181 | | extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
182 | | blk64_t block, |
183 | | unsigned int num); |
184 | | #endif |
185 | | |
186 | | /* These routines moved to gen_bitmap64.c */ |
187 | | extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap); |
188 | | extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq, |
189 | | ext2fs_generic_bitmap bm1, |
190 | | ext2fs_generic_bitmap bm2); |
191 | | extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap); |
192 | | extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap, |
193 | | blk64_t bitno); |
194 | | extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap, |
195 | | blk64_t bitno); |
196 | | extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap, |
197 | | blk64_t bitno); |
198 | | extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
199 | | blk64_t block, unsigned int num); |
200 | | extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap); |
201 | | extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap); |
202 | | extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
203 | | blk64_t block, unsigned int num); |
204 | | extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
205 | | blk64_t block, unsigned int num); |
206 | | extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
207 | | blk64_t block, unsigned int num); |
208 | | extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap, |
209 | | __u64 start, __u64 end, |
210 | | __u64 *out); |
211 | | extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap, |
212 | | __u64 start, __u64 end, |
213 | | __u64 *out); |
214 | | |
215 | | /* |
216 | | * The inline routines themselves... |
217 | | * |
218 | | * If NO_INLINE_FUNCS is defined, then we won't try to do inline |
219 | | * functions at all; they will be included as normal functions in |
220 | | * inline.c |
221 | | */ |
222 | | |
223 | | #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) |
224 | | #ifdef INCLUDE_INLINE_FUNCS |
225 | | #if (__STDC_VERSION__ >= 199901L) |
226 | | #define _INLINE_ extern inline |
227 | | #else |
228 | | #define _INLINE_ inline |
229 | | #endif |
230 | | #else /* !INCLUDE_INLINE FUNCS */ |
231 | | #if (__STDC_VERSION__ >= 199901L) |
232 | | #define _INLINE_ inline |
233 | | #else /* not C99 */ |
234 | | #ifdef __GNUC__ |
235 | | #define _INLINE_ extern __inline__ |
236 | | #else /* For Watcom C */ |
237 | | #define _INLINE_ extern inline |
238 | | #endif /* __GNUC__ */ |
239 | | #endif /* __STDC_VERSION__ >= 199901L */ |
240 | | #endif /* INCLUDE_INLINE_FUNCS */ |
241 | | |
242 | | /* |
243 | | * Fast bit set/clear functions that doesn't need to return the |
244 | | * previous bit value. |
245 | | */ |
246 | | |
247 | | _INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr) |
248 | 3.06G | { |
249 | 3.06G | unsigned char *ADDR = (unsigned char *) addr; |
250 | | |
251 | 3.06G | ADDR += nr >> 3; |
252 | 3.06G | *ADDR |= (unsigned char) (1 << (nr & 0x07)); |
253 | 3.06G | } |
254 | | |
255 | | _INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr) |
256 | 0 | { |
257 | 0 | unsigned char *ADDR = (unsigned char *) addr; |
258 | |
|
259 | 0 | ADDR += nr >> 3; |
260 | 0 | *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); |
261 | 0 | } |
262 | | |
263 | | |
264 | | _INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr) |
265 | 0 | { |
266 | 0 | unsigned char *ADDR = (unsigned char *) addr; |
267 | |
|
268 | 0 | ADDR += nr >> 3; |
269 | 0 | *ADDR |= (unsigned char) (1 << (nr & 0x07)); |
270 | 0 | } |
271 | | |
272 | | _INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr) |
273 | 0 | { |
274 | 0 | unsigned char *ADDR = (unsigned char *) addr; |
275 | |
|
276 | 0 | ADDR += nr >> 3; |
277 | 0 | *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); |
278 | 0 | } |
279 | | |
280 | | _INLINE_ __u16 ext2fs_swab16(__u16 val) |
281 | 0 | { |
282 | 0 | return (val >> 8) | (__u16) (val << 8); |
283 | 0 | } |
284 | | |
285 | | _INLINE_ __u32 ext2fs_swab32(__u32 val) |
286 | 0 | { |
287 | 0 | return ((val>>24) | ((val>>8)&0xFF00) | |
288 | 0 | ((val<<8)&0xFF0000) | (val<<24)); |
289 | 0 | } |
290 | | |
291 | | _INLINE_ __u64 ext2fs_swab64(__u64 val) |
292 | 0 | { |
293 | 0 | return (ext2fs_swab32((__u32) (val >> 32)) | |
294 | 0 | (((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32)); |
295 | 0 | } |
296 | | |
297 | | _INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, |
298 | | blk_t block) |
299 | 0 | { |
300 | 0 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
301 | 0 | block); |
302 | 0 | } |
303 | | |
304 | | _INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
305 | | blk_t block) |
306 | 0 | { |
307 | 0 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
308 | 0 | block); |
309 | 0 | } |
310 | | |
311 | | _INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, |
312 | | blk_t block) |
313 | 0 | { |
314 | 0 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
315 | 0 | block); |
316 | 0 | } |
317 | | |
318 | | _INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
319 | | ext2_ino_t inode) |
320 | 0 | { |
321 | 0 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
322 | 0 | inode); |
323 | 0 | } |
324 | | |
325 | | _INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
326 | | ext2_ino_t inode) |
327 | 0 | { |
328 | 0 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
329 | 0 | inode); |
330 | 0 | } |
331 | | |
332 | | _INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
333 | | ext2_ino_t inode) |
334 | 0 | { |
335 | 0 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
336 | 0 | inode); |
337 | 0 | } |
338 | | |
339 | | _INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, |
340 | | blk_t block) |
341 | 0 | { |
342 | 0 | ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); |
343 | 0 | } |
344 | | |
345 | | _INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
346 | | blk_t block) |
347 | 0 | { |
348 | 0 | ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); |
349 | 0 | } |
350 | | |
351 | | _INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, |
352 | | blk_t block) |
353 | 0 | { |
354 | 0 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
355 | 0 | block); |
356 | 0 | } |
357 | | |
358 | | _INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
359 | | ext2_ino_t inode) |
360 | 0 | { |
361 | 0 | ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); |
362 | 0 | } |
363 | | |
364 | | _INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
365 | | ext2_ino_t inode) |
366 | 0 | { |
367 | 0 | ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); |
368 | 0 | } |
369 | | |
370 | | _INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
371 | | ext2_ino_t inode) |
372 | 0 | { |
373 | 0 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
374 | 0 | inode); |
375 | 0 | } |
376 | | |
377 | | _INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap) |
378 | 0 | { |
379 | 0 | return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); |
380 | 0 | } |
381 | | |
382 | | _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap) |
383 | 0 | { |
384 | 0 | return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); |
385 | 0 | } |
386 | | |
387 | | _INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap) |
388 | 0 | { |
389 | 0 | return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); |
390 | 0 | } |
391 | | |
392 | | _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap) |
393 | 0 | { |
394 | 0 | return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); |
395 | 0 | } |
396 | | |
397 | | _INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, |
398 | | blk_t block, int num) |
399 | 0 | { |
400 | 0 | return ext2fs_test_block_bitmap_range(bitmap, block, num); |
401 | 0 | } |
402 | | |
403 | | _INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
404 | | blk_t block, int num) |
405 | 0 | { |
406 | 0 | ext2fs_mark_block_bitmap_range(bitmap, block, num); |
407 | 0 | } |
408 | | |
409 | | _INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, |
410 | | blk_t block, int num) |
411 | 0 | { |
412 | 0 | ext2fs_unmark_block_bitmap_range(bitmap, block, num); |
413 | 0 | } |
414 | | |
415 | | /* 64-bit versions */ |
416 | | |
417 | | _INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, |
418 | | blk64_t block) |
419 | 130k | { |
420 | 130k | return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, |
421 | 130k | block); |
422 | 130k | } |
423 | | |
424 | | _INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, |
425 | | blk64_t block) |
426 | 0 | { |
427 | 0 | return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); |
428 | 0 | } |
429 | | |
430 | | _INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, |
431 | | blk64_t block) |
432 | 0 | { |
433 | 0 | return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, |
434 | 0 | block); |
435 | 0 | } |
436 | | |
437 | | _INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
438 | | ext2_ino_t inode) |
439 | 0 | { |
440 | 0 | return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, |
441 | 0 | inode); |
442 | 0 | } |
443 | | |
444 | | _INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
445 | | ext2_ino_t inode) |
446 | 0 | { |
447 | 0 | return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, |
448 | 0 | inode); |
449 | 0 | } |
450 | | |
451 | | _INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
452 | | ext2_ino_t inode) |
453 | 0 | { |
454 | 0 | return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, |
455 | 0 | inode); |
456 | 0 | } |
457 | | |
458 | | _INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, |
459 | | blk64_t block) |
460 | 0 | { |
461 | 0 | ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); |
462 | 0 | } |
463 | | |
464 | | _INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, |
465 | | blk64_t block) |
466 | 0 | { |
467 | 0 | ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); |
468 | 0 | } |
469 | | |
470 | | _INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, |
471 | | blk64_t block) |
472 | 0 | { |
473 | 0 | return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, |
474 | 0 | block); |
475 | 0 | } |
476 | | |
477 | | _INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
478 | | ext2_ino_t inode) |
479 | 0 | { |
480 | 0 | ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); |
481 | 0 | } |
482 | | |
483 | | _INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
484 | | ext2_ino_t inode) |
485 | 0 | { |
486 | 0 | ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); |
487 | 0 | } |
488 | | |
489 | | _INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
490 | | ext2_ino_t inode) |
491 | 0 | { |
492 | 0 | return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, |
493 | 0 | inode); |
494 | 0 | } |
495 | | |
496 | | _INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, |
497 | | blk64_t start, |
498 | | blk64_t end, |
499 | | blk64_t *out) |
500 | 0 | { |
501 | 0 | __u64 o; |
502 | 0 | errcode_t rv; |
503 | |
|
504 | 0 | rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, |
505 | 0 | start, end, &o); |
506 | 0 | if (!rv) |
507 | 0 | *out = o; |
508 | 0 | return rv; |
509 | 0 | } |
510 | | |
511 | | _INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
512 | | ext2_ino_t start, |
513 | | ext2_ino_t end, |
514 | | ext2_ino_t *out) |
515 | 0 | { |
516 | 0 | __u64 o; |
517 | 0 | errcode_t rv; |
518 | |
|
519 | 0 | rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, |
520 | 0 | start, end, &o); |
521 | 0 | if (!rv) |
522 | 0 | *out = (ext2_ino_t) o; |
523 | 0 | return rv; |
524 | 0 | } |
525 | | |
526 | | _INLINE_ errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap, |
527 | | blk64_t start, |
528 | | blk64_t end, |
529 | | blk64_t *out) |
530 | 0 | { |
531 | 0 | __u64 o; |
532 | 0 | errcode_t rv; |
533 | |
|
534 | 0 | rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap, |
535 | 0 | start, end, &o); |
536 | 0 | if (!rv) |
537 | 0 | *out = o; |
538 | 0 | return rv; |
539 | 0 | } |
540 | | |
541 | | _INLINE_ errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap, |
542 | | ext2_ino_t start, |
543 | | ext2_ino_t end, |
544 | | ext2_ino_t *out) |
545 | 0 | { |
546 | 0 | __u64 o; |
547 | 0 | errcode_t rv; |
548 | |
|
549 | 0 | rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap, |
550 | 0 | start, end, &o); |
551 | 0 | if (!rv) |
552 | 0 | *out = (ext2_ino_t) o; |
553 | 0 | return rv; |
554 | 0 | } |
555 | | |
556 | | _INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap) |
557 | 0 | { |
558 | 0 | return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); |
559 | 0 | } |
560 | | |
561 | | _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap) |
562 | 0 | { |
563 | 0 | return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); |
564 | 0 | } |
565 | | |
566 | | _INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap) |
567 | 0 | { |
568 | 0 | return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); |
569 | 0 | } |
570 | | |
571 | | _INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap) |
572 | 0 | { |
573 | 0 | return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); |
574 | 0 | } |
575 | | |
576 | | _INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
577 | | blk64_t block, |
578 | | unsigned int num) |
579 | 0 | { |
580 | 0 | return ext2fs_test_block_bitmap_range2(bitmap, block, num); |
581 | 0 | } |
582 | | |
583 | | _INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
584 | | blk64_t block, |
585 | | unsigned int num) |
586 | 0 | { |
587 | 0 | ext2fs_mark_block_bitmap_range2(bitmap, block, num); |
588 | 0 | } |
589 | | |
590 | | _INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, |
591 | | blk64_t block, |
592 | | unsigned int num) |
593 | 0 | { |
594 | 0 | ext2fs_unmark_block_bitmap_range2(bitmap, block, num); |
595 | 0 | } |
596 | | |
597 | | #undef _INLINE_ |
598 | | #endif |
599 | | |
600 | | extern int ext2fs_set_bit(unsigned int nr,void * addr); |
601 | | extern int ext2fs_clear_bit(unsigned int nr, void * addr); |
602 | | extern int ext2fs_test_bit(unsigned int nr, const void * addr); |
603 | | extern int ext2fs_set_bit64(__u64 nr,void * addr); |
604 | | extern int ext2fs_clear_bit64(__u64 nr, void * addr); |
605 | | extern int ext2fs_test_bit64(__u64 nr, const void * addr); |
606 | | extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes); |