From 38392dc0ed32368cc195558a74c6606465beb53b Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Tue, 29 Oct 2019 03:44:35 +0530 Subject: [PATCH] LU-12923 utils: Use BUILD_BUG_ON() for wiretest.c This patch replaces all CLASSERT() with BUILD_BUG_ON() for file lustre/utils/wiretest.c This is done by modifying local defined CLASSERT() macro with BUILD_BUG_ON() macro. This replicates the kernel defined BUILD_BUG_ON() where it asserts when condition is true. This is user-space, therefore we cannot use kernel define BUILD_BUG_ON() here and had to rely locally defined BUILD_BUG_ON() This patch also fixes few space/tab issues reported by checkpatch Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: I2f8bfdbd034a2c8059cf356dd72e4255f4999f8e Reviewed-on: https://review.whamcloud.com/36647 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Ben Evans Reviewed-by: Petros Koutoupis Reviewed-by: Neil Brown Reviewed-by: Oleg Drokin --- lustre/utils/wiretest.c | 246 ++++++++++++++++++++++++------------------------ 1 file changed, 124 insertions(+), 122 deletions(-) diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 68b6691..6d30541 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -43,14 +43,16 @@ #include #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; } -#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;} +#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__); ret = 1; } /* - * Compile-time LASSERT, which verifies correctness at compile-time rather - * than runtime. If "cond" is true, then there are two different cases - * ("(non-zero)" and "0"). If "cond" is false, then there are two identical - * cases ("0" and "0"), which is an error that causes the compiler to complain. + * BUILD_BUG_ON() is Compile-time LASSERT, which verifies correctness at + * compile-time rather than runtime. If "cond" is true, then there are two + * identical cases ("0" and "0"), which is an error that causes the compiler to + * complain. If "cond" is false, then there are two different cases + * ("(non-zero)" and "0"). + * */ -#define CLASSERT(cond) do {switch (1) {case (cond): case 0: break; } } while (0) +#define BUILD_BUG_ON(cond) do {switch (0) {case (cond): case 1: break; } } while (0) int ret; @@ -58,12 +60,12 @@ void lustre_assert_wire_constants(void); int main() { - lustre_assert_wire_constants(); + lustre_assert_wire_constants(); - if (ret == 0) - printf("wire constants OK\n"); + if (ret == 0) + printf("wire constants OK\n"); - return ret; + return ret; } void lustre_assert_wire_constants(void) @@ -83,7 +85,7 @@ void lustre_assert_wire_constants(void) MDS_DIR_END_OFF); LASSERTF(DEAD_HANDLE_MAGIC == 0xdeadbeefcafebabeULL, "found 0x%.16llxULL\n", DEAD_HANDLE_MAGIC); - CLASSERT(MTI_NAME_MAXLEN == 64); + BUILD_BUG_ON(MTI_NAME_MAXLEN != 64); LASSERTF(OST_REPLY == 0, "found %lld\n", (long long)OST_REPLY); LASSERTF(OST_GETATTR == 1, "found %lld\n", @@ -348,24 +350,24 @@ void lustre_assert_wire_constants(void) (long long)LCK_MAXMODE); LASSERTF(LCK_MODE_NUM == 8, "found %lld\n", (long long)LCK_MODE_NUM); - CLASSERT(LDLM_PLAIN == 10); - CLASSERT(LDLM_EXTENT == 11); - CLASSERT(LDLM_FLOCK == 12); - CLASSERT(LDLM_IBITS == 13); - CLASSERT(LDLM_MAX_TYPE == 14); - CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0); - CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1); + BUILD_BUG_ON(LDLM_PLAIN != 10); + BUILD_BUG_ON(LDLM_EXTENT != 11); + BUILD_BUG_ON(LDLM_FLOCK != 12); + BUILD_BUG_ON(LDLM_IBITS != 13); + BUILD_BUG_ON(LDLM_MAX_TYPE != 14); + BUILD_BUG_ON(LUSTRE_RES_ID_SEQ_OFF != 0); + BUILD_BUG_ON(LUSTRE_RES_ID_VER_OID_OFF != 1); LASSERTF(OUT_UPDATE == 1000, "found %lld\n", (long long)OUT_UPDATE); LASSERTF(OUT_UPDATE_LAST_OPC == 1001, "found %lld\n", (long long)OUT_UPDATE_LAST_OPC); - CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2); - CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3); - CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3); - CLASSERT(LQUOTA_TYPE_USR == 0); - CLASSERT(LQUOTA_TYPE_GRP == 1); - CLASSERT(LQUOTA_RES_MD == 1); - CLASSERT(LQUOTA_RES_DT == 2); + BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_SEQ_OFF != 2); + BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_VER_OID_OFF != 3); + BUILD_BUG_ON(LUSTRE_RES_ID_HSH_OFF != 3); + BUILD_BUG_ON(LQUOTA_TYPE_USR != 0); + BUILD_BUG_ON(LQUOTA_TYPE_GRP != 1); + BUILD_BUG_ON(LQUOTA_RES_MD != 1); + BUILD_BUG_ON(LQUOTA_RES_DT != 2); LASSERTF(OBD_PING == 400, "found %lld\n", (long long)OBD_PING); LASSERTF(OBD_IDX_READ == 403, "found %lld\n", @@ -906,7 +908,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ptlrpc_body_v3, pb_slv)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv) == 8, "found %lld\n", (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv)); - CLASSERT(PTLRPC_NUM_VERSIONS == 4); + BUILD_BUG_ON(PTLRPC_NUM_VERSIONS != 4); LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_pre_versions) == 88, "found %lld\n", (long long)(int)offsetof(struct ptlrpc_body_v3, pb_pre_versions)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_pre_versions) == 32, "found %lld\n", @@ -927,7 +929,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ptlrpc_body_v3, pb_padding64_2)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2) == 8, "found %lld\n", (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2)); - CLASSERT(LUSTRE_JOBID_SIZE == 32); + BUILD_BUG_ON(LUSTRE_JOBID_SIZE != 32); LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_jobid) == 152, "found %lld\n", (long long)(int)offsetof(struct ptlrpc_body_v3, pb_jobid)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_jobid) == 32, "found %lld\n", @@ -1622,31 +1624,31 @@ void lustre_assert_wire_constants(void) OBD_MD_FLOSTLAYOUT); LASSERTF(OBD_MD_FLPROJID == (0x0100000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLPROJID); - CLASSERT(OBD_FL_INLINEDATA == 0x00000001); - CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002); - CLASSERT(OBD_FL_DELORPHAN == 0x00000004); - CLASSERT(OBD_FL_NORPC == 0x00000008); - CLASSERT(OBD_FL_IDONLY == 0x00000010); - CLASSERT(OBD_FL_RECREATE_OBJS == 0x00000020); - CLASSERT(OBD_FL_DEBUG_CHECK == 0x00000040); - CLASSERT(OBD_FL_NO_USRQUOTA == 0x00000100); - CLASSERT(OBD_FL_NO_GRPQUOTA == 0x00000200); - CLASSERT(OBD_FL_CREATE_CROW == 0x00000400); - CLASSERT(OBD_FL_SRVLOCK == 0x00000800); - CLASSERT(OBD_FL_CKSUM_CRC32 == 0x00001000); - CLASSERT(OBD_FL_CKSUM_ADLER == 0x00002000); - CLASSERT(OBD_FL_CKSUM_CRC32C == 0x00004000); - CLASSERT(OBD_FL_CKSUM_T10IP512 == 0x00005000); - CLASSERT(OBD_FL_CKSUM_T10IP4K == 0x00006000); - CLASSERT(OBD_FL_CKSUM_T10CRC512 == 0x00007000); - CLASSERT(OBD_FL_CKSUM_T10CRC4K == 0x00008000); - CLASSERT(OBD_FL_CKSUM_RSVD3 == 0x00010000); - CLASSERT(OBD_FL_SHRINK_GRANT == 0x00020000); - CLASSERT(OBD_FL_MMAP == 0x00040000); - CLASSERT(OBD_FL_RECOV_RESEND == 0x00080000); - CLASSERT(OBD_FL_NOSPC_BLK == 0x00100000); - CLASSERT(OBD_FL_FLUSH == 0x00200000); - CLASSERT(OBD_FL_SHORT_IO == 0x00400000); + BUILD_BUG_ON(OBD_FL_INLINEDATA != 0x00000001); + BUILD_BUG_ON(OBD_FL_OBDMDEXISTS != 0x00000002); + BUILD_BUG_ON(OBD_FL_DELORPHAN != 0x00000004); + BUILD_BUG_ON(OBD_FL_NORPC != 0x00000008); + BUILD_BUG_ON(OBD_FL_IDONLY != 0x00000010); + BUILD_BUG_ON(OBD_FL_RECREATE_OBJS != 0x00000020); + BUILD_BUG_ON(OBD_FL_DEBUG_CHECK != 0x00000040); + BUILD_BUG_ON(OBD_FL_NO_USRQUOTA != 0x00000100); + BUILD_BUG_ON(OBD_FL_NO_GRPQUOTA != 0x00000200); + BUILD_BUG_ON(OBD_FL_CREATE_CROW != 0x00000400); + BUILD_BUG_ON(OBD_FL_SRVLOCK != 0x00000800); + BUILD_BUG_ON(OBD_FL_CKSUM_CRC32 != 0x00001000); + BUILD_BUG_ON(OBD_FL_CKSUM_ADLER != 0x00002000); + BUILD_BUG_ON(OBD_FL_CKSUM_CRC32C != 0x00004000); + BUILD_BUG_ON(OBD_FL_CKSUM_T10IP512 != 0x00005000); + BUILD_BUG_ON(OBD_FL_CKSUM_T10IP4K != 0x00006000); + BUILD_BUG_ON(OBD_FL_CKSUM_T10CRC512 != 0x00007000); + BUILD_BUG_ON(OBD_FL_CKSUM_T10CRC4K != 0x00008000); + BUILD_BUG_ON(OBD_FL_CKSUM_RSVD3 != 0x00010000); + BUILD_BUG_ON(OBD_FL_SHRINK_GRANT != 0x00020000); + BUILD_BUG_ON(OBD_FL_MMAP != 0x00040000); + BUILD_BUG_ON(OBD_FL_RECOV_RESEND != 0x00080000); + BUILD_BUG_ON(OBD_FL_NOSPC_BLK != 0x00100000); + BUILD_BUG_ON(OBD_FL_FLUSH != 0x00200000); + BUILD_BUG_ON(OBD_FL_SHORT_IO != 0x00400000); /* Checks for struct lov_ost_data_v1 */ LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n", @@ -1695,7 +1697,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0])); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0])); - CLASSERT(LOV_MAGIC_V1 == (0x0BD10000 | 0x0BD0)); + BUILD_BUG_ON(LOV_MAGIC_V1 != (0x0BD10000 | 0x0BD0)); /* Checks for struct lov_mds_md_v3 */ LASSERTF((int)sizeof(struct lov_mds_md_v3) == 48, "found %lld\n", @@ -1724,7 +1726,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen)); - CLASSERT(LOV_MAXPOOLNAME == 15); + BUILD_BUG_ON(LOV_MAXPOOLNAME != 15); LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[15 + 1]) == 48, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[15 + 1])); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pool_name[15 + 1]) == 1, "found %lld\n", @@ -1733,7 +1735,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_objects[0])); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0]) == 24, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0])); - CLASSERT(LOV_MAGIC_V3 == (0x0BD30000 | 0x0BD0)); + BUILD_BUG_ON(LOV_MAGIC_V3 != (0x0BD30000 | 0x0BD0)); LASSERTF(LOV_PATTERN_RAID0 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)LOV_PATTERN_RAID0); LASSERTF(LOV_PATTERN_RAID1 == 0x00000002UL, "found 0x%.8xUL\n", @@ -1822,7 +1824,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_comp_md_v1, lcm_entries[0])); LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]) == 48, "found %lld\n", (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0])); - CLASSERT(LOV_MAGIC_COMP_V1 == (0x0BD60000 | 0x0BD0)); + BUILD_BUG_ON(LOV_MAGIC_COMP_V1 != (0x0BD60000 | 0x0BD0)); LASSERTF(LCM_FL_NONE == 0, "found %lld\n", (long long)LCM_FL_NONE); LASSERTF(LCM_FL_RDONLY == 1, "found %lld\n", @@ -1879,12 +1881,12 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_stripe_fids[0])); LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0]) == 16, "found %lld\n", (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0])); - CLASSERT(LMV_MAGIC_V1 == 0x0CD20CD0); - CLASSERT(LMV_MAGIC_STRIPE == 0x0CD40CD0); - CLASSERT(LMV_HASH_TYPE_MASK == 0x0000ffff); - CLASSERT(LMV_HASH_FLAG_LOST_LMV == 0x10000000); - CLASSERT(LMV_HASH_FLAG_BAD_TYPE == 0x20000000); - CLASSERT(LMV_HASH_FLAG_MIGRATION == 0x80000000); + BUILD_BUG_ON(LMV_MAGIC_V1 != 0x0CD20CD0); + BUILD_BUG_ON(LMV_MAGIC_STRIPE != 0x0CD40CD0); + BUILD_BUG_ON(LMV_HASH_TYPE_MASK != 0x0000ffff); + BUILD_BUG_ON(LMV_HASH_FLAG_LOST_LMV != 0x10000000); + BUILD_BUG_ON(LMV_HASH_FLAG_BAD_TYPE != 0x20000000); + BUILD_BUG_ON(LMV_HASH_FLAG_MIGRATION != 0x80000000); /* Checks for struct obd_statfs */ LASSERTF((int)sizeof(struct obd_statfs) == 144, "found %lld\n", @@ -2198,7 +2200,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct idx_info, ii_pad3)); LASSERTF((int)sizeof(((struct idx_info *)0)->ii_pad3) == 8, "found %lld\n", (long long)(int)sizeof(((struct idx_info *)0)->ii_pad3)); - CLASSERT(IDX_INFO_MAGIC == 0x3D37CC37); + BUILD_BUG_ON(IDX_INFO_MAGIC != 0x3D37CC37); /* Checks for struct lu_idxpage */ LASSERTF((int)sizeof(struct lu_idxpage) == 16, "found %lld\n", @@ -2219,7 +2221,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lu_idxpage, lip_pad0)); LASSERTF((int)sizeof(((struct lu_idxpage *)0)->lip_pad0) == 8, "found %lld\n", (long long)(int)sizeof(((struct lu_idxpage *)0)->lip_pad0)); - CLASSERT(LIP_MAGIC == 0x8A6D6B6C); + BUILD_BUG_ON(LIP_MAGIC != 0x8A6D6B6C); LASSERTF(LIP_HDR_SIZE == 16, "found %lld\n", (long long)LIP_HDR_SIZE); LASSERTF(II_FL_NOHASH == 1, "found %lld\n", @@ -3443,12 +3445,12 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_desc, ld_uuid)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, "found %lld\n", (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid)); - CLASSERT(LOV_DESC_MAGIC == 0xB0CCDE5C); + BUILD_BUG_ON(LOV_DESC_MAGIC != 0xB0CCDE5C); /* Checks for struct ldlm_res_id */ LASSERTF((int)sizeof(struct ldlm_res_id) == 32, "found %lld\n", (long long)(int)sizeof(struct ldlm_res_id)); - CLASSERT(RES_NAME_SIZE == 4); + BUILD_BUG_ON(RES_NAME_SIZE != 4); LASSERTF((int)offsetof(struct ldlm_res_id, name[4]) == 32, "found %lld\n", (long long)(int)offsetof(struct ldlm_res_id, name[4])); LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, "found %lld\n", @@ -3773,7 +3775,7 @@ void lustre_assert_wire_constants(void) /* Checks for struct mgs_send_param */ LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", (long long)(int)sizeof(struct mgs_send_param)); - CLASSERT(MGS_PARAM_MAXLEN == 1024); + BUILD_BUG_ON(MGS_PARAM_MAXLEN != 1024); LASSERTF((int)offsetof(struct mgs_send_param, mgs_param[1024]) == 1024, "found %lld\n", (long long)(int)offsetof(struct mgs_send_param, mgs_param[1024])); LASSERTF((int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]) == 1, "found %lld\n", @@ -3826,16 +3828,16 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_logid, lgl_ogen)); LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n", (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen)); - CLASSERT(OST_SZ_REC == 274730752); - CLASSERT(MDS_UNLINK_REC == 274801668); - CLASSERT(MDS_UNLINK64_REC == 275325956); - CLASSERT(MDS_SETATTR64_REC == 275325953); - CLASSERT(OBD_CFG_REC == 274857984); - CLASSERT(LLOG_GEN_REC == 274989056); - CLASSERT(CHANGELOG_REC == 275120128); - CLASSERT(CHANGELOG_USER_REC == 275185664); - CLASSERT(LLOG_HDR_MAGIC == 275010873); - CLASSERT(LLOG_LOGID_MAGIC == 275010875); + BUILD_BUG_ON(OST_SZ_REC != 274730752); + BUILD_BUG_ON(MDS_UNLINK_REC != 274801668); + BUILD_BUG_ON(MDS_UNLINK64_REC != 275325956); + BUILD_BUG_ON(MDS_SETATTR64_REC != 275325953); + BUILD_BUG_ON(OBD_CFG_REC != 274857984); + BUILD_BUG_ON(LLOG_GEN_REC != 274989056); + BUILD_BUG_ON(CHANGELOG_REC != 275120128); + BUILD_BUG_ON(CHANGELOG_USER_REC != 275185664); + BUILD_BUG_ON(LLOG_HDR_MAGIC != 275010873); + BUILD_BUG_ON(LLOG_LOGID_MAGIC != 275010875); /* Checks for struct llog_catid */ LASSERTF((int)sizeof(struct llog_catid) == 32, "found %lld\n", @@ -4247,27 +4249,27 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llogd_body, lgd_cur_offset)); LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, "found %lld\n", (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset)); - CLASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); - CLASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502); - CLASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503); - CLASSERT(LLOG_ORIGIN_HANDLE_PREV_BLOCK == 508); - CLASSERT(LLOG_FIRST_OPC == 501); - CLASSERT(LLOG_LAST_OPC == 510); - CLASSERT(LLOG_CONFIG_ORIG_CTXT == 0); - CLASSERT(LLOG_CONFIG_REPL_CTXT == 1); - CLASSERT(LLOG_MDS_OST_ORIG_CTXT == 2); - CLASSERT(LLOG_MDS_OST_REPL_CTXT == 3); - CLASSERT(LLOG_SIZE_ORIG_CTXT == 4); - CLASSERT(LLOG_SIZE_REPL_CTXT == 5); - CLASSERT(LLOG_TEST_ORIG_CTXT == 8); - CLASSERT(LLOG_TEST_REPL_CTXT == 9); - CLASSERT(LLOG_CHANGELOG_ORIG_CTXT == 12); - CLASSERT(LLOG_CHANGELOG_REPL_CTXT == 13); - CLASSERT(LLOG_CHANGELOG_USER_ORIG_CTXT == 14); - CLASSERT(LLOG_AGENT_ORIG_CTXT == 15); - CLASSERT(LLOG_UPDATELOG_ORIG_CTXT == 16); - CLASSERT(LLOG_UPDATELOG_REPL_CTXT == 17); - CLASSERT(LLOG_MAX_CTXTS == 18); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_CREATE != 501); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_NEXT_BLOCK != 502); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_READ_HEADER != 503); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_PREV_BLOCK != 508); + BUILD_BUG_ON(LLOG_FIRST_OPC != 501); + BUILD_BUG_ON(LLOG_LAST_OPC != 510); + BUILD_BUG_ON(LLOG_CONFIG_ORIG_CTXT != 0); + BUILD_BUG_ON(LLOG_CONFIG_REPL_CTXT != 1); + BUILD_BUG_ON(LLOG_MDS_OST_ORIG_CTXT != 2); + BUILD_BUG_ON(LLOG_MDS_OST_REPL_CTXT != 3); + BUILD_BUG_ON(LLOG_SIZE_ORIG_CTXT != 4); + BUILD_BUG_ON(LLOG_SIZE_REPL_CTXT != 5); + BUILD_BUG_ON(LLOG_TEST_ORIG_CTXT != 8); + BUILD_BUG_ON(LLOG_TEST_REPL_CTXT != 9); + BUILD_BUG_ON(LLOG_CHANGELOG_ORIG_CTXT != 12); + BUILD_BUG_ON(LLOG_CHANGELOG_REPL_CTXT != 13); + BUILD_BUG_ON(LLOG_CHANGELOG_USER_ORIG_CTXT != 14); + BUILD_BUG_ON(LLOG_AGENT_ORIG_CTXT != 15); + BUILD_BUG_ON(LLOG_UPDATELOG_ORIG_CTXT != 16); + BUILD_BUG_ON(LLOG_UPDATELOG_REPL_CTXT != 17); + BUILD_BUG_ON(LLOG_MAX_CTXTS != 18); /* Checks for struct llogd_conn_body */ LASSERTF((int)sizeof(struct llogd_conn_body) == 40, "found %lld\n", @@ -4460,12 +4462,12 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mgs_config_body, mcb_units)); LASSERTF((int)sizeof(((struct mgs_config_body *)0)->mcb_units) == 4, "found %lld\n", (long long)(int)sizeof(((struct mgs_config_body *)0)->mcb_units)); - CLASSERT(CONFIG_T_CONFIG == 0); - CLASSERT(CONFIG_T_SPTLRPC == 1); - CLASSERT(CONFIG_T_RECOVER == 2); - CLASSERT(CONFIG_T_PARAMS == 3); - CLASSERT(CONFIG_T_NODEMAP == 4); - CLASSERT(CONFIG_T_BARRIER == 5); + BUILD_BUG_ON(CONFIG_T_CONFIG != 0); + BUILD_BUG_ON(CONFIG_T_SPTLRPC != 1); + BUILD_BUG_ON(CONFIG_T_RECOVER != 2); + BUILD_BUG_ON(CONFIG_T_PARAMS != 3); + BUILD_BUG_ON(CONFIG_T_NODEMAP != 4); + BUILD_BUG_ON(CONFIG_T_BARRIER != 5); /* Checks for struct mgs_config_res */ LASSERTF((int)sizeof(struct mgs_config_res) == 16, "found %lld\n", @@ -4514,7 +4516,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lustre_capa, lc_expiry)); LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_expiry) == 4, "found %lld\n", (long long)(int)sizeof(((struct lustre_capa *)0)->lc_expiry)); - CLASSERT(CAPA_HMAC_MAX_LEN == 64); + BUILD_BUG_ON(CAPA_HMAC_MAX_LEN != 64); LASSERTF((int)offsetof(struct lustre_capa, lc_hmac[64]) == 120, "found %lld\n", (long long)(int)offsetof(struct lustre_capa, lc_hmac[64])); LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_hmac[64]) == 1, "found %lld\n", @@ -4535,7 +4537,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lustre_capa_key, lk_padding)); LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_padding) == 4, "found %lld\n", (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_padding)); - CLASSERT(CAPA_HMAC_KEY_MAX_LEN == 56); + BUILD_BUG_ON(CAPA_HMAC_KEY_MAX_LEN != 56); LASSERTF((int)offsetof(struct lustre_capa_key, lk_key[56]) == 72, "found %lld\n", (long long)(int)offsetof(struct lustre_capa_key, lk_key[56])); LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_key[56]) == 1, "found %lld\n", @@ -4596,9 +4598,9 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct fiemap, fm_extents)); LASSERTF((int)sizeof(((struct fiemap *)0)->fm_extents) == 0, "found %lld\n", (long long)(int)sizeof(((struct fiemap *)0)->fm_extents)); - CLASSERT(FIEMAP_FLAG_SYNC == 0x00000001); - CLASSERT(FIEMAP_FLAG_XATTR == 0x00000002); - CLASSERT(FIEMAP_FLAG_DEVICE_ORDER == 0x40000000); + BUILD_BUG_ON(FIEMAP_FLAG_SYNC != 0x00000001); + BUILD_BUG_ON(FIEMAP_FLAG_XATTR != 0x00000002); + BUILD_BUG_ON(FIEMAP_FLAG_DEVICE_ORDER != 0x40000000); /* Checks for struct fiemap_extent */ LASSERTF((int)sizeof(struct fiemap_extent) == 56, "found %lld\n", @@ -4623,18 +4625,18 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct fiemap_extent, fe_reserved[0])); LASSERTF((int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0]) == 4, "found %lld\n", (long long)(int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0])); - CLASSERT(FIEMAP_EXTENT_LAST == 0x00000001); - CLASSERT(FIEMAP_EXTENT_UNKNOWN == 0x00000002); - CLASSERT(FIEMAP_EXTENT_DELALLOC == 0x00000004); - CLASSERT(FIEMAP_EXTENT_ENCODED == 0x00000008); - CLASSERT(FIEMAP_EXTENT_DATA_ENCRYPTED == 0x00000080); - CLASSERT(FIEMAP_EXTENT_NOT_ALIGNED == 0x00000100); - CLASSERT(FIEMAP_EXTENT_DATA_INLINE == 0x00000200); - CLASSERT(FIEMAP_EXTENT_DATA_TAIL == 0x00000400); - CLASSERT(FIEMAP_EXTENT_UNWRITTEN == 0x00000800); - CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); - CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); - CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); + BUILD_BUG_ON(FIEMAP_EXTENT_LAST != 0x00000001); + BUILD_BUG_ON(FIEMAP_EXTENT_UNKNOWN != 0x00000002); + BUILD_BUG_ON(FIEMAP_EXTENT_DELALLOC != 0x00000004); + BUILD_BUG_ON(FIEMAP_EXTENT_ENCODED != 0x00000008); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_ENCRYPTED != 0x00000080); + BUILD_BUG_ON(FIEMAP_EXTENT_NOT_ALIGNED != 0x00000100); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_INLINE != 0x00000200); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_TAIL != 0x00000400); + BUILD_BUG_ON(FIEMAP_EXTENT_UNWRITTEN != 0x00000800); + BUILD_BUG_ON(FIEMAP_EXTENT_MERGED != 0x00001000); + BUILD_BUG_ON(FIEMAP_EXTENT_NO_DIRECT != 0x40000000); + BUILD_BUG_ON(FIEMAP_EXTENT_NET != 0x80000000); #ifdef CONFIG_FS_POSIX_ACL /* Checks for type posix_acl_xattr_entry */ @@ -4693,7 +4695,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct link_ea_header, leh_padding)); LASSERTF((int)sizeof(((struct link_ea_header *)0)->leh_padding) == 4, "found %lld\n", (long long)(int)sizeof(((struct link_ea_header *)0)->leh_padding)); - CLASSERT(LINK_EA_MAGIC == 0x11EAF1DFUL); + BUILD_BUG_ON(LINK_EA_MAGIC != 0x11EAF1DFUL); /* Checks for struct link_ea_entry */ LASSERTF((int)sizeof(struct link_ea_entry) == 18, "found %lld\n", -- 1.8.3.1