summaryrefslogtreecommitdiffstats
path: root/include/asm-m68k
diff options
context:
space:
mode:
authorAkinobu Mita <mita@miraclelinux.com>2006-03-26 01:39:28 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 08:57:13 -0800
commitd5728b45da6a510b74f07e385b3ef6b434b828e5 (patch)
tree2e324b833ce04cd8ae12e9136551459be0ba65c2 /include/asm-m68k
parentba1a5b32ba5e2fcb53b6943b8c9c33694ac68ce5 (diff)
downloadop-kernel-dev-d5728b45da6a510b74f07e385b3ef6b434b828e5.zip
op-kernel-dev-d5728b45da6a510b74f07e385b3ef6b434b828e5.tar.gz
[PATCH] m68k: fix undefined reference to generic_find_next_zero_le_bit
This patch reverts ext2 bitmap functions. Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-m68k')
-rw-r--r--include/asm-m68k/bitops.h54
1 files changed, 52 insertions, 2 deletions
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index e845daa..1a61fdb 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -351,11 +351,61 @@ static inline int minix_test_bit(int nr, const void *vaddr)
/* Bitmap functions for the ext2 filesystem. */
-#include <asm-generic/bitops/ext2-non-atomic.h>
-
+#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
+#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
+static inline int ext2_test_bit(int nr, const void *vaddr)
+{
+ const unsigned char *p = vaddr;
+ return (p[nr >> 3] & (1U << (nr & 7))) != 0;
+}
+
+static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
+{
+ const unsigned long *p = vaddr, *addr = vaddr;
+ int res;
+
+ if (!size)
+ return 0;
+
+ size = (size >> 5) + ((size & 31) > 0);
+ while (*p++ == ~0UL)
+ {
+ if (--size == 0)
+ return (p - addr) << 5;
+ }
+
+ --p;
+ for (res = 0; res < 32; res++)
+ if (!ext2_test_bit (res, p))
+ break;
+ return (p - addr) * 32 + res;
+}
+
+static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
+ unsigned offset)
+{
+ const unsigned long *addr = vaddr;
+ const unsigned long *p = addr + (offset >> 5);
+ int bit = offset & 31UL, res;
+
+ if (offset >= size)
+ return size;
+
+ if (bit) {
+ /* Look for zero in first longword */
+ for (res = bit; res < 32; res++)
+ if (!ext2_test_bit (res, p))
+ return (p - addr) * 32 + res;
+ p++;
+ }
+ /* No zero yet, search remaining full bytes for a zero */
+ res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
+ return (p - addr) * 32 + res;
+}
+
#endif /* __KERNEL__ */
#endif /* _M68K_BITOPS_H */
OpenPOWER on IntegriCloud