Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
There are some code using LUSTRE_MSG_MAGIC to check local endianness, such as:
void lustre_lma_swab(struct lustre_mdt_attrs *lma)
{
/* Use LUSTRE_MSG_MAGIC to detect local endianess. */
if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) {
__swab32s(&lma->lma_compat);
__swab32s(&lma->lma_incompat);
lustre_swab_lu_fid(&lma->lma_self_fid);
}
};
It is not a good way of determining the CPU endianness, it is gratuitously confusing for no reason not only because it has nothing specific to do with LUSTRE_MSG_MAGIC, but also because this is a compile-time check that looks like a runtime check. Instead, we can fix it with checking "__BIG_ENDIAN".