On 6/6/07, Nitin Gupta <[email protected]> wrote:
On 6/6/07, Christoph Hellwig <[email protected]> wrote:
> On Wed, Jun 06, 2007 at 06:04:17PM +0530, Nitin Gupta wrote:
> > Hi,
> >
> > This is kernel port of LZO1X-1 compressor and LZO1X decompressor (safe
> > version only).
> >
> > * Changes since 'take 6' (Full Changelog after this):
> > 1) Fixed unaligned memory access problems as pointed out by author --
> > LZO_UNALIGNED_OK_{2,4} collapsed to UNALIGNED_OK which is #defined for
> > archs that allow unaligned access (see lib/lzo1x/Makefile). For other
> > archs, we fall down to byte-by-byte access avoiding any unaligned
> > access. In original code, LZO_UNALIGNED_OK_{2,4} resp. describe if we
> > can do unaligned access for ushort and uint32.
>
> Please use get_unaligned() for any unaligned access in kernel space.
>
>
Done.
Just as a side note: I think retaining code to do byte-by-byte access
also is worth it, such as:
+ #ifdef UNALIGNED_OK
+ if (get_unaligned((const unsigned short *)m_pos) ==
+ get_unaligned((const unsigned short *)ip)) {
+#else
+ if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) {
+#endif
Since on archs where unaligned access is slower than byte-by-byte
access (e.g. where unaligned access dirty work is done in s/w), we do
not want to use get_unaligned() - instead simply byte-by-byte access
is better.
- Nitin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]