aboutsummaryrefslogtreecommitdiff
path: root/include/linux/byteorder
AgeCommit message (Collapse)Author
2010-08-14include: replace unifdef-y with header-ySam Ravnborg
unifdef-y and header-y has same semantic. So there is no need to have both. Drop the unifdef-y variant and sort all lines again Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2010-05-26Revert "endian: #define __BYTE_ORDER"Linus Torvalds
This reverts commit b3b77c8caef1750ebeea1054e39e358550ea9f55, which was also totally broken (see commit 0d2daf5cc858 that reverted the crc32 version of it). As reported by Stephen Rothwell, it causes problems on big-endian machines: > In file included from fs/jfs/jfs_types.h:33, > from fs/jfs/jfs_incore.h:26, > from fs/jfs/file.c:22: > fs/jfs/endian24.h:36:101: warning: "__LITTLE_ENDIAN" is not defined The kernel has never had that crazy "__BYTE_ORDER == __LITTLE_ENDIAN" model. It's not how we do things, and it isn't how we _should_ do things. So don't go there. Requested-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-25endian: #define __BYTE_ORDERJoakim Tjernlund
Linux does not define __BYTE_ORDER in its endian header files which makes some header files bend backwards to get at the current endian. Lets #define __BYTE_ORDER in big_endian.h/litte_endian.h to make it easier for header files that are used in user space too. In userspace the convention is that 1. _both_ __LITTLE_ENDIAN and __BIG_ENDIAN are defined, 2. you have to test for e.g. __BYTE_ORDER == __BIG_ENDIAN. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06byteorder: only use linux/swab.hHarvey Harrison
The first step to make swab.h a regular header that will include an asm/swab.h with arch overrides. Avoid the gratuitous differences introduced in the new linux/swab.h by naming the ___constant_swabXX bits and __fswabXX bits exactly as found in the old implementation in byteorder/swab[b].h Use this new swab.h in byteorder/[big|little]_endian.h and remove the two old swab headers. Although the inclusion of asm/byteorder.h looks strange in linux/swab.h, this will allow each arch to move the actual arch overrides for the swab bits in an asm file and then the includes can be cleaned up without requiring a flag day for all arches at once. Keep providing __fswabXX in case some userspace was using them directly, but the revised __swabXX should be used instead in any new code and will always do constant folding not dependent on the optimization level, which means the __constant versions can be phased out in-kernel. Arches that use the old-style arch macros will lose their optimized versions until they move to the new style, but at least they will still compile. Many arches have already moved and the patches to move the remaining arches are trivial. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20byteorder: provide swabb.h generically in asm/byteorder.hHarvey Harrison
This is needed during the transition to the new byteorder headers as the swabb.h functionality will be provided from asm/byteorder.h in the new version. To avoid breakage on arches still using the old implementation, provide swabb.h from asm/byteorder.h as well. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25endian: Always evaluate arguments.David Miller
Changeset 7fa897b91a3ea0f16c2873b869d7a0eef05acff4 ("ide: trivial sparse annotations") created an IDE bootup regression on big-endian systems. In drivers/ide/ide-iops.c, function ide_fixstring() we now have the loop: for (p = end ; p != s;) be16_to_cpus((u16 *)(p -= 2)); which will never terminate on big-endian because in such a configuration be16_to_cpus() evaluates to "do { } while (0)" Therefore, always evaluate the arguments to nop endian transformation operations. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-30Drop the exporting of empty <linux/byteorder/generic.h>Robert P. J. Day
Fix up the contents of <linux/byteorder/> so that it doesn't export a content-free generic.h to user space. This involves: * Removing the __KERNEL__ tests from generic.h and dropping it from Kbuild. * Wrapping the inclusions of generic.h in both big_endian.h and little_endian.h in __KERNEL__ tests. * Shifting big_endian.h and little_endian.h from header-y to unifdef-y in Kbuild. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08byteorder: move le32_add_cpu & friends from OCFS2 to coreMarcin Slusarz
This patchset moves le*_add_cpu and be*_add_cpu functions from OCFS2 to core header (1st), converts ext3 filesystem to this API (2nd) and replaces XFS different named functions with new ones (3rd). There are many places where these functions will be useful. Just look at: grep -r 'cpu_to_[ble12346]*([ble12346]*_to_cpu.*[-+]' linux-src/ Patch for ext3 is an example how conversions will probably look like. This patch: - move inline functions which add native byte order variable to little/big endian variable to core header * le16_add_cpu(__le16 *var, u16 val) * le32_add_cpu(__le32 *var, u32 val) * le64_add_cpu(__le64 *var, u64 val) * be32_add_cpu(__be32 *var, u32 val) - add for completeness: * be16_add_cpu(__be16 *var, u16 val) * be64_add_cpu(__be64 *var, u64 val) Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Mark Fasheh <mark.fasheh@oracle.com> Cc: David Chinner <dgc@sgi.com> Cc: Timothy Shimmin <tes@sgi.com> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08Fix compilation of drivers with -O0Michal Schmidt
It is sometimes useful to compile individual drivers with optimization disabled for easier debugging. Currently drivers which use htonl() and similar functions don't compile with -O0. This patch fixes it. It also removes obsolete and misleading comments. This header is not for userspace, so we don't have to care about strange programs these comments mention. (akpm: -O0 probably isn't a good idea, but this code looks pretty crufty and unuseful) Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08Fix constant folding and poor optimization in byte swapping codeTrent Piepho
Constant folding does not work for the swabXX() byte swapping functions, and the C versions optimize poorly. Attempting to initialize a global variable to swab16(0x1234) or put something like "case swab32(42):" in a switch statement will not compile. It can work, swab.h just isn't doing it correctly. This patch fixes that. Contrary to the comment in asm-i386/byteorder.h, gcc does not recognize the "C" version of swab16 and turn it into efficient code. gcc can do this, just not with the current code. The simple function: u16 foo(u16 x) { return swab16(x); } Would compile to: movzwl %ax, %eax movl %eax, %edx shrl $8, %eax sall $8, %edx orl %eax, %edx With this patch, it will compile to: rolw $8, %ax I also attempted to document the maze different macros/inline functions that are used to create the final product. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Cc: Francois-Rene Rideau <fare@tunes.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-11[PATCH] cleanup linux/byteorder/swabb.hAdrian Bunk
- no longer a userspace header - add #include <linux/types.h> for in-kernel compilation Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-11[PATCH] remove include/linux/byteorder/pdp_endian.hAdrian Bunk
include/linux/byteorder/pdp_endian.h is completely unused, and the comment in the file itself states that it's both untested and only a proof-of-concept. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2006-09-19[HEADERS] One line per header in Kbuild files to reduce conflictsDavid Woodhouse
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-18Add generic Kbuild files for 'make headers_install'David Woodhouse
This adds the Kbuild files listing the files which are to be installed by the 'headers_install' make target, in generic directories. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-01-08[PATCH] remove gcc-2 checksAndrew Morton
Remove various things which were checking for gcc-1.x and gcc-2.x compilers. From: Adrian Bunk <bunk@stusta.de> Some documentation updates and removes some code paths for gcc < 3.2. Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-19[BYTEORDER]: Document alignment and byteorder macrosEd L. Cashin
This patch comments the fact that although passing le64_to_cpup et al. is within the intended use of the byteorder macros, using get_unaligned is the recommended way to go. Signed-off-by: Ed L. Cashin <ecashin@coraid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28[PATCH] swabb.h warning fixesAndrew Morton
In file included from drivers/media/dvb/ttpci/av7110_hw.c:38: include/linux/byteorder/swabb.h:96: warning: type qualifiers ignored on function return type include/linux/byteorder/swabb.h:110: warning: type qualifiers ignored on function return type In file included from drivers/media/dvb/ttpci/av7110_v4l.c:36: include/linux/byteorder/swabb.h:96: warning: type qualifiers ignored on function return type include/linux/byteorder/swabb.h:110: warning: type qualifiers ignored on function return type In file included from drivers/media/dvb/ttpci/av7110_av.c:37: include/linux/byteorder/swabb.h:96: warning: type qualifiers ignored on function return type include/linux/byteorder/swabb.h:110: warning: type qualifiers ignored on function return type drivers/isdn/icn/icn.c:719:4: warning: #warning TODO test headroom or use skb->nb to flag ACK In file included from drivers/media/dvb/ttpci/av7110_ca.c:39: include/linux/byteorder/swabb.h:96: warning: type qualifiers ignored on function return type include/linux/byteorder/swabb.h:110: warning: type qualifiers ignored on function return type In file included from drivers/media/dvb/ttpci/av7110.c:41: include/linux/byteorder/swabb.h:96: warning: type qualifiers ignored on function return type include/linux/byteorder/swabb.h:110: warning: type qualifiers ignored on function return type Does declaring a function to return a const value actually mean something to gcc? Dunno. Kill it and replace sone `__inline__'s with `inline' too. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!