Re: le32_to_cpu() help...

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Tue, 2 Nov 1999 12:50:45 +0100


On Wed, Nov 03, 1999 at 02:47:08AM +0800, dony wrote:
> I know this. I just don't know what data is in little endian and what data is
> in big endian. say the following code ....
>
> struct ext2_super_block * es;
> struct super_block * sb;
> ..............................
> es->smtime=cpu_to_le32(CURRENT_TIME); //why here use cpu_to_le32?
> sb->u.ext2_sb.s_mount_state=le32_to_cpu(es->state); //why use le32_to_cpu here?

ext2's data structures are defined to be kept in little endian form.
It enables the exchange of filesystems between machines with differing
endianness.

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

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