On Thu, 6 December 2007 17:27:26 +0100, Andi Drebes wrote:
> [...]
> > static inline u32 cramfs_offset(struct cramfs_inode *inode)
> > {
> > return le32_to_cpu(node->namelen_offset) >>
> > CRAMFS_NAMELEN_WIDTH;
> > }
> This requires changing the on-disk-structure (even the current "little endian
> only" one).
> The problem is caused by the way GCC (and perhaps other compilers aswell)
> arranges
> the 6 bits bits for the namelength and the 26 bits for the offset within the
> 32 bits.
> I spent quite some time on figuring out how this is actually done. For little
> endian
> machines, the data arranged in the following way:
>
> |o02.o01.n06.n05.n04.n03.n02.n01|o10.o09.o08.o07.o06.o05.o04.o03|
> |o18.o17.o16.o15.o14.o13.o12.o11|o26.o25.o24.o23.o22.o21.o20.o19|
How about shifting and masking _before_ converting to host endianness?
static inline u32 cramfs_offset(struct cramfs_inode *inode)
{
return le32_to_cpu(node->namelen_offset >>
CRAMFS_NAMELEN_WIDTH);
}
Jörn
--
With a PC, I always felt limited by the software available. On Unix,
I am limited only by my knowledge.
-- Peter J. Schoenster
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html