From patchwork Thu Oct 21 14:41:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 271451 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9LEovXg011535 for ; Thu, 21 Oct 2010 14:51:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758551Ab0JUOpa (ORCPT ); Thu, 21 Oct 2010 10:45:30 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:61981 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757925Ab0JUOp1 (ORCPT ); Thu, 21 Oct 2010 10:45:27 -0400 Received: by ywi6 with SMTP id 6so2781842ywi.19 for ; Thu, 21 Oct 2010 07:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=8ymfhvBR4E+m20Efkslx5E/7OipDqO9BZxGYXYIuw4g=; b=KrturKaw1beu6Ys0wiLBBLwuBh6Pg0joq5yZppjI6h6y2+DoNEyTQLsGOXVKzo8o17 SJFtqWqjGs+osNbzyqPSjQ5URLwKmMnSIcJmROpUtKzkKVo9N044LFAXdAWmBXpd8odB 0jUi5szHgJCYdvsoxQ89HN82njC0zK5M0COYk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=vPSAUCiB9bKIXE3JQy1O2DjDhYCHsq3v/vEDd+8a66I7vlZkgHjlrDTt5otQUO+ti4 FUzPctwEBP5WXXF15CTFSLyrVz5t27ngBI1PcEzzNCciJVa+mYgC3Qe9rnpSFARZkwHv w7mhuk2a+37wcIqeYLAxuRabKCKTLrjuzSjYY= Received: by 10.42.175.138 with SMTP id ba10mr648896icb.413.1287672325877; Thu, 21 Oct 2010 07:45:25 -0700 (PDT) Received: from localhost (p4007-adsao03yokonib2-acca.kanagawa.ocn.ne.jp [219.165.74.7]) by mx.google.com with ESMTPS id u6sm1834640ibd.12.2010.10.21.07.45.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Oct 2010 07:45:24 -0700 (PDT) From: Akinobu Mita To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Arnd Bergmann , Christoph Hellwig , Andrew Morton Cc: Akinobu Mita , Greg Ungerer , Geert Uytterhoeven , Roman Zippel , Andreas Schwab , linux-m68k@vger.kernel.org, Martin Schwidefsky , Heiko Carstens , linux390@de.ibm.com, linux-s390@vger.kernel.org, Yoshinori Sato , Michal Simek , microblaze-uclinux@itee.uq.edu.au, "David S. Miller" , sparclinux@vger.kernel.org, Hirokazu Takata , linux-m32r@ml.linux-m32r.org, Ralf Baechle , linux-mips@linux-mips.org, Paul Mundt , linux-sh@vger.kernel.org, Chris Zankel Subject: [PATCH v2 22/22] bitops: remove minix bitops from asm/bitops.h Date: Thu, 21 Oct 2010 23:41:17 +0900 Message-Id: <1287672077-5797-23-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1287672077-5797-1-git-send-email-akinobu.mita@gmail.com> References: <1287672077-5797-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Oct 2010 14:51:04 +0000 (UTC) diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index 822433a..85b8152 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]) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) -#include - #endif /* __KERNEL__ */ #endif /* _ALPHA_BITOPS_H */ diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index ac2edb4..59a2a2b 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -332,20 +332,6 @@ static inline int fls(int x) #define ext2_clear_bit_atomic(lock,nr,p) \ test_and_clear_le_bit(nr, (unsigned long *)(p)) -/* - * Minix is defined to use little-endian byte ordering. - * These do not need to be atomic. - */ -#define minix_set_bit(nr,p) \ - __set_le_bit(nr, (unsigned long *)(p)) -#define minix_test_bit(nr,p) \ - test_le_bit(nr, (unsigned long *)(p)) -#define minix_test_and_set_bit(nr,p) \ - __test_and_set_le_bit(nr, (unsigned long *)(p)) -#define minix_test_and_clear_bit(nr,p) \ - __test_and_clear_le_bit(nr, (unsigned long *)(p)) -#define minix_find_first_zero_bit(p,sz) \ - find_first_zero_le_bit((unsigned long *)(p), sz) #endif /* __KERNEL__ */ diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h index 73a163a..72444d9 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) #include #include -#include #endif /* __ASM_AVR32_BITOPS_H */ diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h index 2c549f7..68843fa 100644 --- a/arch/blackfin/include/asm/bitops.h +++ b/arch/blackfin/include/asm/bitops.h @@ -27,7 +27,6 @@ #include #include -#include #ifndef CONFIG_SMP #include diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 71bea40..310e0de 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) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) -#include #include #endif /* __KERNEL__ */ diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h index e3ea644..a1d00b0 100644 --- a/arch/frv/include/asm/bitops.h +++ b/arch/frv/include/asm/bitops.h @@ -406,8 +406,6 @@ int __ilog2_u64(u64 n) #define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) #define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr)) -#include - #endif /* __KERNEL__ */ #endif /* _ASM_BITOPS_H */ diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h index 23cea66..e856c1b 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) #include #include #include -#include #endif /* __KERNEL__ */ diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index 336984a..b76f7e0 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) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) -#include #include #endif /* __KERNEL__ */ diff --git a/arch/m32r/include/asm/bitops.h b/arch/m32r/include/asm/bitops.h index cdfb4c8..6300f22 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) #include #include -#include #endif /* __KERNEL__ */ diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h index f31ed5a..5f06275 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) #include #include -/* Bitmap functions for the minix filesystem */ - -static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) -{ - const unsigned short *p = vaddr, *addr = vaddr; - unsigned short num; - - if (!size) - return 0; - - size = (size >> 4) + ((size & 15) > 0); - while (*p++ == 0xffff) { - if (--size == 0) - return (p - addr) << 4; - } - - num = *--p; - return ((p - addr) << 4) + ffz(num); -} - -#define minix_test_and_set_bit(nr, addr) __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) -#define minix_set_bit(nr,addr) __set_bit((nr) ^ 16, (unsigned long *)(addr)) -#define minix_test_and_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) - -static inline int minix_test_bit(int nr, const void *vaddr) -{ - const unsigned short *p = vaddr; - return (p[nr >> 4] & (1U << (nr & 15))) != 0; -} - /* Bitmap functions for little endian. */ #define __set_le_bit(nr, addr) \ diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index 07ce5aa..6a2202c 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h @@ -706,7 +706,6 @@ static inline int ffs(int word) #include #include -#include #endif /* __KERNEL__ */ diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index e1a9768..94ee844 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h @@ -234,7 +234,6 @@ int ffs(int x) test_and_clear_bit((nr), (addr)) #include -#include #endif /* __KERNEL__ */ #endif /* __ASM_BITOPS_H */ diff --git a/arch/parisc/include/asm/bitops.h b/arch/parisc/include/asm/bitops.h index 919d7ed..43c516f 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) #endif /* __KERNEL__ */ -#include - #endif /* _PARISC_BITOPS_H */ diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index eb9ce7f..bf5ccfc 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h @@ -308,20 +308,6 @@ unsigned long find_next_le_bit(const unsigned long *addr, #define ext2_clear_bit_atomic(lock, nr, addr) \ test_and_clear_le_bit((nr), (unsigned long*)addr) -/* Bitmap functions for the minix filesystem. */ - -#define minix_test_and_set_bit(nr,addr) \ - __test_and_set_le_bit(nr, (unsigned long *)addr) -#define minix_set_bit(nr,addr) \ - __set_le_bit(nr, (unsigned long *)addr) -#define minix_test_and_clear_bit(nr,addr) \ - __test_and_clear_le_bit(nr, (unsigned long *)addr) -#define minix_test_bit(nr,addr) \ - test_le_bit(nr, (unsigned long *)addr) - -#define minix_find_first_zero_bit(addr,size) \ - find_first_zero_le_bit((unsigned long *)addr, size) - #include #endif /* __KERNEL__ */ diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h index 1bd1e11..e537613 100644 --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h @@ -842,7 +842,6 @@ static inline int find_next_le_bit(void *vaddr, unsigned long size, #define ext2_clear_bit_atomic(lock, nr, addr) \ test_and_clear_le_bit((nr), (unsigned long *)(addr)) -#include #endif /* __KERNEL__ */ diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index fc5cd5b..90fa3e4 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) #include #include #include -#include #include #include #include diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h index 75da6f8..25a6766 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) #include #include #include -#include #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index 66db28e..38e9aa1 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) #define ext2_clear_bit_atomic(lock,nr,addr) \ test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr)) -#include - #endif /* __KERNEL__ */ #endif /* defined(_SPARC64_BITOPS_H) */ diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h index 5447add..132e6bb 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) #include #include #include -#include #endif /* _ASM_TILE_BITOPS_H */ diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 3c95e07..69d5813 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) #define ext2_clear_bit_atomic(lock, nr, addr) \ test_and_clear_bit((nr), (unsigned long *)(addr)) -#include - #endif /* __KERNEL__ */ #endif /* _ASM_X86_BITOPS_H */ diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h index a56b7b5..c8fac8d 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) #include #include #include -#include #endif /* __KERNEL__ */ diff --git a/fs/minix/Kconfig b/fs/minix/Kconfig index 0fd7ca9..6624684 100644 --- a/fs/minix/Kconfig +++ b/fs/minix/Kconfig @@ -15,3 +15,11 @@ config MINIX_FS module will be called minix. Note that the file system of your root partition (the one containing the directory /) cannot be compiled as a module. + +config MINIX_FS_NATIVE_ENDIAN + def_bool MINIX_FS + depends on H8300 || M32R || MICROBLAZE || MIPS || S390 || SUPERH || SPARC || XTENSA || (M68K && !MMU) + +config MINIX_FS_BIG_ENDIAN_16BIT_INDEXED + def_bool MINIX_FS + depends on M68K && MMU diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 407b1c8..9dfd62c 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -88,4 +88,83 @@ static inline struct minix_inode_info *minix_i(struct inode *inode) return list_entry(inode, struct minix_inode_info, vfs_inode); } +#if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) && \ + defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) + +#error Minix file system byte order broken + +#elif defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) + +/* + * big-endian 32 or 64 bit indexed bitmaps on big-endian system or + * little-endian bitmaps on little-endian system + */ + +#define minix_test_and_set_bit(nr, addr) \ + __test_and_set_bit((nr), (unsigned long *)(addr)) +#define minix_set_bit(nr, addr) \ + __set_bit((nr), (unsigned long *)(addr)) +#define minix_test_and_clear_bit(nr, addr) \ + __test_and_clear_bit((nr), (unsigned long *)(addr)) +#define minix_test_bit(nr, addr) \ + test_bit((nr), (unsigned long *)(addr)) +#define minix_find_first_zero_bit(addr, size) \ + find_first_zero_bit((unsigned long *)(addr), (size)) + +#elif defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) + +/* + * big-endian 16bit indexed bitmaps + */ + +static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) +{ + const unsigned short *p = vaddr, *addr = vaddr; + unsigned short num; + + if (!size) + return 0; + + size = (size >> 4) + ((size & 15) > 0); + while (*p++ == 0xffff) { + if (--size == 0) + return (p - addr) << 4; + } + + num = *--p; + return ((p - addr) << 4) + ffz(num); +} + +#define minix_test_and_set_bit(nr, addr) \ + __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) +#define minix_set_bit(nr, addr) \ + __set_bit((nr) ^ 16, (unsigned long *)(addr)) +#define minix_test_and_clear_bit(nr, addr) \ + __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) + +static inline int minix_test_bit(int nr, const void *vaddr) +{ + const unsigned short *p = vaddr; + return (p[nr >> 4] & (1U << (nr & 15))) != 0; +} + +#else + +/* + * little-endian bitmaps + */ + +#define minix_test_and_set_bit(nr, addr) \ + __test_and_set_le_bit((nr), (unsigned long *)(addr)) +#define minix_set_bit(nr, addr) \ + __set_le_bit((nr), (unsigned long *)(addr)) +#define minix_test_and_clear_bit(nr, addr) \ + __test_and_clear_le_bit((nr), (unsigned long *)(addr)) +#define minix_test_bit(nr, addr) \ + test_le_bit((nr), (unsigned long *)(addr)) +#define minix_find_first_zero_bit(addr, size) \ + find_first_zero_le_bit((unsigned long *)(addr), (size)) + +#endif + #endif /* FS_MINIX_H */ diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index dd7c014..280ca7a 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -40,6 +40,5 @@ #include #include #include -#include #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 f366cfa..0000000 --- a/include/asm-generic/bitops/minix-le.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_ -#define _ASM_GENERIC_BITOPS_MINIX_LE_H_ - -#define minix_test_and_set_bit(nr,addr) \ - __test_and_set_le_bit((nr), (unsigned long *)(addr)) -#define minix_set_bit(nr,addr) \ - __set_le_bit((nr), (unsigned long *)(addr)) -#define minix_test_and_clear_bit(nr,addr) \ - __test_and_clear_le_bit((nr), (unsigned long *)(addr)) -#define minix_test_bit(nr,addr) \ - test_le_bit((nr), (unsigned long *)(addr)) -#define minix_find_first_zero_bit(addr,size) \ - find_first_zero_le_bit((unsigned long *)(addr), (size)) - -#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 91f42e8..0000000 --- a/include/asm-generic/bitops/minix.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _ASM_GENERIC_BITOPS_MINIX_H_ -#define _ASM_GENERIC_BITOPS_MINIX_H_ - -#define minix_test_and_set_bit(nr,addr) \ - __test_and_set_bit((nr),(unsigned long *)(addr)) -#define minix_set_bit(nr,addr) \ - __set_bit((nr),(unsigned long *)(addr)) -#define minix_test_and_clear_bit(nr,addr) \ - __test_and_clear_bit((nr),(unsigned long *)(addr)) -#define minix_test_bit(nr,addr) \ - test_bit((nr),(unsigned long *)(addr)) -#define minix_find_first_zero_bit(addr,size) \ - find_first_zero_bit((unsigned long *)(addr),(size)) - -#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */