lkml.org 
[lkml]   [1999]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: le32_to_cpu() help...
Date
On Tue, 02 Nov 1999, Jes Sorensen wrote:
> >>>>> "Dony" == dony <dony.he@huawei.com.cn> writes:
>
> Dony> On Tue, 02 Nov 1999, Jes Sorensen wrote:
> >> They translate data to little endian from big endian on big endian
> >> CPUs, on little endian CPUs like the x86 they are noops. We need
> >> these because some hardware and other things like file systems
> >> wants data in little endian order no matter what type of system you
> >> are running on.
>
> Dony> Then when do we use le32_to_cpu( ) , and when do we use
> Dony> cpu_to_le32( )?
>
> You use le32_to_cpu() when you want to read data which is in little
> endian order and you use the other one when you try to write it.
>
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?


--
####################################
Linux is more powerful than windows
dony.he@huawei.com.cn
####################################
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:54    [from the cache]
©2003-2011 Jasper Spaans