linux-kernel-test/include
Harvey Harrison 064106a91b kernel: add common infrastructure for unaligned access
Create a linux/unaligned directory similar in spirit to the linux/byteorder
folder to hold generic implementations collected from various arches.

Currently there are five implementations:
1) packed_struct.h: C-struct based, from asm-generic/unaligned.h
2) le_byteshift.h: Open coded byte-swapping, heavily based on asm-arm
3) be_byteshift.h: Open coded byte-swapping, heavily based on asm-arm
4) memmove.h: taken from multiple implementations in tree
5) access_ok.h: taken from x86 and others, unaligned access is ok.

All of the new implementations checks for sizes not equal to 1,2,4,8
and will fail to link.

API additions:

get_unaligned_{le16|le32|le64|be16|be32|be64}(p) which is meant to replace
code of the form:
le16_to_cpu(get_unaligned((__le16 *)p));

put_unaligned_{le16|le32|le64|be16|be32|be64}(val, pointer) which is meant to
replace code of the form:
put_unaligned(cpu_to_le16(val), (__le16 *)p);

The headers that arches should include from their asm/unaligned.h:

access_ok.h : Wrappers of the byteswapping functions in asm/byteorder

Choose a particular implementation for little-endian access:
le_byteshift.h
le_memmove.h (arch must be LE)
le_struct.h (arch must be LE)

Choose a particular implementation for big-endian access:
be_byteshift.h
be_memmove.h (arch must be BE)
be_struct.h (arch must be BE)

After including as needed from the above, include unaligned/generic.h and
define your arch's get/put_unaligned as (for LE):

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:27 -07:00
..
acpi
asm-alpha alpha: teach the compiler that BUG doesn't return 2008-04-28 08:58:27 -07:00
asm-arm mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-avr32 mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-blackfin
asm-cris cris: add constfy to pgd_offset() 2008-04-28 08:58:28 -07:00
asm-frv mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-generic generalize asm-generic/ioctl.h to allow overriding values 2008-04-29 08:06:24 -07:00
asm-h8300
asm-ia64 dma/ia64: update ia64 machvecs, swiotlb.c 2008-04-29 08:06:12 -07:00
asm-m32r mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-m68k mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-m68knommu
asm-mips Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2008-04-28 10:51:43 -07:00
asm-mn10300 mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-parisc mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-powerpc proper __do_softirq() prototype 2008-04-29 08:06:02 -07:00
asm-ppc mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-s390 s390: implement pte special bit 2008-04-28 08:58:23 -07:00
asm-sh hugetlbfs: common code update for s390 2008-04-28 08:58:25 -07:00
asm-sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-04-28 09:45:57 -07:00
asm-sparc64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-04-28 09:45:57 -07:00
asm-um mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
asm-v850
asm-x86 x86: olpc: add One Laptop Per Child architecture support 2008-04-29 08:06:07 -07:00
asm-xtensa mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
crypto
keys
linux kernel: add common infrastructure for unaligned access 2008-04-29 08:06:27 -07:00
math-emu
media
mtd
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-28 09:44:11 -07:00
pcmcia
rdma IB: expand ib_umem_get() prototype 2008-04-29 08:06:12 -07:00
rxrpc
scsi
sound
video fbdev: platforming hecubafb and n411 2008-04-28 08:58:41 -07:00
xen
Kbuild