From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?SsO2cm4=?= Engel Subject: Re: [PATCH 1/2] Make cramfs little endian only Date: Thu, 6 Dec 2007 17:47:12 +0100 Message-ID: <20071206164711.GB3738@lazybastard.org> References: <200712041259.52118.lists-receive@programmierforen.de> <200712052257.43061.lists-receive@programmierforen.de> <200712061727.27229.lists-receive@programmierforen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Linus Torvalds , Jeff Garzik , J?rn Engel , linux-fsdevel@vger.kernel.org, Karel Zak , Andrew Morton , Christoph Hellwig , Phillip Lougher To: Andi Drebes Return-path: Received: from lazybastard.de ([212.112.238.170]:46970 "EHLO longford.lazybastard.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbXLFQwi (ORCPT ); Thu, 6 Dec 2007 11:52:38 -0500 Content-Disposition: inline In-Reply-To: <200712061727.27229.lists-receive@programmierforen.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 "littl= e endian only" one). > The problem is caused by the way GCC (and perhaps other compilers asw= ell) arranges > the 6 bits bits for the namelength and the 26 bits for the offset wit= hin the 32 bits. > I spent quite some time on figuring out how this is actually done. Fo= r little endian > machines, the data arranged in the following way: >=20 > |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|=20 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=C3=B6rn --=20 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html