Re: daddr_t is inconsistent and barely used

Albert D. Cahalan (acahalan@cs.uml.edu)
Wed, 15 Aug 2001 23:52:37 -0400 (EDT)


Christoph Hellwig writes:
>>> In article <9980.997929632@kao2.melbourne.sgi.com> you wrote:

>>>> The use of daddr_t in freevxfs may give different in core
>>>> and disk layouts on different machines. Is that intended?.
...
> vx_daddr_t is for disk structures, daddr_t for core.

This is asking for trouble. The disk structures aren't about
to change. See include/linux/ext2_fs.h for a safe way to do
the on-disk structure. For the in-core stuff, "unsigned long"
is a perfectly fine data type -- and yes I know it gets wider
with a 64-bit system.

To save you the trouble of looking up my example:

/*
* Structure of a blocks group descriptor
*/
struct ext2_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__u16 bg_pad;
__u32 bg_reserved[3];
};

Don't forget to add explicit padding as needed to give natural alignment.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/