X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fmd_attrs.c;h=fe8fca5b69d5d40297b2a6f65da27d0b09abf31a;hb=f4eeadee5ba5d4ab9d04918d8d81d18907daa831;hp=c65a645051c19ea54f44cedce3b4aa016ec9acdf;hpb=ccabce23bd9e366c345c852f565766a799f61238;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/md_attrs.c b/lustre/obdclass/md_attrs.c index c65a645..fe8fca5 100644 --- a/lustre/obdclass/md_attrs.c +++ b/lustre/obdclass/md_attrs.c @@ -47,9 +47,9 @@ void lustre_lma_init(struct lustre_mdt_attrs *lma, const struct lu_fid *fid, /* If a field is added in struct lustre_mdt_attrs, zero it explicitly * and change the test below. */ - CLASSERT(sizeof(*lma) == - (offsetof(struct lustre_mdt_attrs, lma_self_fid) + - sizeof(lma->lma_self_fid))); + BUILD_BUG_ON(sizeof(*lma) != + (offsetof(struct lustre_mdt_attrs, lma_self_fid) + + sizeof(lma->lma_self_fid))); } EXPORT_SYMBOL(lustre_lma_init); @@ -71,7 +71,7 @@ EXPORT_SYMBOL(lustre_lma_swab); void lustre_loa_init(struct lustre_ost_attrs *loa, const struct lu_fid *fid, __u32 compat, __u32 incompat) { - CLASSERT(sizeof(*loa) == LMA_OLD_SIZE); + BUILD_BUG_ON(sizeof(*loa) != LMA_OLD_SIZE); memset(&loa->loa_parent_fid, 0, sizeof(*loa) - offsetof(typeof(*loa), loa_parent_fid)); @@ -112,6 +112,22 @@ void lustre_loa_swab(struct lustre_ost_attrs *loa, bool to_cpu) EXPORT_SYMBOL(lustre_loa_swab); /** + * Swab, if needed, SOM structure which is stored on-disk in little-endian + * order. + * + * \param attrs - is a pointer to the SOM structure to be swabbed. + */ +void lustre_som_swab(struct lustre_som_attrs *attrs) +{ +#ifdef __BIG_ENDIAN + __swab16s(&attrs->lsa_valid); + __swab64s(&attrs->lsa_size); + __swab64s(&attrs->lsa_blocks); +#endif +} +EXPORT_SYMBOL(lustre_som_swab); + +/** * Swab, if needed, HSM structure which is stored on-disk in little-endian * order. *