bitops.h revision 543547a52a20cb7e69d74921b2f691078fd55d83
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
1380af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'oextern int ext2fs_set_bit(unsigned int nr,void * addr);
1480af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'oextern int ext2fs_clear_bit(unsigned int nr, void * addr);
1580af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'oextern int ext2fs_test_bit(unsigned int nr, const void * addr);
16f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'oextern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
17f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'oextern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
1850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern __u16 ext2fs_swab16(__u16 val);
1950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern __u32 ext2fs_swab32(__u32 val);
20dec5cd13fff821d1d3f6a922fbd986b3a86abb77Theodore Ts'oextern __u64 ext2fs_swab64(__u64 val);
213839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
222cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#ifdef WORDS_BIGENDIAN
23a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_cpu_to_le64(x) ext2fs_swab64((x))
24a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_le64_to_cpu(x) ext2fs_swab64((x))
252cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le32(x) ext2fs_swab32((x))
262cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le32_to_cpu(x) ext2fs_swab32((x))
272cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le16(x) ext2fs_swab16((x))
282cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le16_to_cpu(x) ext2fs_swab16((x))
292cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be32(x) ((__u32)(x))
302cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be32_to_cpu(x) ((__u32)(x))
312cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be16(x) ((__u16)(x))
322cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be16_to_cpu(x) ((__u16)(x))
332cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#else
34a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_cpu_to_le64(x) ((__u64)(x))
35a62e3f0378d2a9b861fc4809a810980c1c3bde35Andreas Dilger#define ext2fs_le64_to_cpu(x) ((__u64)(x))
362cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le32(x) ((__u32)(x))
372cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le32_to_cpu(x) ((__u32)(x))
382cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_le16(x) ((__u16)(x))
392cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_le16_to_cpu(x) ((__u16)(x))
402cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be32(x) ext2fs_swab32((x))
412cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be32_to_cpu(x) ext2fs_swab32((x))
422cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_cpu_to_be16(x) ext2fs_swab16((x))
432cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#define ext2fs_be16_to_cpu(x) ext2fs_swab16((x))
442cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o#endif
452cb403b255f1254a29f26d2b356e7764c0f12506Theodore Ts'o
463839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
473839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * EXT2FS bitmap manipulation routines.
483839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
493839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
503839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/* Support for sending warning messages from the inline subroutines */
513839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_block_string;
523839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_inode_string;
533839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_mark_string;
543839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_unmark_string;
553839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_test_string;
56f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
57f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o			       const char *description);
581e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'oextern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
591e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				int code, unsigned long arg);
60f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
6128ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
6228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
63f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       blk_t block);
64f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
65f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
6631dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
6728ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
6831dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode);
6931dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
703839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
7150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
7250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					  blk_t block);
7350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
7450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block);
7550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
7650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					 blk_t block);
7750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
7850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
7931dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					  ext2_ino_t inode);
8050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
8131dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					    ext2_ino_t inode);
8250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
8331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					 ext2_ino_t inode);
8450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
8531dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
8650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
8731dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'oextern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
8821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
8921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
9021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					   blk_t block, int num);
9121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
9221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					     blk_t block, int num);
9321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
9421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					  blk_t block, int num);
95ef1a526dfbe663bb80ab75c2e7985ae8d9021b76Theodore Ts'oextern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
96ef1a526dfbe663bb80ab75c2e7985ae8d9021b76Theodore Ts'o					  ino_t inode, int num);
9721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
9821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						blk_t block, int num);
9921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
10021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						  blk_t block, int num);
10121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
10221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					       blk_t block, int num);
103fff876b7c7716d5eef713101e47bff15edb9d9a9Theodore Ts'oextern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
10450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
105b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o/* These routines moved to gen_bitmap.c */
1064ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'oextern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
1074ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'o					 __u32 bitno);
1084ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'oextern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
1094ea7bd04390935e1f8b473c8b857e518df2e226bTheodore Ts'o					   blk_t bitno);
110b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'oextern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
111b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o				      blk_t bitno);
1128df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'oextern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
1138df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o					  blk_t block, int num);
114271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'oextern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
115271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'oextern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
116b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o
1173839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
1183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * The inline routines themselves...
119efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o *
1203839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * If NO_INLINE_FUNCS is defined, then we won't try to do inline
12150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * functions at all; they will be included as normal functions in
12250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * inline.c
1233839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
12450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef NO_INLINE_FUNCS
1255953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
126125e084cef02fe865a34181ccfa7f258ccf8ab34Theodore Ts'o			   defined(__i586__) || defined(__mc68000__)))
12750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* This prevents bitops.c from trying to include the C */
12850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* function version of these functions */
12950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
13050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
13150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* NO_INLINE_FUNCS */
13250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
1333839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
1343839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#ifdef INCLUDE_INLINE_FUNCS
1353839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#define _INLINE_ extern
1363839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#else
13776f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#ifdef __GNUC__
1383839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#define _INLINE_ extern __inline__
13976f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#else				/* For Watcom C */
14076f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#define _INLINE_ extern inline
14176f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#endif
1423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif
1433839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
144f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o/*
145f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o * Fast bit set/clear functions that doesn't need to return the
146f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o * previous bit value.
147f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o */
148f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
149f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
150f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o{
151f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
152f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
153f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	ADDR += nr >> 3;
154f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	*ADDR |= (1 << (nr & 0x07));
155f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o}
156f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
157f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
158f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o{
159f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
160f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
161f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	ADDR += nr >> 3;
162f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	*ADDR &= ~(1 << (nr & 0x07));
163f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o}
164f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
165f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o
166ac493821ea0af9767a4c0f21a322133494bcdc48Theodore Ts'o#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
167ac493821ea0af9767a4c0f21a322133494bcdc48Theodore Ts'o     (defined(__i386__) || defined(__i486__) || defined(__i586__)))
168f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
169f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
1709ec53cf4f32cc65e91a9c71651f05a6d872a7088Theodore Ts'o#define _EXT2_HAVE_ASM_SWAB_
1719ec53cf4f32cc65e91a9c71651f05a6d872a7088Theodore Ts'o
1723839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
1733839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * These are done by inline assembly for speed reasons.....
1743839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
1753839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * All bitoperations return 0 if the bit was cleared before the
1763839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * operation and != 0 if it was not.  Bit 0 is the LSB of addr; bit 32
1773839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * is the LSB of (addr+1).
1783839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
1793839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1803839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
1813839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Some hacks to defeat gcc over-optimizations..
1823839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
1833839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ostruct __dummy_h { unsigned long a[100]; };
18474becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
185efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
1863839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
18780af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
1883839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
1893839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
1903839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
191f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	addr = (void *) (((unsigned char *) addr) + (nr >> 3));
1923839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
1938ad26b08fac068f0c50d44a5072fb49ab7bedc78Theodore Ts'o		:"=r" (oldbit),"+m" (EXT2FS_ADDR)
194f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"r" (nr & 7));
1953839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
1963839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
1973839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
19880af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
1993839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
2003839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
2013839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
202f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o	addr = (void *) (((unsigned char *) addr) + (nr >> 3));
2033839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
2048ad26b08fac068f0c50d44a5072fb49ab7bedc78Theodore Ts'o		:"=r" (oldbit),"+m" (EXT2FS_ADDR)
205f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"r" (nr & 7));
2063839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
2073839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
2083839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
20980af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
2103839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
2113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
2123839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
213dec5cd13fff821d1d3f6a922fbd986b3a86abb77Theodore Ts'o	addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
2143839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
2153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		:"=r" (oldbit)
216f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o		:"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
2173839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
2183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
2193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
22069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o_INLINE_ __u32 ext2fs_swab32(__u32 val)
22169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o{
22269fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#ifdef EXT2FS_REQUIRE_486
22369fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("bswap %0" : "=r" (val) : "0" (val));
22469fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#else
22569fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
22669fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		"rorl $16,%0\n\t"	/* swap words		*/
22769fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		"xchgb %b0,%h0"		/* swap higher bytes	*/
22869fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		:"=q" (val)
22969fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		: "0" (val));
23069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#endif
23169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	return val;
23269fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o}
23369fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o
23469fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o_INLINE_ __u16 ext2fs_swab16(__u16 val)
23569fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o{
23669fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o	__asm__("xchgb %b0,%h0"		/* swap bytes		*/ \
23769fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		: "=q" (val) \
23869fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		:  "0" (val)); \
23969fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o		return val;
24069fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o}
24169fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o
24274becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#undef EXT2FS_ADDR
2433839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
2443839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif	/* i386 */
2453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
246f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
247f9bcce3be04b554004a82d4fe10edaf6077241beTheodore Ts'o     (defined(__mc68000__)))
248f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
249f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
250f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
25180af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
252f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
253f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
254f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
255f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
2567f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
257f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
258f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
259f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
260f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
26180af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
262f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
263f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
264f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
265f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
2667f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
267f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
268f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
269f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
270f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
27180af12e180bdea9ed391a0aee58e31cee7641709Theodore Ts'o_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
272f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
273f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
274f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
275f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
2767f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
277f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
278f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
279f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
280f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
281f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#endif /* __mc68000__ */
282f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
28350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
28469fbde418b1a197bf793e51b12e23f528b967093Theodore Ts'o#if !defined(_EXT2_HAVE_ASM_SWAB_)
28550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
28650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u16 ext2fs_swab16(__u16 val)
28750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
28850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return (val >> 8) | (val << 8);
28950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
29050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
29150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u32 ext2fs_swab32(__u32 val)
29250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
29350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return ((val>>24) | ((val>>8)&0xFF00) |
29450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		((val<<8)&0xFF0000) | (val<<24));
29550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
29650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
29750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* !_EXT2_HAVE_ASM_SWAB */
29850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
299e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o_INLINE_ __u64 ext2fs_swab64(__u64 val)
300e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o{
301e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o	return (ext2fs_swab32(val >> 32) |
302e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o		(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
303e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o}
304e01f9be336274e527cdb794cca2b0c1501e8b0d7Theodore Ts'o
30528ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
3061e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3071e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
308b15beaaf386a13d9fbaf716aac2df44748261af1Theodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
30928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  block);
3101e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3111e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
31228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
3131e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					 blk_t block)
3141e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
315efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
31628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					    block);
3171e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3181e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
3191e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
3201e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3211e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
322efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3231e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  block);
3243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3253839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
32628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
32731dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode)
3283839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
329efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
33028ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  inode);
3313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3323839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
33328ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
33431dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					 ext2_ino_t inode)
3353839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
336efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
33728ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o				     inode);
3383839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3393839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
340f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
34131dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o				       ext2_ino_t inode)
3423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
343efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3441e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  inode);
3453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3463839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
34750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
34850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
34950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
3507bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
35150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
35250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
35350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
35450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					      blk_t block)
35550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
3567bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
35750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
35850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
35950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
36050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
36150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
362efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3637bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o					  block);
36450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
36550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
36650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
36731dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					    ext2_ino_t inode)
36850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
3697bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
37050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
37150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
37250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
37331dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					      ext2_ino_t inode)
37450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
3757bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o	ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
37650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
37750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
37850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
37931dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o					   ext2_ino_t inode)
38050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
381efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3827bf257a9a07d6067fba43ba05f25b3de0436d59cTheodore Ts'o					  inode);
38350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
38450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
38550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
38650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
387271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
38850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
38950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
39031dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
39150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
392271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
39350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
39450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
39550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
39650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
397271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
39850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
39950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
40031dbecd482405e0d3a67eb58e1a1c8cb9f2ad83eTheodore Ts'o_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
40150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
402271a375b596240866b4a2967e3b6f38ff7cecdf8Theodore Ts'o	return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
40350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
40450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
40521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
40621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						 blk_t block, int num)
40721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4088df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	return ext2fs_test_block_bitmap_range(bitmap, block, num);
40921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
41021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
41121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
41221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						  blk_t block, int num)
41321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4148df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	ext2fs_mark_block_bitmap_range(bitmap, block, num);
41521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
41621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
41721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
41821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						    blk_t block, int num)
41921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
4208df1827b55f11321bfe508c89b94591bdb97c3a6Theodore Ts'o	ext2fs_unmark_block_bitmap_range(bitmap, block, num);
42121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
4223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#undef _INLINE_
4233839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif
42450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
425