Details
-
Bug
-
Resolution: Fixed
-
Minor
-
Lustre 2.6.0
-
3
-
12829
Description
There are a few places in the source where __
{LITTLE,BIG}_ENDIAN is tested with #ifdef:
static __inline__ int ext2_set_bit(int nr, void *addr) { #ifdef __BIG_ENDIAN return set_bit((nr ^ ((BITS_PER_LONG-1) & ~0x7)), addr); #else return set_bit(nr, addr); #endif }
const struct dt_rec *osd_quota_pack(struct osd_object *obj, const struct dt_rec *rec, union lquota_rec *quota_rec) { #ifdef __BIG_ENDIAN struct iam_descr *descr; LASSERT(obj->oo_dir != NULL); descr = obj->oo_dir->od_container.ic_descr; memcpy(quota_rec, rec, descr->id_rec_size); osd_quota_swab((char *)quota_rec, descr->id_rec_size); return (const struct dt_rec *)quota_rec; #else return rec; #endif }
In userspace, including endian.h always defines __BIG_ENDIAN to 4321. The correct test is '#if __BYTE_ORDER == __BIG_ENDIAN'. All uses of these macros should be audited.