FTL and Endianity
Hi,
It is about FTL again.
I have got a MIPS big endian machine with CFI flash. And i obliged to hack ftl.c to provide correct endianity working. I mean, i must undef all cpu_to_le32 and the others macros. For little endian machines these macros do nothing, but for my big endian MIPS these macros are unusable too. Did anybody test FTL with big endian CPU? If no, we need to throw these macros out. In any case, we have to be able to configure this behaviour.
Quoted 3 lines · [email protected] said:
Did anybody test FTL with big endian CPU? If no, we need to throw
these macros out. In any case, we have to be able to configure this behaviour.
I didn't test - I think others did though. FTL is defined to be little-endian. Why do you say the macros are unusable?
--
dwmw2
Quoted 3 lines · David Woodhouse
I didn't test - I think others did though. FTL is defined to be little-endian. Why do you say the macros are unusable?
As i can see, cpu_to_le32 and others macros, are usable only when FTL reading the FTL header. But when the ftl_fromat utility creates an ftl partition, it doesn't swap any field of the header.
So, it doesn't matter on which endianity the FTL driver and ftl_format works, it must be the same only.
Am i wrong?
Quoted 4 lines · [email protected] said:
But when the
ftl_fromatutility creates an ftl partition, it doesn't swap any field of the header. So, it doesn't matter on which endianity the FTL driver andftl_formatworks, it must be the same only. Am i wrong?
You're right - except that it does matter in theory. The FTL spec is defined as little-endian. So while it would _work_ if you do it all backwards, it's technically wrong.
I'd be happier to fix ftl_format and ftl_check to do the byteswapping than to remove same from ftl.c.
--
dwmw2