bitops.h revision 28ffafb09c6fd8a9ebe716c06b02143771a9b17f
13839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * bitops.h --- Bitmap frobbing code.  The byte swapping routines are
350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * 	also included here.
43839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o *
721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * %Begin-Header%
821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * This file may be redistributed under the terms of the GNU Public
921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * License.
1021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * %End-Header%
113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
1221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
1321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o * Linus Torvalds.
143839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
163839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1774becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'oextern int ext2fs_set_bit(int nr,void * addr);
1874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'oextern int ext2fs_clear_bit(int nr, void * addr);
1974becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'oextern int ext2fs_test_bit(int nr, const void * addr);
2050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern __u16 ext2fs_swab16(__u16 val);
2150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern __u32 ext2fs_swab32(__u32 val);
223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
233839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * EXT2FS bitmap manipulation routines.
253839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
263839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
273839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/* Support for sending warning messages from the inline subroutines */
283839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_block_string;
293839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_inode_string;
303839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_mark_string;
313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_unmark_string;
323839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oextern const char *ext2fs_test_string;
33f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
34f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o			       const char *description);
351e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'oextern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
361e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				int code, unsigned long arg);
37f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
3828ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
3928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
40f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       blk_t block);
41f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
42f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
4328ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
4428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'oextern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
45f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       ino_t inode);
46f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'oextern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
473839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
4850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
4950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					  blk_t block);
5050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
5150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block);
5250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
5350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					 blk_t block);
5450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
5550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
5650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					  ino_t inode);
5750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
5850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    ino_t inode);
5950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
6050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					 ino_t inode);
6150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
6221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
6350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'oextern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
6421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
6521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
6621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
6721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					   blk_t block, int num);
6821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
6921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					     blk_t block, int num);
7021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
7121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					  blk_t block, int num);
7221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
7321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						blk_t block, int num);
7421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
7521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						  blk_t block, int num);
7621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'oextern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
7721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					       blk_t block, int num);
78fff876b7c7716d5eef713101e47bff15edb9d9a9Theodore Ts'oextern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
7950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
803839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
813839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * The inline routines themselves...
823839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
833839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * If NO_INLINE_FUNCS is defined, then we won't try to do inline
8450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * functions at all; they will be included as normal functions in
8550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o * inline.c
863839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
8750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef NO_INLINE_FUNCS
885953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
895953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o			   defined(__i586__) || defined(__mc68000__) || \
905953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o			   defined(__sparc__)))
9150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* This prevents bitops.c from trying to include the C */
9250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	/* function version of these functions */
9350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
9450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
9550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* NO_INLINE_FUNCS */
9650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
973839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
983839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#ifdef INCLUDE_INLINE_FUNCS
993839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#define _INLINE_ extern
1003839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#else
10176f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#ifdef __GNUC__
1023839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#define _INLINE_ extern __inline__
10376f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#else				/* For Watcom C */
10476f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#define _INLINE_ extern inline
10576f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07Theodore Ts'o#endif
1063839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif
1073839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1085953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o#if ((defined __GNUC__) && (defined(__i386__) || defined(__i486__) || \
1095953b9de9ce59661640f851b217421d734bb0302Theodore Ts'o			    defined(__i586__)))
110f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
111f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
112f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
1133839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
1143839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * These are done by inline assembly for speed reasons.....
1153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o *
1163839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * All bitoperations return 0 if the bit was cleared before the
1173839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * operation and != 0 if it was not.  Bit 0 is the LSB of addr; bit 32
1183839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * is the LSB of (addr+1).
1193839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
1203839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1213839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o/*
1223839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o * Some hacks to defeat gcc over-optimizations..
1233839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o */
1243839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ostruct __dummy_h { unsigned long a[100]; };
12574becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
12674becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
1273839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
12874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_set_bit(int nr, void * addr)
1293839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
1303839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
1313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1323839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
13374becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o		:"=r" (oldbit),"=m" (EXT2FS_ADDR)
1343839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		:"r" (nr));
1353839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
1363839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
1373839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
13874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
1393839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
1403839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
1413839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
14374becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o		:"=r" (oldbit),"=m" (EXT2FS_ADDR)
1443839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		:"r" (nr));
1453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
1463839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
1473839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
14874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
1493839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
1503839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	int oldbit;
1513839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1523839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
1533839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		:"=r" (oldbit)
15474becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o		:"m" (EXT2FS_CONST_ADDR),"r" (nr));
1553839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	return oldbit;
1563839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
1573839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
15874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o#undef EXT2FS_ADDR
1593839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
1603839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif	/* i386 */
1613839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
162f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#ifdef __mc68000__
163f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
164f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
165f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
16674becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_set_bit(int nr,void * addr)
167f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
168f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
169f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
170f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
1717f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
172f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
173f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
174f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
175f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
17674becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
177f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
178f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
179f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
180f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
1817f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
182f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
183f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
184f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
185f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
18674becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
187f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o{
188f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	char retval;
189f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
190f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
1917f88b04341d88c5df0360d930832c38040303b61Theodore Ts'o	     : "=d" (retval) : "d" (nr^7), "a" (addr));
192f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
193f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o	return retval;
194f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o}
195f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
196f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o#endif /* __mc68000__ */
197f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o
19850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef __sparc__
19950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
20050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#define _EXT2_HAVE_ASM_BITOPS_
20150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
2021e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#ifndef EXT2_OLD_BITOPS
2031e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2041e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o/*
2051e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o * Do the bitops so that we are compatible with the standard i386
2061e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o * convention.
2071e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o */
2081e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2091e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_set_bit(int nr,void * addr)
2101e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
2111e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#if 1
2121e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int		mask;
2131e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
2141e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2151e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	ADDR += nr >> 3;
2161e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	mask = 1 << (nr & 0x07);
2171e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	__asm__ __volatile__("ldub	[%0], %%g6\n\t"
2181e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "or	%%g6, %2, %%g5\n\t"
2191e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "stb	%%g5, [%0]\n\t"
2201e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "and	%%g6, %2, %0\n"
2211e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "=&r" (ADDR)
2221e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "0" (ADDR), "r" (mask)
2231e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "g5", "g6");
2241e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return (int) ADDR;
2251e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#else
2261e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int		mask, retval;
2271e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
2281e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2291e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	ADDR += nr >> 3;
2301e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	mask = 1 << (nr & 0x07);
2311e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	retval = (mask & *ADDR) != 0;
2321e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	*ADDR |= mask;
2331e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return retval;
2341e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#endif
2351e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
2361e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2371e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_clear_bit(int nr, void * addr)
2381e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
2391e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#if 1
2401e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int		mask;
2411e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
2421e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2431e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	ADDR += nr >> 3;
2441e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	mask = 1 << (nr & 0x07);
2451e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	__asm__ __volatile__("ldub	[%0], %%g6\n\t"
2461e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "andn	%%g6, %2, %%g5\n\t"
2471e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "stb	%%g5, [%0]\n\t"
2481e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o			     "and	%%g6, %2, %0\n"
2491e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "=&r" (ADDR)
2501e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "0" (ADDR), "r" (mask)
2511e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	: "g5", "g6");
2521e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return (int) ADDR;
2531e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2541e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#else
2551e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int		mask, retval;
2561e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	unsigned char	*ADDR = (unsigned char *) addr;
2571e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2581e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	ADDR += nr >> 3;
2591e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	mask = 1 << (nr & 0x07);
2601e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	retval = (mask & *ADDR) != 0;
2611e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	*ADDR &= ~mask;
2621e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return retval;
2631e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#endif
2641e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
2651e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2661e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_test_bit(int nr, const void * addr)
2671e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
2681e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	int			mask;
2691e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	const unsigned char	*ADDR = (const unsigned char *) addr;
2701e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2711e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	ADDR += nr >> 3;
2721e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	mask = 1 << (nr & 0x07);
2731e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return ((mask & *ADDR) != 0);
2741e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
2751e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2761e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#else
2771e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
2781e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o/* Do things the old, unplesant way. */
2791e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
28074becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_set_bit(int nr, void *addr)
28150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
28250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	int		mask, retval;
28350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	unsigned long	*ADDR = (unsigned long *) addr;
28450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
28550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	ADDR += nr >> 5;
28650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	mask = 1 << (nr & 31);
28750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	retval = ((mask & *ADDR) != 0);
28850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	*ADDR |= mask;
28950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return retval;
29050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
29150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
29274becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_clear_bit(int nr, void *addr)
29350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
29450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	int		mask, retval;
29550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	unsigned long	*ADDR = (unsigned long *) addr;
29650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
29750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	ADDR += nr >> 5;
29850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	mask = 1 << (nr & 31);
29950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	retval = ((mask & *ADDR) != 0);
30050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	*ADDR &= ~mask;
30150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return retval;
30250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
30350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
30474becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o_INLINE_ int ext2fs_test_bit(int nr, const void *addr)
30550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
30650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	int			mask;
30750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	const unsigned long	*ADDR = (const unsigned long *) addr;
30850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
30950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	ADDR += nr >> 5;
31050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	mask = 1 << (nr & 31);
31150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return ((mask & *ADDR) != 0);
31250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
3131e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o#endif
31450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
31550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* __sparc__ */
31650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
31750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifndef _EXT2_HAVE_ASM_SWAB
31850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
31950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u16 ext2fs_swab16(__u16 val)
32050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
32150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return (val >> 8) | (val << 8);
32250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
32350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
32450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ __u32 ext2fs_swab32(__u32 val)
32550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
32650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return ((val>>24) | ((val>>8)&0xFF00) |
32750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		((val<<8)&0xFF0000) | (val<<24));
32850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
32950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
33050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif /* !_EXT2_HAVE_ASM_SWAB */
33150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
33228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
33321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					 __u32 bitno);
33428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
33521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					   blk_t bitno);
33621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
33721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					blk_t bitno);
33821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
33928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
34021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					 __u32 bitno)
3413839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
3421e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
3431e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
34428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o		return 0;
3453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	}
34628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap);
3473839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3483839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
34928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
35021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					   blk_t bitno)
3513839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
3521e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
3531e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o		ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
35428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o		return 0;
3553839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	}
35628ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap);
3573839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3583839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
3591e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
36021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					blk_t bitno)
3613839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
3621e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
363521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o		ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, bitno);
3643839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o		return 0;
3653839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o	}
3661e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap);
3671e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3681e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
36928ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
3701e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3711e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
37228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap)
37328ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o				       bitmap,
37428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  block);
3751e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3761e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
37728ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
3781e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					 blk_t block)
3791e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
38028ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
38128ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					    block);
3821e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o}
3831e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o
3841e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
3851e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o				       blk_t block)
3861e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o{
3871e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
3881e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  block);
3893839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3903839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
39128ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
392f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       ino_t inode)
3933839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
39428ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
39528ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o					  inode);
3963839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
3973839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
39828ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
399f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o					 ino_t inode)
4003839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
40128ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
40228ffafb09c6fd8a9ebe716c06b02143771a9b17fTheodore Ts'o				     inode);
4033839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4043839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
405f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
406f3db3566b5e1342e49dffc5ec3f418a838584194Theodore Ts'o				       ino_t inode)
4073839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o{
4081e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
4091e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o					  inode);
4103839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o}
4113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o
41250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
41350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
41450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
41550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
41650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((block < bitmap->start) || (block > bitmap->end)) {
41750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
41850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   bitmap->description);
41950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return;
42050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
42150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
42274becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
42350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
42450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
42550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
42650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					      blk_t block)
42750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
42850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
42950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((block < bitmap->start) || (block > bitmap->end)) {
43050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK,
43150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   block, bitmap->description);
43250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return;
43350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
43450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
43574becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	ext2fs_clear_bit(block - bitmap->start, bitmap->bitmap);
43650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
43750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
43850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
43950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    blk_t block)
44050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
44150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
44250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((block < bitmap->start) || (block > bitmap->end)) {
44350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
44450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   block, bitmap->description);
44550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return 0;
44650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
44750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
44874becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	return ext2fs_test_bit(block - bitmap->start, bitmap->bitmap);
44950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
45050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
45150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
45250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					    ino_t inode)
45350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
45450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
45550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((inode < bitmap->start) || (inode > bitmap->end)) {
45650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_MARK,
45750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   inode, bitmap->description);
45850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return;
45950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
46050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
46174becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	ext2fs_set_bit(inode - bitmap->start, bitmap->bitmap);
46250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
46350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
46450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
46550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					      ino_t inode)
46650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
46750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
46850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((inode < bitmap->start) || (inode > bitmap->end)) {
46950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_UNMARK,
47050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   inode, bitmap->description);
47150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return;
47250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
47350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
47474becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	ext2fs_clear_bit(inode - bitmap->start, bitmap->bitmap);
47550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
47650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
47750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
47850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o					   ino_t inode)
47950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
48050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
48150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	if ((inode < bitmap->start) || (inode > bitmap->end)) {
48250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_TEST,
48350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o				   inode, bitmap->description);
48450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o		return 0;
48550e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	}
48650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#endif
48774becf3c0a065f8d64e07ce4d31f9fe53be91d62Theodore Ts'o	return ext2fs_test_bit(inode - bitmap->start, bitmap->bitmap);
48850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
48950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
49050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
49150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
49250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return bitmap->start;
49350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
49450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
49521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
49650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
49750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return bitmap->start;
49850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
49950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
50050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
50150e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
50250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return bitmap->end;
50350e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
50450e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
50521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
50650e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o{
50750e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o	return bitmap->end;
50850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o}
50950e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
51021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
51121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					    blk_t block, int num)
51221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
51321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
51421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
51521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
51621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
51721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   block, bitmap->description);
51821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return 0;
51921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
52021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++) {
52121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
52221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o			return 0;
52321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
52421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	return 1;
52521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
52621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
52721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
52821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						 blk_t block, int num)
52921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
53021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
53121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
53221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
53321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
53421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
53521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   block, bitmap->description);
53621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return 0;
53721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
53821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#endif
53921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++) {
54021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
54121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o			return 0;
54221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
54321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	return 1;
54421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
54521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
54621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
54721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					     blk_t block, int num)
54821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
54921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
55021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
55121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
55221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
55321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   bitmap->description);
55421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return;
55521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
55621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++)
55721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
55821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
55921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
56021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
56121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						  blk_t block, int num)
56221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
56321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
56421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
56521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
56621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
56721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
56821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   bitmap->description);
56921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return;
57021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
57121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#endif
57221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++)
57321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
57421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
57521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
57621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
57721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o					       blk_t block, int num)
57821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
57921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
58021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
58121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
58221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
58321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   bitmap->description);
58421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return;
58521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
58621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++)
58721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
58821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
58921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
59021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
59121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o						    blk_t block, int num)
59221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o{
59321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	int	i;
59421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
59521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#ifdef EXT2FS_DEBUG_FAST_OPS
59621c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
59721c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
59821c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o				   bitmap->description);
59921c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		return;
60021c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	}
60121c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o#endif
60221c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o	for (i=0; i < num; i++)
60321c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o		ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
60421c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o}
60521c84b71e205b5ab13f14343da5645dcc985856dTheodore Ts'o
6063839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#undef _INLINE_
6073839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#endif
60850e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o
609