[lkml]   [2001]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Big-endian reading/writing cramfs (vs 2.4.10)
On Sep 28, 2001  15:54 -0700, Brad Bozarth wrote:
> > On Sep 28, 2001 14:58 -0700, Brad wrote:
> > > +#define CRAM_SWAB_16(x) ( ( (0x0000FF00 & (x)) >> 8 ) | \
> > > + ( (0x000000FF & (x)) << 8 ) )
> >
> > Why not just use the well-defined le16_to_cpu() and le32_to_cpu() macros?
> I did, originally... And it worked in inode.c, but I couldn't get mkcramfs
> to compile using those macros. It's outside of __KERNEL__ so I tried
> using __cpu_to_le32. The following error occurred:

I didn't realize that the header was also used in user-space. I would
still use the le32_to_cpu() style macros in the code, but only define
macros of your own if the kernel ones were not defined, using either
#ifndef __KERNEL__ or #ifndef le32_to_cpu, or both.

This way, you get the benefit of the fast asm-based instructions in
the kernel, and you only use the slow ones in user-space (mkcramfs)
where you don't really care.

Cheers, Andreas
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?" -- Dogbert

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:03    [W:0.045 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site