[parted-devel] Regarding little and big endian support

Avinash Malik avimalik at gmail.com
Sat Jan 5 01:16:08 UTC 2008


Hello,
        I was going through the code for ext2_mkfs...
when libparted assigns values to the super-block or even to directory
structures etc.... (while making root, lost+found)
its always for example something like this...,
sblock.fs_version = PED_CPU_TO_LE32(fs_version). ??

for intel-architectures this should work fine.. but what happens when
one tries it on a BIG-ENDIAN arch? say SPARC
will this work?

I am asking this because I have almost finished writing support for
ufs_sun based on ufs in solaris....
But I had to write something like this...
#ifdef __LITTLE_ENDIAN
sblock.fs_version = PED_CPU_TO_LE32(fs_verison)
#endif
#ifdef __BIG_ENDIAN
sblock.fs_version = PED_CPU_TO_BE32(fs_version)
#endif

cheers,



-- 
Avi



More information about the parted-devel mailing list