diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2011-03-23 19:42:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:22 -0400 |
commit | 61f2e7b0f474225b4226772830ae4b29a3a21f8d (patch) | |
tree | 52f880fe6feec8efe5e5e028a3e0637629a500b7 | |
parent | 3fca5af7860f87eb2cd706c2d7dda4ad03230a07 (diff) |
bitops: remove minix bitops from asm/bitops.h
minix bit operations are only used by minix filesystem and useless by
other modules. Because byte order of inode and block bitmaps is different
on each architecture like below:
m68k:
big-endian 16bit indexed bitmaps
h8300, microblaze, s390, sparc, m68knommu:
big-endian 32 or 64bit indexed bitmaps
m32r, mips, sh, xtensa:
big-endian 32 or 64bit indexed bitmaps for big-endian mode
little-endian bitmaps for little-endian mode
Others:
little-endian bitmaps
In order to move minix bit operations from asm/bitops.h to architecture
independent code in minix filesystem, this provides two config options.
CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED is only selected by m68k.
CONFIG_MINIX_FS_NATIVE_ENDIAN is selected by the architectures which use
native byte order bitmaps (h8300, microblaze, s390, sparc, m68knommu,
m32r, mips, sh, xtensa). The architectures which always use little-endian
bitmaps do not select these options.
Finally, we can remove minix bit operations from asm/bitops.h for all
architectures.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Michal Simek <monstr@monstr.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 files changed, 82 insertions, 110 deletions
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index 822433a00c68..85b815215776 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h | |||
@@ -459,8 +459,6 @@ sched_find_first_bit(const unsigned long b[2]) | |||
459 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 459 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) |
460 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | 460 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) |
461 | 461 | ||
462 | #include <asm-generic/bitops/minix.h> | ||
463 | |||
464 | #endif /* __KERNEL__ */ | 462 | #endif /* __KERNEL__ */ |
465 | 463 | ||
466 | #endif /* _ALPHA_BITOPS_H */ | 464 | #endif /* _ALPHA_BITOPS_H */ |
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index f68f1fb6b38e..6b7403fd8f54 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h | |||
@@ -345,16 +345,6 @@ static inline int find_next_bit_le(const void *p, int size, int offset) | |||
345 | #define ext2_clear_bit_atomic(lock, nr, p) \ | 345 | #define ext2_clear_bit_atomic(lock, nr, p) \ |
346 | test_and_clear_bit_le(nr, p) | 346 | test_and_clear_bit_le(nr, p) |
347 | 347 | ||
348 | /* | ||
349 | * Minix is defined to use little-endian byte ordering. | ||
350 | * These do not need to be atomic. | ||
351 | */ | ||
352 | #define minix_set_bit __set_bit_le | ||
353 | #define minix_test_bit test_bit_le | ||
354 | #define minix_test_and_set_bit __test_and_set_bit_le | ||
355 | #define minix_test_and_clear_bit __test_and_clear_bit_le | ||
356 | #define minix_find_first_zero_bit find_first_zero_bit_le | ||
357 | |||
358 | #endif /* __KERNEL__ */ | 348 | #endif /* __KERNEL__ */ |
359 | 349 | ||
360 | #endif /* _ARM_BITOPS_H */ | 350 | #endif /* _ARM_BITOPS_H */ |
diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h index 73a163a71f12..72444d97f80c 100644 --- a/arch/avr32/include/asm/bitops.h +++ b/arch/avr32/include/asm/bitops.h | |||
@@ -301,6 +301,5 @@ static inline int ffs(unsigned long word) | |||
301 | 301 | ||
302 | #include <asm-generic/bitops/le.h> | 302 | #include <asm-generic/bitops/le.h> |
303 | #include <asm-generic/bitops/ext2-atomic.h> | 303 | #include <asm-generic/bitops/ext2-atomic.h> |
304 | #include <asm-generic/bitops/minix-le.h> | ||
305 | 304 | ||
306 | #endif /* __ASM_AVR32_BITOPS_H */ | 305 | #endif /* __ASM_AVR32_BITOPS_H */ |
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h index 6a69690bd465..49762c6bb0d5 100644 --- a/arch/blackfin/include/asm/bitops.h +++ b/arch/blackfin/include/asm/bitops.h | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include <asm-generic/bitops/le.h> | 28 | #include <asm-generic/bitops/le.h> |
29 | #include <asm-generic/bitops/ext2-atomic.h> | 29 | #include <asm-generic/bitops/ext2-atomic.h> |
30 | #include <asm-generic/bitops/minix.h> | ||
31 | 30 | ||
32 | #ifndef CONFIG_SMP | 31 | #ifndef CONFIG_SMP |
33 | #include <linux/irqflags.h> | 32 | #include <linux/irqflags.h> |
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 71bea4032ebd..310e0de67aa6 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h | |||
@@ -159,7 +159,6 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
159 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 159 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) |
160 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | 160 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) |
161 | 161 | ||
162 | #include <asm-generic/bitops/minix.h> | ||
163 | #include <asm-generic/bitops/sched.h> | 162 | #include <asm-generic/bitops/sched.h> |
164 | 163 | ||
165 | #endif /* __KERNEL__ */ | 164 | #endif /* __KERNEL__ */ |
diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h index e3ea644108ce..a1d00b0c6ed7 100644 --- a/arch/frv/include/asm/bitops.h +++ b/arch/frv/include/asm/bitops.h | |||
@@ -406,8 +406,6 @@ int __ilog2_u64(u64 n) | |||
406 | #define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) | 406 | #define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) |
407 | #define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr)) | 407 | #define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr)) |
408 | 408 | ||
409 | #include <asm-generic/bitops/minix-le.h> | ||
410 | |||
411 | #endif /* __KERNEL__ */ | 409 | #endif /* __KERNEL__ */ |
412 | 410 | ||
413 | #endif /* _ASM_BITOPS_H */ | 411 | #endif /* _ASM_BITOPS_H */ |
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h index 23cea6668980..e856c1bb3415 100644 --- a/arch/h8300/include/asm/bitops.h +++ b/arch/h8300/include/asm/bitops.h | |||
@@ -202,7 +202,6 @@ static __inline__ unsigned long __ffs(unsigned long word) | |||
202 | #include <asm-generic/bitops/lock.h> | 202 | #include <asm-generic/bitops/lock.h> |
203 | #include <asm-generic/bitops/le.h> | 203 | #include <asm-generic/bitops/le.h> |
204 | #include <asm-generic/bitops/ext2-atomic.h> | 204 | #include <asm-generic/bitops/ext2-atomic.h> |
205 | #include <asm-generic/bitops/minix.h> | ||
206 | 205 | ||
207 | #endif /* __KERNEL__ */ | 206 | #endif /* __KERNEL__ */ |
208 | 207 | ||
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index 336984acc8c0..b76f7e009218 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -461,7 +461,6 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x) | |||
461 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) | 461 | #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) |
462 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) | 462 | #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) |
463 | 463 | ||
464 | #include <asm-generic/bitops/minix.h> | ||
465 | #include <asm-generic/bitops/sched.h> | 464 | #include <asm-generic/bitops/sched.h> |
466 | 465 | ||
467 | #endif /* __KERNEL__ */ | 466 | #endif /* __KERNEL__ */ |
diff --git a/arch/m32r/include/asm/bitops.h b/arch/m32r/include/asm/bitops.h index cdfb4c82fb88..6300f22cdbdb 100644 --- a/arch/m32r/include/asm/bitops.h +++ b/arch/m32r/include/asm/bitops.h | |||
@@ -268,7 +268,6 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) | |||
268 | 268 | ||
269 | #include <asm-generic/bitops/le.h> | 269 | #include <asm-generic/bitops/le.h> |
270 | #include <asm-generic/bitops/ext2-atomic.h> | 270 | #include <asm-generic/bitops/ext2-atomic.h> |
271 | #include <asm-generic/bitops/minix.h> | ||
272 | 271 | ||
273 | #endif /* __KERNEL__ */ | 272 | #endif /* __KERNEL__ */ |
274 | 273 | ||
diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h index a403b5e69aab..9d69f6e62365 100644 --- a/arch/m68k/include/asm/bitops_mm.h +++ b/arch/m68k/include/asm/bitops_mm.h | |||
@@ -325,36 +325,6 @@ static inline int __fls(int x) | |||
325 | #include <asm-generic/bitops/hweight.h> | 325 | #include <asm-generic/bitops/hweight.h> |
326 | #include <asm-generic/bitops/lock.h> | 326 | #include <asm-generic/bitops/lock.h> |
327 | 327 | ||
328 | /* Bitmap functions for the minix filesystem */ | ||
329 | |||
330 | static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) | ||
331 | { | ||
332 | const unsigned short *p = vaddr, *addr = vaddr; | ||
333 | unsigned short num; | ||
334 | |||
335 | if (!size) | ||
336 | return 0; | ||
337 | |||
338 | size = (size >> 4) + ((size & 15) > 0); | ||
339 | while (*p++ == 0xffff) { | ||
340 | if (--size == 0) | ||
341 | return (p - addr) << 4; | ||
342 | } | ||
343 | |||
344 | num = *--p; | ||
345 | return ((p - addr) << 4) + ffz(num); | ||
346 | } | ||
347 | |||
348 | #define minix_test_and_set_bit(nr, addr) __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
349 | #define minix_set_bit(nr,addr) __set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
350 | #define minix_test_and_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
351 | |||
352 | static inline int minix_test_bit(int nr, const void *vaddr) | ||
353 | { | ||
354 | const unsigned short *p = vaddr; | ||
355 | return (p[nr >> 4] & (1U << (nr & 15))) != 0; | ||
356 | } | ||
357 | |||
358 | /* Bitmap functions for the little endian bitmap. */ | 328 | /* Bitmap functions for the little endian bitmap. */ |
359 | 329 | ||
360 | static inline void __set_bit_le(int nr, void *addr) | 330 | static inline void __set_bit_le(int nr, void *addr) |
diff --git a/arch/m68k/include/asm/bitops_no.h b/arch/m68k/include/asm/bitops_no.h index 8db5fef8631f..7d3779fdc5b6 100644 --- a/arch/m68k/include/asm/bitops_no.h +++ b/arch/m68k/include/asm/bitops_no.h | |||
@@ -336,8 +336,6 @@ found_middle: | |||
336 | return result + ffz(__swab32(tmp)); | 336 | return result + ffz(__swab32(tmp)); |
337 | } | 337 | } |
338 | 338 | ||
339 | #include <asm-generic/bitops/minix.h> | ||
340 | |||
341 | #endif /* __KERNEL__ */ | 339 | #endif /* __KERNEL__ */ |
342 | 340 | ||
343 | #include <asm-generic/bitops/fls.h> | 341 | #include <asm-generic/bitops/fls.h> |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index e062718a3fea..2e1ad4c652b7 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
@@ -678,7 +678,6 @@ static inline int ffs(int word) | |||
678 | 678 | ||
679 | #include <asm-generic/bitops/le.h> | 679 | #include <asm-generic/bitops/le.h> |
680 | #include <asm-generic/bitops/ext2-atomic.h> | 680 | #include <asm-generic/bitops/ext2-atomic.h> |
681 | #include <asm-generic/bitops/minix.h> | ||
682 | 681 | ||
683 | #endif /* __KERNEL__ */ | 682 | #endif /* __KERNEL__ */ |
684 | 683 | ||
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index a5f460cb834d..0939462967e3 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h | |||
@@ -234,7 +234,6 @@ int ffs(int x) | |||
234 | test_and_clear_bit((nr), (addr)) | 234 | test_and_clear_bit((nr), (addr)) |
235 | 235 | ||
236 | #include <asm-generic/bitops/le.h> | 236 | #include <asm-generic/bitops/le.h> |
237 | #include <asm-generic/bitops/minix-le.h> | ||
238 | 237 | ||
239 | #endif /* __KERNEL__ */ | 238 | #endif /* __KERNEL__ */ |
240 | #endif /* __ASM_BITOPS_H */ | 239 | #endif /* __ASM_BITOPS_H */ |
diff --git a/arch/parisc/include/asm/bitops.h b/arch/parisc/include/asm/bitops.h index 919d7ed155e0..43c516fa17ff 100644 --- a/arch/parisc/include/asm/bitops.h +++ b/arch/parisc/include/asm/bitops.h | |||
@@ -234,6 +234,4 @@ static __inline__ int fls(int x) | |||
234 | 234 | ||
235 | #endif /* __KERNEL__ */ | 235 | #endif /* __KERNEL__ */ |
236 | 236 | ||
237 | #include <asm-generic/bitops/minix-le.h> | ||
238 | |||
239 | #endif /* _PARISC_BITOPS_H */ | 237 | #endif /* _PARISC_BITOPS_H */ |
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index e3bd9a3bcb43..2e561876fc89 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -332,20 +332,6 @@ unsigned long find_next_bit_le(const void *addr, | |||
332 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | 332 | #define ext2_clear_bit_atomic(lock, nr, addr) \ |
333 | test_and_clear_bit_le((nr), (unsigned long*)addr) | 333 | test_and_clear_bit_le((nr), (unsigned long*)addr) |
334 | 334 | ||
335 | /* Bitmap functions for the minix filesystem. */ | ||
336 | |||
337 | #define minix_test_and_set_bit(nr,addr) \ | ||
338 | __test_and_set_bit_le(nr, (unsigned long *)addr) | ||
339 | #define minix_set_bit(nr,addr) \ | ||
340 | __set_bit_le(nr, (unsigned long *)addr) | ||
341 | #define minix_test_and_clear_bit(nr,addr) \ | ||
342 | __test_and_clear_bit_le(nr, (unsigned long *)addr) | ||
343 | #define minix_test_bit(nr,addr) \ | ||
344 | test_bit_le(nr, (unsigned long *)addr) | ||
345 | |||
346 | #define minix_find_first_zero_bit(addr,size) \ | ||
347 | find_first_zero_bit_le((unsigned long *)addr, size) | ||
348 | |||
349 | #include <asm-generic/bitops/sched.h> | 335 | #include <asm-generic/bitops/sched.h> |
350 | 336 | ||
351 | #endif /* __KERNEL__ */ | 337 | #endif /* __KERNEL__ */ |
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h index 2dd32bba47ee..e1c8f3a49884 100644 --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h | |||
@@ -862,7 +862,6 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size, | |||
862 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | 862 | #define ext2_clear_bit_atomic(lock, nr, addr) \ |
863 | test_and_clear_bit_le(nr, addr) | 863 | test_and_clear_bit_le(nr, addr) |
864 | 864 | ||
865 | #include <asm-generic/bitops/minix.h> | ||
866 | 865 | ||
867 | #endif /* __KERNEL__ */ | 866 | #endif /* __KERNEL__ */ |
868 | 867 | ||
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index fc5cd5b9b446..90fa3e48b4d6 100644 --- a/arch/sh/include/asm/bitops.h +++ b/arch/sh/include/asm/bitops.h | |||
@@ -96,7 +96,6 @@ static inline unsigned long ffz(unsigned long word) | |||
96 | #include <asm-generic/bitops/sched.h> | 96 | #include <asm-generic/bitops/sched.h> |
97 | #include <asm-generic/bitops/le.h> | 97 | #include <asm-generic/bitops/le.h> |
98 | #include <asm-generic/bitops/ext2-atomic.h> | 98 | #include <asm-generic/bitops/ext2-atomic.h> |
99 | #include <asm-generic/bitops/minix.h> | ||
100 | #include <asm-generic/bitops/fls.h> | 99 | #include <asm-generic/bitops/fls.h> |
101 | #include <asm-generic/bitops/__fls.h> | 100 | #include <asm-generic/bitops/__fls.h> |
102 | #include <asm-generic/bitops/fls64.h> | 101 | #include <asm-generic/bitops/fls64.h> |
diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h index 75da6f82a12e..25a676653d45 100644 --- a/arch/sparc/include/asm/bitops_32.h +++ b/arch/sparc/include/asm/bitops_32.h | |||
@@ -105,7 +105,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
105 | #include <asm-generic/bitops/find.h> | 105 | #include <asm-generic/bitops/find.h> |
106 | #include <asm-generic/bitops/le.h> | 106 | #include <asm-generic/bitops/le.h> |
107 | #include <asm-generic/bitops/ext2-atomic.h> | 107 | #include <asm-generic/bitops/ext2-atomic.h> |
108 | #include <asm-generic/bitops/minix.h> | ||
109 | 108 | ||
110 | #endif /* __KERNEL__ */ | 109 | #endif /* __KERNEL__ */ |
111 | 110 | ||
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 66db28e6bbf5..38e9aa1b2cea 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h | |||
@@ -96,8 +96,6 @@ static inline unsigned int __arch_hweight8(unsigned int w) | |||
96 | #define ext2_clear_bit_atomic(lock,nr,addr) \ | 96 | #define ext2_clear_bit_atomic(lock,nr,addr) \ |
97 | test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr)) | 97 | test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr)) |
98 | 98 | ||
99 | #include <asm-generic/bitops/minix.h> | ||
100 | |||
101 | #endif /* __KERNEL__ */ | 99 | #endif /* __KERNEL__ */ |
102 | 100 | ||
103 | #endif /* defined(_SPARC64_BITOPS_H) */ | 101 | #endif /* defined(_SPARC64_BITOPS_H) */ |
diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h index 5447addafca4..132e6bbd07e9 100644 --- a/arch/tile/include/asm/bitops.h +++ b/arch/tile/include/asm/bitops.h | |||
@@ -123,6 +123,5 @@ static inline unsigned long __arch_hweight64(__u64 w) | |||
123 | #include <asm-generic/bitops/find.h> | 123 | #include <asm-generic/bitops/find.h> |
124 | #include <asm-generic/bitops/sched.h> | 124 | #include <asm-generic/bitops/sched.h> |
125 | #include <asm-generic/bitops/le.h> | 125 | #include <asm-generic/bitops/le.h> |
126 | #include <asm-generic/bitops/minix.h> | ||
127 | 126 | ||
128 | #endif /* _ASM_TILE_BITOPS_H */ | 127 | #endif /* _ASM_TILE_BITOPS_H */ |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 3c95e072c179..69d58131bc8e 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -463,7 +463,5 @@ static inline int fls(int x) | |||
463 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | 463 | #define ext2_clear_bit_atomic(lock, nr, addr) \ |
464 | test_and_clear_bit((nr), (unsigned long *)(addr)) | 464 | test_and_clear_bit((nr), (unsigned long *)(addr)) |
465 | 465 | ||
466 | #include <asm-generic/bitops/minix.h> | ||
467 | |||
468 | #endif /* __KERNEL__ */ | 466 | #endif /* __KERNEL__ */ |
469 | #endif /* _ASM_X86_BITOPS_H */ | 467 | #endif /* _ASM_X86_BITOPS_H */ |
diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h index a56b7b577f09..c8fac8d8190d 100644 --- a/arch/xtensa/include/asm/bitops.h +++ b/arch/xtensa/include/asm/bitops.h | |||
@@ -125,7 +125,6 @@ static inline unsigned long __fls(unsigned long word) | |||
125 | #include <asm-generic/bitops/hweight.h> | 125 | #include <asm-generic/bitops/hweight.h> |
126 | #include <asm-generic/bitops/lock.h> | 126 | #include <asm-generic/bitops/lock.h> |
127 | #include <asm-generic/bitops/sched.h> | 127 | #include <asm-generic/bitops/sched.h> |
128 | #include <asm-generic/bitops/minix.h> | ||
129 | 128 | ||
130 | #endif /* __KERNEL__ */ | 129 | #endif /* __KERNEL__ */ |
131 | 130 | ||
diff --git a/fs/minix/Kconfig b/fs/minix/Kconfig index 0fd7ca994264..6624684dd5de 100644 --- a/fs/minix/Kconfig +++ b/fs/minix/Kconfig | |||
@@ -15,3 +15,11 @@ config MINIX_FS | |||
15 | module will be called minix. Note that the file system of your root | 15 | module will be called minix. Note that the file system of your root |
16 | partition (the one containing the directory /) cannot be compiled as | 16 | partition (the one containing the directory /) cannot be compiled as |
17 | a module. | 17 | a module. |
18 | |||
19 | config MINIX_FS_NATIVE_ENDIAN | ||
20 | def_bool MINIX_FS | ||
21 | depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K && !MMU) | ||
22 | |||
23 | config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED | ||
24 | def_bool MINIX_FS | ||
25 | depends on M68K && MMU | ||
diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 407b1c84911e..341e2122879a 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h | |||
@@ -88,4 +88,78 @@ static inline struct minix_inode_info *minix_i(struct inode *inode) | |||
88 | return list_entry(inode, struct minix_inode_info, vfs_inode); | 88 | return list_entry(inode, struct minix_inode_info, vfs_inode); |
89 | } | 89 | } |
90 | 90 | ||
91 | #if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) && \ | ||
92 | defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) | ||
93 | |||
94 | #error Minix file system byte order broken | ||
95 | |||
96 | #elif defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) | ||
97 | |||
98 | /* | ||
99 | * big-endian 32 or 64 bit indexed bitmaps on big-endian system or | ||
100 | * little-endian bitmaps on little-endian system | ||
101 | */ | ||
102 | |||
103 | #define minix_test_and_set_bit(nr, addr) \ | ||
104 | __test_and_set_bit((nr), (unsigned long *)(addr)) | ||
105 | #define minix_set_bit(nr, addr) \ | ||
106 | __set_bit((nr), (unsigned long *)(addr)) | ||
107 | #define minix_test_and_clear_bit(nr, addr) \ | ||
108 | __test_and_clear_bit((nr), (unsigned long *)(addr)) | ||
109 | #define minix_test_bit(nr, addr) \ | ||
110 | test_bit((nr), (unsigned long *)(addr)) | ||
111 | #define minix_find_first_zero_bit(addr, size) \ | ||
112 | find_first_zero_bit((unsigned long *)(addr), (size)) | ||
113 | |||
114 | #elif defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) | ||
115 | |||
116 | /* | ||
117 | * big-endian 16bit indexed bitmaps | ||
118 | */ | ||
119 | |||
120 | static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) | ||
121 | { | ||
122 | const unsigned short *p = vaddr, *addr = vaddr; | ||
123 | unsigned short num; | ||
124 | |||
125 | if (!size) | ||
126 | return 0; | ||
127 | |||
128 | size = (size >> 4) + ((size & 15) > 0); | ||
129 | while (*p++ == 0xffff) { | ||
130 | if (--size == 0) | ||
131 | return (p - addr) << 4; | ||
132 | } | ||
133 | |||
134 | num = *--p; | ||
135 | return ((p - addr) << 4) + ffz(num); | ||
136 | } | ||
137 | |||
138 | #define minix_test_and_set_bit(nr, addr) \ | ||
139 | __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
140 | #define minix_set_bit(nr, addr) \ | ||
141 | __set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
142 | #define minix_test_and_clear_bit(nr, addr) \ | ||
143 | __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
144 | |||
145 | static inline int minix_test_bit(int nr, const void *vaddr) | ||
146 | { | ||
147 | const unsigned short *p = vaddr; | ||
148 | return (p[nr >> 4] & (1U << (nr & 15))) != 0; | ||
149 | } | ||
150 | |||
151 | #else | ||
152 | |||
153 | /* | ||
154 | * little-endian bitmaps | ||
155 | */ | ||
156 | |||
157 | #define minix_test_and_set_bit __test_and_set_bit_le | ||
158 | #define minix_set_bit __set_bit_le | ||
159 | #define minix_test_and_clear_bit __test_and_clear_bit_le | ||
160 | #define minix_test_bit test_bit_le | ||
161 | #define minix_find_first_zero_bit find_first_zero_bit_le | ||
162 | |||
163 | #endif | ||
164 | |||
91 | #endif /* FS_MINIX_H */ | 165 | #endif /* FS_MINIX_H */ |
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index dd7c0147aecb..280ca7a96f75 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h | |||
@@ -40,6 +40,5 @@ | |||
40 | #include <asm-generic/bitops/non-atomic.h> | 40 | #include <asm-generic/bitops/non-atomic.h> |
41 | #include <asm-generic/bitops/le.h> | 41 | #include <asm-generic/bitops/le.h> |
42 | #include <asm-generic/bitops/ext2-atomic.h> | 42 | #include <asm-generic/bitops/ext2-atomic.h> |
43 | #include <asm-generic/bitops/minix.h> | ||
44 | 43 | ||
45 | #endif /* __ASM_GENERIC_BITOPS_H */ | 44 | #endif /* __ASM_GENERIC_BITOPS_H */ |
diff --git a/include/asm-generic/bitops/minix-le.h b/include/asm-generic/bitops/minix-le.h deleted file mode 100644 index 70f95eef4161..000000000000 --- a/include/asm-generic/bitops/minix-le.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_ | ||
2 | #define _ASM_GENERIC_BITOPS_MINIX_LE_H_ | ||
3 | |||
4 | #define minix_test_and_set_bit(nr,addr) \ | ||
5 | __test_and_set_bit_le((nr), (unsigned long *)(addr)) | ||
6 | #define minix_set_bit(nr,addr) \ | ||
7 | __set_bit_le((nr), (unsigned long *)(addr)) | ||
8 | #define minix_test_and_clear_bit(nr,addr) \ | ||
9 | __test_and_clear_bit_le((nr), (unsigned long *)(addr)) | ||
10 | #define minix_test_bit(nr,addr) \ | ||
11 | test_bit_le((nr), (unsigned long *)(addr)) | ||
12 | #define minix_find_first_zero_bit(addr,size) \ | ||
13 | find_first_zero_bit_le((unsigned long *)(addr), (size)) | ||
14 | |||
15 | #endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */ | ||
diff --git a/include/asm-generic/bitops/minix.h b/include/asm-generic/bitops/minix.h deleted file mode 100644 index 91f42e87aa51..000000000000 --- a/include/asm-generic/bitops/minix.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_MINIX_H_ | ||
2 | #define _ASM_GENERIC_BITOPS_MINIX_H_ | ||
3 | |||
4 | #define minix_test_and_set_bit(nr,addr) \ | ||
5 | __test_and_set_bit((nr),(unsigned long *)(addr)) | ||
6 | #define minix_set_bit(nr,addr) \ | ||
7 | __set_bit((nr),(unsigned long *)(addr)) | ||
8 | #define minix_test_and_clear_bit(nr,addr) \ | ||
9 | __test_and_clear_bit((nr),(unsigned long *)(addr)) | ||
10 | #define minix_test_bit(nr,addr) \ | ||
11 | test_bit((nr),(unsigned long *)(addr)) | ||
12 | #define minix_find_first_zero_bit(addr,size) \ | ||
13 | find_first_zero_bit((unsigned long *)(addr),(size)) | ||
14 | |||
15 | #endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */ | ||