File system image mkfs.c XV6
Posted: Tue Jun 20, 2023 11:46 am
Hello,
There is something that i cant understand.
Why all numerical data in mkfs.c XV6 file system image creator, are converted from big<-->little endian and vice versa.
example :
in the superblock :
then :
I have try to figure out why but it is pretty closed subject.
I hope this question relevant.
There is something that i cant understand.
Why all numerical data in mkfs.c XV6 file system image creator, are converted from big<-->little endian and vice versa.
example :
in the superblock :
Code: Select all
sb.size = xint(FSSIZE);
sb.nblocks = xint(nblocks);
sb.ninodes = xint(NINODES);
sb.nlog = xint(nlog);
sb.logstart = xint(2);
sb.inodestart = xint(2 + nlog);
sb.bmapstart = xint(2 + nlog + ninodeblocks);
Code: Select all
uint xint(uint x) {
uint y;
uchar* a = (uchar*)&y;
a[0] = x;
a[1] = x >> 8;
a[2] = x >> 16;
a[3] = x >> 24;
return y;
}
I hope this question relevant.