13839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * bitops.h --- Bitmap frobbing code.  The byte swapping routines are
350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * 	also included here.
4efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o *
721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * %Begin-Header%
8543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * This file may be redistributed under the terms of the GNU Library
9543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * General Public License, version 2.
1021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * %End-Header%
113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
123839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
132cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#ifdef WORDS_BIGENDIAN
14a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_cpu_to_le64(x) ext2fs_swab64((x))
15a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_le64_to_cpu(x) ext2fs_swab64((x))
162cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le32(x) ext2fs_swab32((x))
172cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le32_to_cpu(x) ext2fs_swab32((x))
182cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le16(x) ext2fs_swab16((x))
192cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le16_to_cpu(x) ext2fs_swab16((x))
20e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define ext2fs_cpu_to_be64(x) ((__u64)(x))
21e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define ext2fs_be64_to_cpu(x) ((__u64)(x))
222cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be32(x) ((__u32)(x))
232cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be32_to_cpu(x) ((__u32)(x))
242cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be16(x) ((__u16)(x))
252cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be16_to_cpu(x) ((__u16)(x))
262cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#else
27a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_cpu_to_le64(x) ((__u64)(x))
28a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_le64_to_cpu(x) ((__u64)(x))
292cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le32(x) ((__u32)(x))
302cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le32_to_cpu(x) ((__u32)(x))
312cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le16(x) ((__u16)(x))
322cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le16_to_cpu(x) ((__u16)(x))
33e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define ext2fs_cpu_to_be64(x) ext2fs_swab64((x))
34e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define ext2fs_be64_to_cpu(x) ext2fs_swab64((x))
352cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be32(x) ext2fs_swab32((x))
362cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be32_to_cpu(x) ext2fs_swab32((x))
372cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be16(x) ext2fs_swab16((x))
382cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be16_to_cpu(x) ext2fs_swab16((x))
392cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#endif
402cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o
413839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * EXT2FS bitmap manipulation routines.
433839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
443839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/* Support for sending warning messages from the inline subroutines */
463839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_block_string;
473839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_inode_string;
483839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_mark_string;
493839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_unmark_string;
503839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_test_string;
51f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
52f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o			       const char *description);
531e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'oextern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
541e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				int code, unsigned long arg);
55f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
56e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef NO_INLINE_FUNCS
57e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
58e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
59e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
60e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
61e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __u16 ext2fs_swab16(__u16 val);
62e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __u32 ext2fs_swab32(__u32 val);
63e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __u64 ext2fs_swab64(__u64 val);
64e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
6528ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
6628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
67f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       blk_t block);
68f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
69f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
7031dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
7128ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
7231dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode);
7331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
743839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
7550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
7650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					  blk_t block);
7750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
7850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block);
7950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
8050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					 blk_t block);
8150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
8250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
8331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					  ext2_ino_t inode);
8450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
8531dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					    ext2_ino_t inode);
8650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
8731dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					 ext2_ino_t inode);
8850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
8931dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
9050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
9131dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
9221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
93e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
94e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						blk_t block, int num);
95e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
96e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						  blk_t block, int num);
97e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
98e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					       blk_t block, int num);
99e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
100e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
101e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* These functions routines moved to gen_bitmap.c */
10221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
10321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					   blk_t block, int num);
10421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
10521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					     blk_t block, int num);
10621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
10721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					  blk_t block, int num);
108ef1a526dfbe663bb80ab75c2e7985ae8d9021b76Theodore Ts'oextern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
109ef1a526dfbe663bb80ab75c2e7985ae8d9021b76Theodore Ts'o					  ino_t inode, int num);
1104ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'oextern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
1114ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'o					 __u32 bitno);
1124ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'oextern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
1134ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'o					   blk_t bitno);
114b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'oextern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
115b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o				      blk_t bitno);
1168df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'oextern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
1178df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o					  blk_t block, int num);
118e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
119271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'oextern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
120271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'oextern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
121b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o
122e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 64-bit versions */
123e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
124e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef NO_INLINE_FUNCS
125e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
126e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     blk64_t block);
127e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
128e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       blk64_t block);
129e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
130e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     blk64_t block);
131e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
132e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
133e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     ext2_ino_t inode);
134e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
135e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       ext2_ino_t inode);
136e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
137e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     ext2_ino_t inode);
138e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
139e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
140e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					   blk64_t block);
141e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
142e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					     blk64_t block);
143e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
144e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					  blk64_t block);
145e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
146e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
147e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					   ext2_ino_t inode);
148e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
149e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					    ext2_ino_t inode);
150e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
151e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					  ext2_ino_t inode);
152e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
153e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      blk64_t start,
154e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      blk64_t end,
155e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      blk64_t *out);
156e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
157e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      ext2_ino_t start,
158e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      ext2_ino_t end,
159e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						      ext2_ino_t *out);
160e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap);
161e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap);
162e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap);
163e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap);
164e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
165e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
166e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						blk64_t block,
167e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						unsigned int num);
168e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
169e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						 blk64_t block,
170e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						 unsigned int num);
171e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
172e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						   blk64_t block,
173e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						   unsigned int num);
174e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
175e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
176e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* These routines moved to gen_bitmap64.c */
177e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
178e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
179e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					     ext2fs_generic_bitmap bm1,
180e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					     ext2fs_generic_bitmap bm2);
181e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
182e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
183e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				    blk64_t bitno);
184e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
185e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				      blk64_t bitno);
186e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
187e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				    blk64_t bitno);
188e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
189e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					   blk64_t block, unsigned int num);
190e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap);
191e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap);
192e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
193e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					   blk64_t block, unsigned int num);
194e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
195e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					    blk64_t block, unsigned int num);
196e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
197e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					      blk64_t block, unsigned int num);
198e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
199e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						     __u64 start, __u64 end,
200e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						     __u64 *out);
201e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
2023839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
2033839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * The inline routines themselves...
204efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
2053839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * If NO_INLINE_FUNCS is defined, then we won't try to do inline
20650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * functions at all; they will be included as normal functions in
20750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * inline.c
2083839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
20950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef NO_INLINE_FUNCS
2105953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
211e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			   defined(__i586__)))
21250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* This prevents bitops.c from trying to include the C */
21350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* function version of these functions */
21450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
21550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
21650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* NO_INLINE_FUNCS */
21750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
2183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
2193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#ifdef INCLUDE_INLINE_FUNCS
220e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if (__STDC_VERSION__ >= 199901L)
221e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define _INLINE_ extern inline
2223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#else
223e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define _INLINE_ inline
224e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
225e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#else /* !INCLUDE_INLINE FUNCS */
226e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if (__STDC_VERSION__ >= 199901L)
227e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define _INLINE_ inline
228e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#else /* not C99 */
22976f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#ifdef __GNUC__
2303839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#define _INLINE_ extern __inline__
23176f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#else				/* For Watcom C */
23276f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#define _INLINE_ extern inline
233e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif /* __GNUC__ */
234e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif /* __STDC_VERSION__ >= 199901L */
235e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif /* INCLUDE_INLINE_FUNCS */
2363839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
237f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o/*
238f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o * Fast bit set/clear functions that doesn't need to return the
239f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o * previous bit value.
240f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o */
241f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
242f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
243f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o{
244f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
245f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
246f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	ADDR += nr >> 3;
247e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	*ADDR |= (unsigned char) (1 << (nr & 0x07));
248f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o}
249f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
250f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
251f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o{
252f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
253f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
254f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	ADDR += nr >> 3;
255e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
256e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
257e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
258e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
259e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
260e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
261e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	unsigned char	*ADDR = (unsigned char *) addr;
262e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
263e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ADDR += nr >> 3;
264e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	*ADDR |= (unsigned char) (1 << (nr & 0x07));
265e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
266e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
267e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
268e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
269e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	unsigned char	*ADDR = (unsigned char *) addr;
270e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
271e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ADDR += nr >> 3;
272e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
2738717c3a8f31dea3b31ddaeccf74ea3b34ca72c04Valerie Aurora Henson}
2748717c3a8f31dea3b31ddaeccf74ea3b34ca72c04Valerie Aurora Henson
2758717c3a8f31dea3b31ddaeccf74ea3b34ca72c04Valerie Aurora Henson
276ac493821ea0af9767a4c0f21a322133494bcdc48Theodore Ts'o#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
277ac493821ea0af9767a4c0f21a322133494bcdc48Theodore Ts'o     (defined(__i386__) || defined(__i486__) || defined(__i586__)))
278f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
279f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
2809ec53cf4f32cc65e91a9c71651f05a6d872a7088Theodore Ts'o#define _EXT2_HAVE_ASM_SWAB_
2819ec53cf4f32cc65e91a9c71651f05a6d872a7088Theodore Ts'o
2823839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
2833839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * These are done by inline assembly for speed reasons.....
2843839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
2853839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * All bitoperations return 0 if the bit was cleared before the
2863839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * operation and != 0 if it was not.  Bit 0 is the LSB of addr; bit 32
2873839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * is the LSB of (addr+1).
2883839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
2893839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
2903839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
2913839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Some hacks to defeat gcc over-optimizations..
2923839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
2933839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ostruct __dummy_h { unsigned long a[100]; };
29474becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
295efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
2963839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
29780af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
2983839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
2993839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
3003839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
301f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	addr = (void *) (((unsigned char *) addr) + (nr >> 3));
3023839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
3038ad26b08fac068f0c50d44a5072fb49ab7bedc78Theodore Ts'o		:"=r" (oldbit),"+m" (EXT2FS_ADDR)
304f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"r" (nr & 7));
3053839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
3063839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3073839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
30880af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
3093839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
3103839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
3113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
312f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	addr = (void *) (((unsigned char *) addr) + (nr >> 3));
3133839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
3148ad26b08fac068f0c50d44a5072fb49ab7bedc78Theodore Ts'o		:"=r" (oldbit),"+m" (EXT2FS_ADDR)
315f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"r" (nr & 7));
3163839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
3173839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
31980af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
3203839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
3213839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
3223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
323dec5cd13fff821d1d3f6a922fbd986b3a86abb77Theodore Ts'o	addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
3243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
3253839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		:"=r" (oldbit)
326f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
3273839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
3283839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3293839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
33069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o_INLINE_ __u32 ext2fs_swab32(__u32 val)
33169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o{
33269fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#ifdef EXT2FS_REQUIRE_486
33369fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("bswap %0" : "=r" (val) : "0" (val));
33469fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#else
33569fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
33669fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		"rorl $16,%0\n\t"	/* swap words		*/
33769fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		"xchgb %b0,%h0"		/* swap higher bytes	*/
33869fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		:"=q" (val)
33969fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		: "0" (val));
34069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#endif
34169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	return val;
34269fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o}
34369fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o
34469fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o_INLINE_ __u16 ext2fs_swab16(__u16 val)
34569fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o{
34669fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("xchgb %b0,%h0"		/* swap bytes		*/ \
34769fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		: "=q" (val) \
34869fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		:  "0" (val)); \
34969fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		return val;
35069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o}
35169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o
35274becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#undef EXT2FS_ADDR
3533839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
3543839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif	/* i386 */
3553839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
35650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
35769fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#if !defined(_EXT2_HAVE_ASM_SWAB_)
35850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
35950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u16 ext2fs_swab16(__u16 val)
36050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
361e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return (val >> 8) | (__u16) (val << 8);
36250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
36350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
36450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u32 ext2fs_swab32(__u32 val)
36550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
36650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return ((val>>24) | ((val>>8)&0xFF00) |
36750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		((val<<8)&0xFF0000) | (val<<24));
36850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
36950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
37050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* !_EXT2_HAVE_ASM_SWAB */
37150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
372e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o_INLINE_ __u64 ext2fs_swab64(__u64 val)
373e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o{
374e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return (ext2fs_swab32((__u32) (val >> 32)) |
375e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o		(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
376e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o}
377e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o
37828ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
3791e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3801e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
381b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
38228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  block);
3831e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3841e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
38528ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
3861e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					 blk_t block)
3871e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
388efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
38928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					    block);
3901e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3911e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
3921e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
3931e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3941e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
395efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3961e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  block);
3973839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3983839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
39928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
40031dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode)
4013839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
402efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
40328ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  inode);
4043839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4053839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
40628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
40731dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					 ext2_ino_t inode)
4083839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
409efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
41028ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o				     inode);
4113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4123839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
413f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
41431dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode)
4153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
416efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
4171e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  inode);
4183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
42050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
42150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
42250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
4237bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
42450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
42550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
42650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
42750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					      blk_t block)
42850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
4297bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
43050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
43150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
43250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
43350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
43450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
435efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
4367bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o					  block);
43750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
43850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
43950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
44031dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					    ext2_ino_t inode)
44150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
4427bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
44350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
44450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
44550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
44631dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					      ext2_ino_t inode)
44750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
4487bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
44950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
45050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
45150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
45231dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					   ext2_ino_t inode)
45350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
454efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
4557bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o					  inode);
45650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
45750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
45850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
45950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
460271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
46150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
46250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
46331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
46450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
465271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
46650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
46750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
46850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
46950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
470271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
47150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
47250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
47331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
47450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
475271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
47650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
47750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
47821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
47921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						 blk_t block, int num)
48021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4818df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	return ext2fs_test_block_bitmap_range(bitmap, block, num);
48221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
48321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
48421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
48521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						  blk_t block, int num)
48621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4878df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	ext2fs_mark_block_bitmap_range(bitmap, block, num);
48821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
48921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
49021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
49121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						    blk_t block, int num)
49221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4938df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	ext2fs_unmark_block_bitmap_range(bitmap, block, num);
49421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
495e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
496e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 64-bit versions */
497e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
498e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
499e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       blk64_t block)
500e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
501e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
502e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					block);
503e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
504e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
505e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
506e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					 blk64_t block)
507e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
508e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
509e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
510e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
511e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
512e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       blk64_t block)
513e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
514e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
515e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					block);
516e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
517e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
518e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
519e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       ext2_ino_t inode)
520e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
521e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
522e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					inode);
523e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
524e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
525e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
526e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					 ext2_ino_t inode)
527e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
528e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap,
529e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					  inode);
530e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
531e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
532e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
533e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       ext2_ino_t inode)
534e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
535e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
536e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					inode);
537e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
538e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
539e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
540e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					     blk64_t block)
541e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
542e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
543e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
544e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
545e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
546e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					       blk64_t block)
547e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
548e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
549e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
550e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
551e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
552e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					    blk64_t block)
553e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
554e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
555e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					block);
556e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
557e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
558e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
559e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					     ext2_ino_t inode)
560e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
561e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
562e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
563e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
564e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
565e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					       ext2_ino_t inode)
566e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
567e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
568e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
569e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
570e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
571e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					    ext2_ino_t inode)
572e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
573e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
574e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall					inode);
575e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
576e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
577e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
578e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							blk64_t start,
579e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							blk64_t end,
580e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							blk64_t *out)
581e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
582e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	__u64 o;
583e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	errcode_t rv;
584e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
585e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
586e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						 start, end, &o);
587e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (!rv)
588e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		*out = o;
589e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return rv;
590e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
591e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
592e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
593e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							ext2_ino_t start,
594e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							ext2_ino_t end,
595e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall							ext2_ino_t *out)
596e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
597e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	__u64 o;
598e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	errcode_t rv;
599e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
600e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
601e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						 start, end, &o);
602e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	if (!rv)
603e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		*out = (ext2_ino_t) o;
604e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return rv;
605e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
606e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
607e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
608e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
609e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
610e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
611e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
612e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
613e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
614e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
615e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
616e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
617e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
618e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
619e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
620e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
621e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
622e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
623e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
624e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
625e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
626e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
627e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
628e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						  blk64_t block,
629e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						  unsigned int num)
630e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
631e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	return ext2fs_test_block_bitmap_range2(bitmap, block, num);
632e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
633e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
634e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
635e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						   blk64_t block,
636e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						   unsigned int num)
637e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
638e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_mark_block_bitmap_range2(bitmap, block, num);
639e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
640e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
641e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
642e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						     blk64_t block,
643e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall						     unsigned int num)
644e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
645e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall	ext2fs_unmark_block_bitmap_range2(bitmap, block, num);
646e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall}
647e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
6483839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#undef _INLINE_
6493839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif
65050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
651e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifndef _EXT2_HAVE_ASM_BITOPS_
652e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_set_bit(unsigned int nr,void * addr);
653e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_clear_bit(unsigned int nr, void * addr);
654e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_bit(unsigned int nr, const void * addr);
655e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
656e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
657e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_set_bit64(__u64 nr,void * addr);
658e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_clear_bit64(__u64 nr, void * addr);
659e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int ext2fs_test_bit64(__u64 nr, const void * addr);
660e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes);
661