aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/bitops.h
diff options
context:
space:
mode:
authorAkinobu Mita <mita@miraclelinux.com>2006-03-26 04:39:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:13 -0500
commitd5728b45da6a510b74f07e385b3ef6b434b828e5 (patch)
tree2e324b833ce04cd8ae12e9136551459be0ba65c2 /include/asm-m68k/bitops.h
parentba1a5b32ba5e2fcb53b6943b8c9c33694ac68ce5 (diff)
[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/bitops.h')
-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 e845daac48ad..1a61fdb56aaf 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)
351 351
352/* Bitmap functions for the ext2 filesystem. */ 352/* Bitmap functions for the ext2 filesystem. */
353 353
354#include <asm-generic/bitops/ext2-non-atomic.h> 354#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
355
356#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) 355#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
356#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
357#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) 357#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
358 358
359static inline int ext2_test_bit(int nr, const void *vaddr)
360{
361 const unsigned char *p = vaddr;
362 return (p[nr >> 3] & (1U << (nr & 7))) != 0;
363}
364
365static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size)
366{
367 const unsigned long *p = vaddr, *addr = vaddr;
368 int res;
369
370 if (!size)
371 return 0;
372
373 size = (size >> 5) + ((size & 31) > 0);
374 while (*p++ == ~0UL)
375 {
376 if (--size == 0)
377 return (p - addr) << 5;
378 }
379
380 --p;
381 for (res = 0; res < 32; res++)
382 if (!ext2_test_bit (res, p))
383 break;
384 return (p - addr) * 32 + res;
385}
386
387static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
388 unsigned offset)
389{
390 const unsigned long *addr = vaddr;
391 const unsigned long *p = addr + (offset >> 5);
392 int bit = offset & 31UL, res;
393
394 if (offset >= size)
395 return size;
396
397 if (bit) {
398 /* Look for zero in first longword */
399 for (res = bit; res < 32; res++)
400 if (!ext2_test_bit (res, p))
401 return (p - addr) * 32 + res;
402 p++;
403 }
404 /* No zero yet, search remaining full bytes for a zero */
405 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
406 return (p - addr) * 32 + res;
407}
408
359#endif /* __KERNEL__ */ 409#endif /* __KERNEL__ */
360 410
361#endif /* _M68K_BITOPS_H */ 411#endif /* _M68K_BITOPS_H */