From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: [PATCH 9/9] Amiga SmartFileSystem Date: Mon, 9 Feb 2009 02:22:08 -0700 Message-ID: <20090209092208.GN31509@parisc-linux.org> References: <187c6cc60902082257s4abd8598o973306a16d59e4f7@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Pavel Fedin Return-path: Received: from palinux.external.hp.com ([192.25.206.14]:55748 "EHLO mail.parisc-linux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbZBIJWK (ORCPT ); Mon, 9 Feb 2009 04:22:10 -0500 Content-Disposition: inline In-Reply-To: <187c6cc60902082257s4abd8598o973306a16d59e4f7@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Feb 09, 2009 at 09:57:21AM +0300, Pavel Fedin wrote: > +struct fsBlockHeader { > + u32 id; /* 4 character id string of this block */ > + u32 checksum; /* The checksum */ > + u32 ownblock; /* The blocknumber of the block this > block is stored at */ > +}; This (and other) on-disc structs can be annotated so that automated tools like sparse can tell you if you've omitted an endian conversion somewhere. You can see examples of this in ext2: struct ext2_group_desc { __le32 bg_block_bitmap; /* Blocks bitmap block */ __le32 bg_inode_bitmap; /* Inodes bitmap block */ __le32 bg_inode_table; /* Inodes table block */ __le16 bg_free_blocks_count; /* Free blocks count */ __le16 bg_free_inodes_count; /* Free inodes count */ __le16 bg_used_dirs_count; /* Directories count */ __le16 bg_pad; __le32 bg_reserved[3]; }; Obviously, you'd want to use __be32 instead of __le32, but the principle is there. -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."