From: Andreas Dilger Date: Fri, 31 Mar 2023 02:37:08 +0000 (-0600) Subject: LU-16677 utils: add bitfields and ifdefs to wiretest X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=52181864e5693fabbcda8a47fdfd1992c3edc79c;p=fs%2Flustre-release.git LU-16677 utils: add bitfields and ifdefs to wiretest Add CHECK_BITFIELD() for "checking" bitfields in data structures (currently only adds a comment to wiretest.c, maybe improve later). Add CHECK_COND_START/FINISH() for adding #ifdef/#endif conditions into wiretest, mainly for structs not used by (upstream) client. Lustre-change: https://review.whamcloud.com/50479 Lustre-commit: 5a730827147714136b7d5035ca6115545a6b5ef0 LU-16677 utils: synchronize wirecheck.c and wiretest.c wirecheck.c is not compilable and out of sync with wiretest.c. The patch adds forgotten changes to wirecheck.c and replaces wiretest.c by a version generated by "make newwiretest". Lustre-change: https://review.whamcloud.com/50456 Lustre-commit: d43eb211995e0afb35690946c78ef6c82b9f86ad Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I8ecc4bdd5b5d651faa42f65ce8ea46da003ebbe5 Reviewed-by: Sebastien Buisson Reviewed-by: Alexander Zarochentsev Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/50751 Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 5f1e33b..05d835d 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -416,6 +416,28 @@ void lustre_assert_wire_constants(void) LASSERTF(LU_SEQ_RANGE_OST == 1, "found %lld\n", (long long)LU_SEQ_RANGE_OST); + /* Checks for struct lustre_som_attrs */ + LASSERTF((int)sizeof(struct lustre_som_attrs) == 24, "found %lld\n", + (long long)(int)sizeof(struct lustre_som_attrs)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_valid) == 0, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_valid)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid) == 2, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_reserved) == 2, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_reserved)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved) == 6, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_size) == 8, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_size)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_size) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_size)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_blocks) == 16, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_blocks)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks)); + +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct lustre_mdt_attrs */ LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 24, "found %lld\n", (long long)(int)sizeof(struct lustre_mdt_attrs)); @@ -520,26 +542,6 @@ void lustre_assert_wire_constants(void) LASSERTF(OUT_XATTR_LIST == 17, "found %lld\n", (long long)OUT_XATTR_LIST); - /* Checks for struct lustre_som_attrs */ - LASSERTF((int)sizeof(struct lustre_som_attrs) == 24, "found %lld\n", - (long long)(int)sizeof(struct lustre_som_attrs)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_valid) == 0, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_valid)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid) == 2, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_reserved) == 2, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_reserved)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved) == 6, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_size) == 8, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_size)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_size) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_size)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_blocks) == 16, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_blocks)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks)); - /* Checks for struct hsm_attrs */ LASSERTF((int)sizeof(struct hsm_attrs) == 24, "found %lld\n", (long long)(int)sizeof(struct hsm_attrs)); @@ -559,6 +561,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct hsm_attrs, hsm_arch_ver)); LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver) == 8, "found %lld\n", (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct ost_id */ LASSERTF((int)sizeof(struct ost_id) == 16, "found %lld\n", @@ -1779,6 +1782,95 @@ void lustre_assert_wire_constants(void) LASSERTF(LOV_PATTERN_OVERSTRIPING == 0x00000200UL, "found 0x%.8xUL\n", (unsigned)LOV_PATTERN_OVERSTRIPING); + /* Checks for struct lov_foreign_md */ + LASSERTF((int)sizeof(struct lov_foreign_md) == 16, "found %lld\n", + (long long)(int)sizeof(struct lov_foreign_md)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_magic) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_magic)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_magic) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_magic)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_length) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_length)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_length) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_length)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_type) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_type)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_type)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_flags) == 12, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_flags)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_flags)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_value[0]) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_value[0])); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_value[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_value[0])); + LASSERTF(LU_FOREIGN_TYPE_NONE == 0x00000000UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_NONE); + LASSERTF(LU_FOREIGN_TYPE_POSIX == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_POSIX); + LASSERTF(LU_FOREIGN_TYPE_PCCRW == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_PCCRW); + LASSERTF(LU_FOREIGN_TYPE_PCCRO == 0x00000003UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_PCCRO); + LASSERTF(LU_FOREIGN_TYPE_S3 == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_S3); + LASSERTF(LU_FOREIGN_TYPE_DAOS == 0x0000da05UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_DAOS); + LASSERTF(LU_FOREIGN_TYPE_UNKNOWN == 0xffffffffUL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_UNKNOWN); + BUILD_BUG_ON(LOV_MAGIC_FOREIGN != (0x0BD70000 | 0x0BD0)); + LASSERTF(LOV_PATTERN_FOREIGN == 0x00000400UL, "found 0x%.8xUL\n", + (unsigned)LOV_PATTERN_FOREIGN); + + /* Checks for struct lov_hsm_base */ + LASSERTF((int)sizeof(struct lov_hsm_base) == 56, "found %lld\n", + (long long)(int)sizeof(struct lov_hsm_base)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_archive_id) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_archive_id)); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_id) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_id)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_archive_ver)); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_ver)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_uuid[0]) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_uuid[0])); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_uuid[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_uuid[0])); + + /* Checks for struct lov_hsm_md */ + LASSERTF((int)sizeof(struct lov_hsm_md) == 72, "found %lld\n", + (long long)(int)sizeof(struct lov_hsm_md)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_magic) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_magic)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_magic) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_magic)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_length) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_length)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_length) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_length)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_type) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_type)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_type)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_flags) == 12, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_flags)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_flags)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_id) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_id)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_id) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_id)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_ver) == 24, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_ver)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_ver)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_uuid[0]) == 32, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_uuid[0])); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_uuid[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_uuid[0])); + /* Checks for struct lov_comp_md_entry_v1 */ LASSERTF((int)sizeof(struct lov_comp_md_entry_v1) == 48, "found %lld\n", (long long)(int)sizeof(struct lov_comp_md_entry_v1)); @@ -1874,6 +1966,8 @@ void lustre_assert_wire_constants(void) (long long)LCM_FL_SYNC_PENDING); LASSERTF(LCM_FL_PCC_RDONLY == 8, "found %lld\n", (long long)LCM_FL_PCC_RDONLY); + LASSERTF(LCM_FL_FLR_MASK == 11, "found %lld\n", + (long long)LCM_FL_FLR_MASK); /* Checks for struct lmv_mds_md_v1 */ LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n", @@ -1931,7 +2025,6 @@ void lustre_assert_wire_constants(void) 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); - BUILD_BUG_ON(LMV_HASH_FLAG_MIGRATION != 0x80000000); BUILD_BUG_ON(LMV_CRUSH_PG_COUNT != 4096); /* Checks for struct obd_statfs */ @@ -2201,6 +2294,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lquota_slv_rec *)0)->qsr_granted) == 8, "found %lld\n", (long long)(int)sizeof(((struct lquota_slv_rec *)0)->qsr_granted)); +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct idx_info */ LASSERTF((int)sizeof(struct idx_info) == 80, "found %lld\n", (long long)(int)sizeof(struct idx_info)); @@ -2288,6 +2383,7 @@ void lustre_assert_wire_constants(void) BUILD_BUG_ON(II_FL_VARREC != 0x00000004); BUILD_BUG_ON(II_FL_NONUNQ != 0x00000008); BUILD_BUG_ON(II_FL_NOKEY != 0x00000010); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct niobuf_remote */ LASSERTF((int)sizeof(struct niobuf_remote) == 16, "found %lld\n", @@ -3831,6 +3927,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ldlm_gl_lquota_desc *)0)->gl_pad2) == 8, "found %lld\n", (long long)(int)sizeof(((struct ldlm_gl_lquota_desc *)0)->gl_pad2)); +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct ldlm_gl_barrier_desc */ LASSERTF((int)sizeof(struct ldlm_gl_barrier_desc) == 16, "found %lld\n", (long long)(int)sizeof(struct ldlm_gl_barrier_desc)); @@ -3862,6 +3960,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct barrier_lvb, lvb_padding)); LASSERTF((int)sizeof(((struct barrier_lvb *)0)->lvb_padding) == 8, "found %lld\n", (long long)(int)sizeof(((struct barrier_lvb *)0)->lvb_padding)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct mgs_send_param */ LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", @@ -5155,6 +5254,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct hsm_user_import *)0)->hui_archive_id) == 4, "found %lld\n", (long long)(int)sizeof(((struct hsm_user_import *)0)->hui_archive_id)); +#ifndef HAVE_NATIVE_LINUX_CLIENT + /* Checks for struct netobj_s */ LASSERTF((int)sizeof(struct netobj_s) == 4, "found %lld\n", (long long)(int)sizeof(struct netobj_s)); @@ -5346,7 +5447,9 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct gss_wire_ctx, gw_handle)); LASSERTF((int)sizeof(((struct gss_wire_ctx *)0)->gw_handle) == 16, "found %lld\n", (long long)(int)sizeof(((struct gss_wire_ctx *)0)->gw_handle)); +#endif /* HAVE_NATIVE_LINUX_CLIENT */ +#ifdef HAVE_SERVER_SUPPORT /* Checks for struct object_update_param */ LASSERTF((int)sizeof(struct object_update_param) == 8, "found %lld\n", @@ -5516,8 +5619,8 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_name[16 + 1])); LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1]) == 1, "found %lld\n", (long long)(int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1])); - /* ncr_flags' address and size cannot be taken because it is a bit-field (8 bits) */ - /* ncr_flags2' address and size cannot be taken because it is a bit-field (8 bits) */ + /* nodemap_cluster_rec.ncr_flags is a bitfield and cannot be checked */ + /* nodemap_cluster_rec.ncr_flags2 is a bitfield and cannot be checked */ LASSERTF((int)offsetof(struct nodemap_cluster_rec, ncr_padding1) == 19, "found %lld\n", (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_padding1)); LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_padding1) == 1, "found %lld\n", @@ -5676,28 +5779,28 @@ void lustre_assert_wire_constants(void) (long long)NODEMAP_CLUSTER_REC); LASSERTF(NODEMAP_CLUSTER_ROLES == 1, "found %lld\n", (long long)NODEMAP_CLUSTER_ROLES); - LASSERTF(NM_TYPE_MASK == 0x0FFFFFFFUL, "found 0x%.8llxUL\n", - (long long)NM_TYPE_MASK); + LASSERTF(NM_TYPE_MASK == 0x0fffffffUL, "found 0x%.8xUL\n", + (unsigned)NM_TYPE_MASK); LASSERTF(NM_TYPE_SHIFT == 28, "found %lld\n", (long long)NM_TYPE_SHIFT); - LASSERTF(NM_FL_ALLOW_ROOT_ACCESS == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NM_FL_ALLOW_ROOT_ACCESS); - LASSERTF(NM_FL_TRUST_CLIENT_IDS == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NM_FL_TRUST_CLIENT_IDS); - LASSERTF(NM_FL_DENY_UNKNOWN == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NM_FL_DENY_UNKNOWN); - LASSERTF(NM_FL_MAP_UID == 0x00000008UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_UID); - LASSERTF(NM_FL_MAP_GID == 0x00000010UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_GID); - LASSERTF(NM_FL_ENABLE_AUDIT == 0x00000020UL, "found 0x%.8llxUL\n", - (long long)NM_FL_ENABLE_AUDIT); - LASSERTF(NM_FL_FORBID_ENCRYPT == 0x00000040UL, "found 0x%.8llxUL\n", - (long long)NM_FL_FORBID_ENCRYPT); - LASSERTF(NM_FL_MAP_PROJID == 0x00000080UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_PROJID); - LASSERTF(NM_FL2_READONLY_MOUNT == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NM_FL2_READONLY_MOUNT); + LASSERTF(NM_FL_ALLOW_ROOT_ACCESS == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_ALLOW_ROOT_ACCESS); + LASSERTF(NM_FL_TRUST_CLIENT_IDS == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_TRUST_CLIENT_IDS); + LASSERTF(NM_FL_DENY_UNKNOWN == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_DENY_UNKNOWN); + LASSERTF(NM_FL_MAP_UID == 0x00000008UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_UID); + LASSERTF(NM_FL_MAP_GID == 0x00000010UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_GID); + LASSERTF(NM_FL_ENABLE_AUDIT == 0x00000020UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_ENABLE_AUDIT); + LASSERTF(NM_FL_FORBID_ENCRYPT == 0x00000040UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_FORBID_ENCRYPT); + LASSERTF(NM_FL_MAP_PROJID == 0x00000080UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_PROJID); + LASSERTF(NM_FL2_READONLY_MOUNT == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NM_FL2_READONLY_MOUNT); LASSERTF(NODEMAP_UID == 0, "found %lld\n", (long long)NODEMAP_UID); LASSERTF(NODEMAP_GID == 1, "found %lld\n", @@ -5708,34 +5811,34 @@ void lustre_assert_wire_constants(void) (long long)NODEMAP_FS_TO_CLIENT); LASSERTF(NODEMAP_CLIENT_TO_FS == 1, "found %lld\n", (long long)NODEMAP_CLIENT_TO_FS); - LASSERTF(NODEMAP_MAP_BOTH_LEGACY == 0x00000000UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_BOTH_LEGACY); - LASSERTF(NODEMAP_MAP_UID == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_UID); - LASSERTF(NODEMAP_MAP_GID == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_GID); - LASSERTF(NODEMAP_MAP_BOTH == 0x00000003UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_BOTH); - LASSERTF(NODEMAP_MAP_PROJID == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_PROJID); - LASSERTF(NODEMAP_MAP_ALL == 0x00000007UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_ALL); - LASSERTF(NODEMAP_RBAC_FILE_PERMS == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_FILE_PERMS); - LASSERTF(NODEMAP_RBAC_DNE_OPS == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_DNE_OPS); - LASSERTF(NODEMAP_RBAC_QUOTA_OPS == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_QUOTA_OPS); - LASSERTF(NODEMAP_RBAC_BYFID_OPS == 0x00000008UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_BYFID_OPS); - LASSERTF(NODEMAP_RBAC_CHLG_OPS == 0x00000010UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_CHLG_OPS); - LASSERTF(NODEMAP_RBAC_FSCRYPT_ADMIN == 0x00000020UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_FSCRYPT_ADMIN); - LASSERTF(NODEMAP_RBAC_NONE == 0xFFFFFFC0UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_NONE); - LASSERTF(NODEMAP_RBAC_ALL == 0xFFFFFFFFUL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_ALL); + LASSERTF(NODEMAP_MAP_BOTH_LEGACY == 0x00000000UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_BOTH_LEGACY); + LASSERTF(NODEMAP_MAP_UID == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_UID); + LASSERTF(NODEMAP_MAP_GID == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_GID); + LASSERTF(NODEMAP_MAP_BOTH == 0x00000003UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_BOTH); + LASSERTF(NODEMAP_MAP_PROJID == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_PROJID); + LASSERTF(NODEMAP_MAP_ALL == 0x00000007UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_ALL); + LASSERTF(NODEMAP_RBAC_FILE_PERMS == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_FILE_PERMS); + LASSERTF(NODEMAP_RBAC_DNE_OPS == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_DNE_OPS); + LASSERTF(NODEMAP_RBAC_QUOTA_OPS == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_QUOTA_OPS); + LASSERTF(NODEMAP_RBAC_BYFID_OPS == 0x00000008UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_BYFID_OPS); + LASSERTF(NODEMAP_RBAC_CHLG_OPS == 0x00000010UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_CHLG_OPS); + LASSERTF(NODEMAP_RBAC_FSCRYPT_ADMIN == 0x00000020UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_FSCRYPT_ADMIN); + LASSERTF(NODEMAP_RBAC_NONE == 0xffffffc0UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_NONE); + LASSERTF(NODEMAP_RBAC_ALL == 0xffffffffUL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_ALL); LASSERTF(OFD_ACCESS_READ == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OFD_ACCESS_READ); @@ -6020,6 +6123,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_update_record, lur_update_rec)); LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_update_rec) == 32, "found %lld\n", (long long)(int)sizeof(((struct llog_update_record *)0)->lur_update_rec)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct lustre_cfg */ LASSERTF((int)sizeof(struct lustre_cfg) == 32, "found %lld\n", @@ -6135,9 +6239,9 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_ADMIN == 0x000ce049UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_ADMIN); LASSERTF(LCFG_NODEMAP_ADD_PROJIDMAP == 0x000ce04aUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); + (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); LASSERTF(LCFG_NODEMAP_DEL_PROJIDMAP == 0x000ce04bUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); + (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); LASSERTF(LCFG_NODEMAP_TRUSTED == 0x000ce050UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_TRUSTED); LASSERTF(LCFG_NODEMAP_SQUASH_UID == 0x000ce051UL, "found 0x%.8xUL\n", @@ -6163,13 +6267,13 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_SET_SEPOL == 0x000ce05bUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SET_SEPOL); LASSERTF(LCFG_NODEMAP_FORBID_ENCRYPT == 0x000ce05cUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); + (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); LASSERTF(LCFG_NODEMAP_SQUASH_PROJID == 0x000ce05dUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_SQUASH_PROJID); + (unsigned)LCFG_NODEMAP_SQUASH_PROJID); LASSERTF(LCFG_NODEMAP_READONLY_MOUNT == 0x000ce05eUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_READONLY_MOUNT); + (unsigned)LCFG_NODEMAP_READONLY_MOUNT); LASSERTF(LCFG_NODEMAP_RBAC == 0x000ce05fUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_RBAC); + (unsigned)LCFG_NODEMAP_RBAC); LASSERTF(PORTALS_CFG_TYPE == 1, "found %lld\n", (long long)PORTALS_CFG_TYPE); LASSERTF(LUSTRE_CFG_TYPE == 123, "found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 9054ae9..5678f45 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -195,6 +195,14 @@ do { \ (int)sizeof(((struct s2 *)0)->m)); \ } while (0) +/* could maybe check this in the future, just add a comment for now */ +#define CHECK_BITFIELD(s, m) \ + COMMENT(""#s"."#m" is a bitfield and cannot be checked") + +#define CHECK_COND_START(cond) printf("\n#ifdef "#cond"\n") +#define CHECK_COND_STARTN(cond) printf("\n#ifndef "#cond"\n") +#define CHECK_COND_FINISH(cond) printf("#endif /* "#cond" */\n") + static void check_lu_seq_range(void) { @@ -855,7 +863,7 @@ check_lov_foreign_md(void) static void check_lov_hsm_base(void) { - BLANK_LINKE(); + BLANK_LINE(); CHECK_STRUCT(lov_hsm_base); CHECK_MEMBER(lov_hsm_base, lhb_archive_id); CHECK_MEMBER(lov_hsm_base, lhb_archive_ver); @@ -922,6 +930,8 @@ check_lov_comp_md_v1(void) CHECK_VALUE(LCM_FL_RDONLY); CHECK_VALUE(LCM_FL_WRITE_PENDING); CHECK_VALUE(LCM_FL_SYNC_PENDING); + CHECK_VALUE(LCM_FL_PCC_RDONLY); + CHECK_VALUE(LCM_FL_FLR_MASK); } static void @@ -2614,8 +2624,8 @@ static void check_nodemap_cluster_rec(void) CHECK_STRUCT(nodemap_cluster_rec); CHECK_CDEFINE(LUSTRE_NODEMAP_NAME_LENGTH); CHECK_MEMBER(nodemap_cluster_rec, ncr_name[LUSTRE_NODEMAP_NAME_LENGTH + 1]); - CHECK_MEMBER(nodemap_cluster_rec, ncr_flags); - CHECK_MEMBER(nodemap_cluster_rec, ncr_flags2); + CHECK_BITFIELD(nodemap_cluster_rec, ncr_flags); + CHECK_BITFIELD(nodemap_cluster_rec, ncr_flags2); CHECK_MEMBER(nodemap_cluster_rec, ncr_padding1); CHECK_MEMBER(nodemap_cluster_rec, ncr_squash_projid); CHECK_MEMBER(nodemap_cluster_rec, ncr_squash_uid); @@ -2677,6 +2687,10 @@ static void check_nodemap_key(void) BLANK_LINE(); CHECK_STRUCT(nodemap_key); CHECK_MEMBER(nodemap_key, nk_nodemap_id); + CHECK_MEMBER(nodemap_key, nk_cluster_subid); + CHECK_MEMBER(nodemap_key, nk_range_id); + CHECK_MEMBER(nodemap_key, nk_id_client); + CHECK_MEMBER(nodemap_key, nk_unused); CHECK_VALUE(NODEMAP_EMPTY_IDX); CHECK_VALUE(NODEMAP_CLUSTER_IDX); @@ -3156,6 +3170,9 @@ main(int argc, char **argv) BLANK_LINE(); CHECK_STRUCT(obd_uuid); check_lu_seq_range(); + check_som_attrs(); +#ifndef HAVE_NATIVE_LINUX_CLIENT + CHECK_COND_START(HAVE_SERVER_SUPPORT); check_lustre_mdt_attrs(); check_lustre_ost_attrs(); @@ -3178,8 +3195,9 @@ main(int argc, char **argv) CHECK_VALUE(OUT_NOOP); CHECK_VALUE(OUT_XATTR_LIST); - check_som_attrs(); check_hsm_attrs(); + CHECK_COND_FINISH(HAVE_SERVER_SUPPORT); +#endif /* !HAVE_NATIVE_LINUX_CLIENT */ check_ost_id(); check_lu_dirent(); check_luda_type(); @@ -3204,7 +3222,11 @@ main(int argc, char **argv) check_obd_statfs(); check_obd_ioobj(); check_obd_quotactl(); +#ifndef HAVE_NATIVE_LINUX_CLIENT + CHECK_COND_START(HAVE_SERVER_SUPPORT); check_obd_idx_read(); + CHECK_COND_FINISH(HAVE_SERVER_SUPPORT); +#endif /* !HAVE_NATIVE_LINUX_CLIENT */ check_niobuf_remote(); check_ost_body(); check_ll_fid(); @@ -3234,8 +3256,12 @@ main(int argc, char **argv) check_ldlm_ost_lvb(); check_ldlm_lquota_lvb(); check_ldlm_gl_lquota_desc(); +#ifndef HAVE_NATIVE_LINUX_CLIENT + CHECK_COND_START(HAVE_SERVER_SUPPORT); check_ldlm_gl_barrier_desc(); check_ldlm_barrier_lvb(); + CHECK_COND_FINISH(HAVE_SERVER_SUPPORT); +#endif /* !HAVE_NATIVE_LINUX_CLIENT */ #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 18, 53, 0) check_mgs_send_param(); #endif @@ -3287,13 +3313,17 @@ main(int argc, char **argv) check_hsm_user_request(); check_hsm_user_import(); + CHECK_COND_STARTN(HAVE_NATIVE_LINUX_CLIENT); check_netobj_s(); check_rawobj_s(); check_gss_header(); check_gss_rep_header(); check_gss_err_header(); check_gss_wire_ctx(); + CHECK_COND_FINISH(HAVE_NATIVE_LINUX_CLIENT); +#ifndef HAVE_NATIVE_LINUX_CLIENT + CHECK_COND_START(HAVE_SERVER_SUPPORT); check_object_update_param(); check_object_update(); check_object_update_request(); @@ -3321,7 +3351,8 @@ main(int argc, char **argv) check_update_ops(); check_update_records(); check_llog_update_record(); - + CHECK_COND_FINISH(HAVE_SERVER_SUPPORT); +#endif /* !HAVE_NATIVE_LINUX_CLIENT */ check_lustre_cfg(); printf("}\n"); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 339384d..bf1126b 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -39,6 +39,7 @@ #include #ifdef HAVE_SERVER_SUPPORT #include +#include #ifdef CONFIG_FS_POSIX_ACL #include #ifdef HAVE_STRUCT_POSIX_ACL_XATTR @@ -47,7 +48,6 @@ #endif /* HAVE_STRUCT_POSIX_ACL_XATTR */ #endif /* CONFIG_FS_POSIX_ACL */ #endif /* HAVE_SERVER_SUPPORT */ -#include #include #ifndef BUILD_BUG_ON @@ -452,6 +452,28 @@ void lustre_assert_wire_constants(void) LASSERTF(LU_SEQ_RANGE_OST == 1, "found %lld\n", (long long)LU_SEQ_RANGE_OST); + /* Checks for struct lustre_som_attrs */ + LASSERTF((int)sizeof(struct lustre_som_attrs) == 24, "found %lld\n", + (long long)(int)sizeof(struct lustre_som_attrs)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_valid) == 0, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_valid)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid) == 2, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_reserved) == 2, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_reserved)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved) == 6, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_size) == 8, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_size)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_size) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_size)); + LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_blocks) == 16, "found %lld\n", + (long long)(int)offsetof(struct lustre_som_attrs, lsa_blocks)); + LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks)); + +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct lustre_mdt_attrs */ LASSERTF((int)sizeof(struct lustre_mdt_attrs) == 24, "found %lld\n", (long long)(int)sizeof(struct lustre_mdt_attrs)); @@ -556,26 +578,6 @@ void lustre_assert_wire_constants(void) LASSERTF(OUT_XATTR_LIST == 17, "found %lld\n", (long long)OUT_XATTR_LIST); - /* Checks for struct lustre_som_attrs */ - LASSERTF((int)sizeof(struct lustre_som_attrs) == 24, "found %lld\n", - (long long)(int)sizeof(struct lustre_som_attrs)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_valid) == 0, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_valid)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid) == 2, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_reserved) == 2, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_reserved)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved) == 6, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_size) == 8, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_size)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_size) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_size)); - LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_blocks) == 16, "found %lld\n", - (long long)(int)offsetof(struct lustre_som_attrs, lsa_blocks)); - LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks) == 8, "found %lld\n", - (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks)); - /* Checks for struct hsm_attrs */ LASSERTF((int)sizeof(struct hsm_attrs) == 24, "found %lld\n", (long long)(int)sizeof(struct hsm_attrs)); @@ -595,6 +597,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct hsm_attrs, hsm_arch_ver)); LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver) == 8, "found %lld\n", (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct ost_id */ LASSERTF((int)sizeof(struct ost_id) == 16, "found %lld\n", @@ -1815,6 +1818,95 @@ void lustre_assert_wire_constants(void) LASSERTF(LOV_PATTERN_OVERSTRIPING == 0x00000200UL, "found 0x%.8xUL\n", (unsigned)LOV_PATTERN_OVERSTRIPING); + /* Checks for struct lov_foreign_md */ + LASSERTF((int)sizeof(struct lov_foreign_md) == 16, "found %lld\n", + (long long)(int)sizeof(struct lov_foreign_md)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_magic) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_magic)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_magic) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_magic)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_length) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_length)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_length) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_length)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_type) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_type)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_type)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_flags) == 12, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_flags)); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_flags)); + LASSERTF((int)offsetof(struct lov_foreign_md, lfm_value[0]) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_foreign_md, lfm_value[0])); + LASSERTF((int)sizeof(((struct lov_foreign_md *)0)->lfm_value[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_foreign_md *)0)->lfm_value[0])); + LASSERTF(LU_FOREIGN_TYPE_NONE == 0x00000000UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_NONE); + LASSERTF(LU_FOREIGN_TYPE_POSIX == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_POSIX); + LASSERTF(LU_FOREIGN_TYPE_PCCRW == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_PCCRW); + LASSERTF(LU_FOREIGN_TYPE_PCCRO == 0x00000003UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_PCCRO); + LASSERTF(LU_FOREIGN_TYPE_S3 == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_S3); + LASSERTF(LU_FOREIGN_TYPE_DAOS == 0x0000da05UL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_DAOS); + LASSERTF(LU_FOREIGN_TYPE_UNKNOWN == 0xffffffffUL, "found 0x%.8xUL\n", + (unsigned)LU_FOREIGN_TYPE_UNKNOWN); + BUILD_BUG_ON(LOV_MAGIC_FOREIGN != (0x0BD70000 | 0x0BD0)); + LASSERTF(LOV_PATTERN_FOREIGN == 0x00000400UL, "found 0x%.8xUL\n", + (unsigned)LOV_PATTERN_FOREIGN); + + /* Checks for struct lov_hsm_base */ + LASSERTF((int)sizeof(struct lov_hsm_base) == 56, "found %lld\n", + (long long)(int)sizeof(struct lov_hsm_base)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_archive_id) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_archive_id)); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_id) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_id)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_archive_ver)); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_archive_ver)); + LASSERTF((int)offsetof(struct lov_hsm_base, lhb_uuid[0]) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_base, lhb_uuid[0])); + LASSERTF((int)sizeof(((struct lov_hsm_base *)0)->lhb_uuid[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_base *)0)->lhb_uuid[0])); + + /* Checks for struct lov_hsm_md */ + LASSERTF((int)sizeof(struct lov_hsm_md) == 72, "found %lld\n", + (long long)(int)sizeof(struct lov_hsm_md)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_magic) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_magic)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_magic) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_magic)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_length) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_length)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_length) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_length)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_type) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_type)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_type)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_flags) == 12, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_flags)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_flags)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_id) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_id)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_id) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_id)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_ver) == 24, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_archive_ver)); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_ver) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_archive_ver)); + LASSERTF((int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_uuid[0]) == 32, "found %lld\n", + (long long)(int)offsetof(struct lov_hsm_md, lhm_hsm.lhb_uuid[0])); + LASSERTF((int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_uuid[0]) == 1, "found %lld\n", + (long long)(int)sizeof(((struct lov_hsm_md *)0)->lhm_hsm.lhb_uuid[0])); + /* Checks for struct lov_comp_md_entry_v1 */ LASSERTF((int)sizeof(struct lov_comp_md_entry_v1) == 48, "found %lld\n", (long long)(int)sizeof(struct lov_comp_md_entry_v1)); @@ -1910,6 +2002,8 @@ void lustre_assert_wire_constants(void) (long long)LCM_FL_SYNC_PENDING); LASSERTF(LCM_FL_PCC_RDONLY == 8, "found %lld\n", (long long)LCM_FL_PCC_RDONLY); + LASSERTF(LCM_FL_FLR_MASK == 11, "found %lld\n", + (long long)LCM_FL_FLR_MASK); /* Checks for struct lmv_mds_md_v1 */ LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n", @@ -2236,6 +2330,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lquota_slv_rec *)0)->qsr_granted) == 8, "found %lld\n", (long long)(int)sizeof(((struct lquota_slv_rec *)0)->qsr_granted)); +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct idx_info */ LASSERTF((int)sizeof(struct idx_info) == 80, "found %lld\n", (long long)(int)sizeof(struct idx_info)); @@ -2323,6 +2419,7 @@ void lustre_assert_wire_constants(void) BUILD_BUG_ON(II_FL_VARREC != 0x00000004); BUILD_BUG_ON(II_FL_NONUNQ != 0x00000008); BUILD_BUG_ON(II_FL_NOKEY != 0x00000010); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct niobuf_remote */ LASSERTF((int)sizeof(struct niobuf_remote) == 16, "found %lld\n", @@ -3866,6 +3963,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ldlm_gl_lquota_desc *)0)->gl_pad2) == 8, "found %lld\n", (long long)(int)sizeof(((struct ldlm_gl_lquota_desc *)0)->gl_pad2)); +#ifdef HAVE_SERVER_SUPPORT + /* Checks for struct ldlm_gl_barrier_desc */ LASSERTF((int)sizeof(struct ldlm_gl_barrier_desc) == 16, "found %lld\n", (long long)(int)sizeof(struct ldlm_gl_barrier_desc)); @@ -3897,6 +3996,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct barrier_lvb, lvb_padding)); LASSERTF((int)sizeof(((struct barrier_lvb *)0)->lvb_padding) == 8, "found %lld\n", (long long)(int)sizeof(((struct barrier_lvb *)0)->lvb_padding)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct mgs_send_param */ LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", @@ -5190,6 +5290,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct hsm_user_import *)0)->hui_archive_id) == 4, "found %lld\n", (long long)(int)sizeof(((struct hsm_user_import *)0)->hui_archive_id)); +#ifndef HAVE_NATIVE_LINUX_CLIENT + /* Checks for struct netobj_s */ LASSERTF((int)sizeof(struct netobj_s) == 4, "found %lld\n", (long long)(int)sizeof(struct netobj_s)); @@ -5381,7 +5483,9 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct gss_wire_ctx, gw_handle)); LASSERTF((int)sizeof(((struct gss_wire_ctx *)0)->gw_handle) == 16, "found %lld\n", (long long)(int)sizeof(((struct gss_wire_ctx *)0)->gw_handle)); +#endif /* HAVE_NATIVE_LINUX_CLIENT */ +#ifdef HAVE_SERVER_SUPPORT /* Checks for struct object_update_param */ LASSERTF((int)sizeof(struct object_update_param) == 8, "found %lld\n", @@ -5551,8 +5655,8 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_name[16 + 1])); LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1]) == 1, "found %lld\n", (long long)(int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1])); - /* ncr_flags' address and size cannot be taken because it is a bit-field (8 bits) */ - /* ncr_flags2' address and size cannot be taken because it is a bit-field (8 bits) */ + /* nodemap_cluster_rec.ncr_flags is a bitfield and cannot be checked */ + /* nodemap_cluster_rec.ncr_flags2 is a bitfield and cannot be checked */ LASSERTF((int)offsetof(struct nodemap_cluster_rec, ncr_padding1) == 19, "found %lld\n", (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_padding1)); LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_padding1) == 1, "found %lld\n", @@ -5711,28 +5815,28 @@ void lustre_assert_wire_constants(void) (long long)NODEMAP_CLUSTER_REC); LASSERTF(NODEMAP_CLUSTER_ROLES == 1, "found %lld\n", (long long)NODEMAP_CLUSTER_ROLES); - LASSERTF(NM_TYPE_MASK == 0x0FFFFFFFUL, "found 0x%.8llxUL\n", - (long long)NM_TYPE_MASK); + LASSERTF(NM_TYPE_MASK == 0x0fffffffUL, "found 0x%.8xUL\n", + (unsigned)NM_TYPE_MASK); LASSERTF(NM_TYPE_SHIFT == 28, "found %lld\n", (long long)NM_TYPE_SHIFT); - LASSERTF(NM_FL_ALLOW_ROOT_ACCESS == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NM_FL_ALLOW_ROOT_ACCESS); - LASSERTF(NM_FL_TRUST_CLIENT_IDS == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NM_FL_TRUST_CLIENT_IDS); - LASSERTF(NM_FL_DENY_UNKNOWN == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NM_FL_DENY_UNKNOWN); - LASSERTF(NM_FL_MAP_UID == 0x00000008UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_UID); - LASSERTF(NM_FL_MAP_GID == 0x00000010UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_GID); - LASSERTF(NM_FL_ENABLE_AUDIT == 0x00000020UL, "found 0x%.8llxUL\n", - (long long)NM_FL_ENABLE_AUDIT); - LASSERTF(NM_FL_FORBID_ENCRYPT == 0x00000040UL, "found 0x%.8llxUL\n", - (long long)NM_FL_FORBID_ENCRYPT); - LASSERTF(NM_FL_MAP_PROJID == 0x00000080UL, "found 0x%.8llxUL\n", - (long long)NM_FL_MAP_PROJID); - LASSERTF(NM_FL2_READONLY_MOUNT == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NM_FL2_READONLY_MOUNT); + LASSERTF(NM_FL_ALLOW_ROOT_ACCESS == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_ALLOW_ROOT_ACCESS); + LASSERTF(NM_FL_TRUST_CLIENT_IDS == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_TRUST_CLIENT_IDS); + LASSERTF(NM_FL_DENY_UNKNOWN == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_DENY_UNKNOWN); + LASSERTF(NM_FL_MAP_UID == 0x00000008UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_UID); + LASSERTF(NM_FL_MAP_GID == 0x00000010UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_GID); + LASSERTF(NM_FL_ENABLE_AUDIT == 0x00000020UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_ENABLE_AUDIT); + LASSERTF(NM_FL_FORBID_ENCRYPT == 0x00000040UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_FORBID_ENCRYPT); + LASSERTF(NM_FL_MAP_PROJID == 0x00000080UL, "found 0x%.8xUL\n", + (unsigned)NM_FL_MAP_PROJID); + LASSERTF(NM_FL2_READONLY_MOUNT == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NM_FL2_READONLY_MOUNT); LASSERTF(NODEMAP_UID == 0, "found %lld\n", (long long)NODEMAP_UID); LASSERTF(NODEMAP_GID == 1, "found %lld\n", @@ -5743,34 +5847,34 @@ void lustre_assert_wire_constants(void) (long long)NODEMAP_FS_TO_CLIENT); LASSERTF(NODEMAP_CLIENT_TO_FS == 1, "found %lld\n", (long long)NODEMAP_CLIENT_TO_FS); - LASSERTF(NODEMAP_MAP_BOTH_LEGACY == 0x00000000UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_BOTH_LEGACY); - LASSERTF(NODEMAP_MAP_UID == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_UID); - LASSERTF(NODEMAP_MAP_GID == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_GID); - LASSERTF(NODEMAP_MAP_BOTH == 0x00000003UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_BOTH); - LASSERTF(NODEMAP_MAP_PROJID == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_PROJID); - LASSERTF(NODEMAP_MAP_ALL == 0x00000007UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_MAP_ALL); - LASSERTF(NODEMAP_RBAC_FILE_PERMS == 0x00000001UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_FILE_PERMS); - LASSERTF(NODEMAP_RBAC_DNE_OPS == 0x00000002UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_DNE_OPS); - LASSERTF(NODEMAP_RBAC_QUOTA_OPS == 0x00000004UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_QUOTA_OPS); - LASSERTF(NODEMAP_RBAC_BYFID_OPS == 0x00000008UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_BYFID_OPS); - LASSERTF(NODEMAP_RBAC_CHLG_OPS == 0x00000010UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_CHLG_OPS); - LASSERTF(NODEMAP_RBAC_FSCRYPT_ADMIN == 0x00000020UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_FSCRYPT_ADMIN); - LASSERTF(NODEMAP_RBAC_NONE == 0xFFFFFFC0UL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_NONE); - LASSERTF(NODEMAP_RBAC_ALL == 0xFFFFFFFFUL, "found 0x%.8llxUL\n", - (long long)NODEMAP_RBAC_ALL); + LASSERTF(NODEMAP_MAP_BOTH_LEGACY == 0x00000000UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_BOTH_LEGACY); + LASSERTF(NODEMAP_MAP_UID == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_UID); + LASSERTF(NODEMAP_MAP_GID == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_GID); + LASSERTF(NODEMAP_MAP_BOTH == 0x00000003UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_BOTH); + LASSERTF(NODEMAP_MAP_PROJID == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_PROJID); + LASSERTF(NODEMAP_MAP_ALL == 0x00000007UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_MAP_ALL); + LASSERTF(NODEMAP_RBAC_FILE_PERMS == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_FILE_PERMS); + LASSERTF(NODEMAP_RBAC_DNE_OPS == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_DNE_OPS); + LASSERTF(NODEMAP_RBAC_QUOTA_OPS == 0x00000004UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_QUOTA_OPS); + LASSERTF(NODEMAP_RBAC_BYFID_OPS == 0x00000008UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_BYFID_OPS); + LASSERTF(NODEMAP_RBAC_CHLG_OPS == 0x00000010UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_CHLG_OPS); + LASSERTF(NODEMAP_RBAC_FSCRYPT_ADMIN == 0x00000020UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_FSCRYPT_ADMIN); + LASSERTF(NODEMAP_RBAC_NONE == 0xffffffc0UL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_NONE); + LASSERTF(NODEMAP_RBAC_ALL == 0xffffffffUL, "found 0x%.8xUL\n", + (unsigned)NODEMAP_RBAC_ALL); LASSERTF(OFD_ACCESS_READ == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OFD_ACCESS_READ); @@ -6055,6 +6159,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_update_record, lur_update_rec)); LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_update_rec) == 32, "found %lld\n", (long long)(int)sizeof(((struct llog_update_record *)0)->lur_update_rec)); +#endif /* HAVE_SERVER_SUPPORT */ /* Checks for struct lustre_cfg */ LASSERTF((int)sizeof(struct lustre_cfg) == 32, "found %lld\n", @@ -6170,9 +6275,9 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_ADMIN == 0x000ce049UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_ADMIN); LASSERTF(LCFG_NODEMAP_ADD_PROJIDMAP == 0x000ce04aUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); + (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); LASSERTF(LCFG_NODEMAP_DEL_PROJIDMAP == 0x000ce04bUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); + (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); LASSERTF(LCFG_NODEMAP_TRUSTED == 0x000ce050UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_TRUSTED); LASSERTF(LCFG_NODEMAP_SQUASH_UID == 0x000ce051UL, "found 0x%.8xUL\n", @@ -6198,13 +6303,13 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_SET_SEPOL == 0x000ce05bUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SET_SEPOL); LASSERTF(LCFG_NODEMAP_FORBID_ENCRYPT == 0x000ce05cUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); + (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); LASSERTF(LCFG_NODEMAP_SQUASH_PROJID == 0x000ce05dUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_SQUASH_PROJID); + (unsigned)LCFG_NODEMAP_SQUASH_PROJID); LASSERTF(LCFG_NODEMAP_READONLY_MOUNT == 0x000ce05eUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_READONLY_MOUNT); + (unsigned)LCFG_NODEMAP_READONLY_MOUNT); LASSERTF(LCFG_NODEMAP_RBAC == 0x000ce05fUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_RBAC); + (unsigned)LCFG_NODEMAP_RBAC); LASSERTF(PORTALS_CFG_TYPE == 1, "found %lld\n", (long long)PORTALS_CFG_TYPE); LASSERTF(LUSTRE_CFG_TYPE == 123, "found %lld\n",