From d01bd53da20e2c7952ae1a0943b21075b215d28b Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 16 Nov 2023 15:35:05 +0800 Subject: [PATCH] mds: use explicitly sized types for network and disk encoding The size of 'unsigned' type maybe not different from different OSes. And we should always use explicitly sized type. Fixes: https://tracker.ceph.com/issues/63552 Signed-off-by: Xiubo Li --- src/mds/Capability.h | 2 +- src/mds/OpenFileTable.h | 2 +- src/messages/MClientCaps.h | 2 +- src/messages/MClientSession.h | 2 +- src/messages/MMDSScrub.h | 4 ++-- src/messages/MMDSScrubStats.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mds/Capability.h b/src/mds/Capability.h index 3fd6d2ce6d4f0..ebc626a22949a 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -381,7 +381,7 @@ private: ceph_seq_t mseq = 0; int suppress = 0; - unsigned state = 0; + uint32_t state = 0; int lock_cache_allowed = 0; }; diff --git a/src/mds/OpenFileTable.h b/src/mds/OpenFileTable.h index 1f91c202021f9..b18395213f56b 100644 --- a/src/mds/OpenFileTable.h +++ b/src/mds/OpenFileTable.h @@ -113,7 +113,7 @@ protected: version_t omap_version = 0; - unsigned omap_num_objs = 0; + uint32_t omap_num_objs = 0; std::vector omap_num_items; std::map anchor_map; diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 9d343a4af6b7f..96b2cb7d8b81c 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -57,7 +57,7 @@ private: uint32_t caller_gid = 0; /* advisory CLIENT_CAPS_* flags to send to mds */ - unsigned flags = 0; + uint32_t flags = 0; std::vector fscrypt_auth; std::vector fscrypt_file; diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h index 3e70370a52d9c..37b3fc1d0629e 100644 --- a/src/messages/MClientSession.h +++ b/src/messages/MClientSession.h @@ -28,7 +28,7 @@ public: ceph_mds_session_head head; static constexpr unsigned SESSION_BLOCKLISTED = (1<<0); - unsigned flags = 0; + uint32_t flags = 0; std::map metadata; feature_bitset_t supported_features; metric_spec_t metric_spec; diff --git a/src/messages/MMDSScrub.h b/src/messages/MMDSScrub.h index a1bf2b54f5dd0..7714b377608ee 100644 --- a/src/messages/MMDSScrub.h +++ b/src/messages/MMDSScrub.h @@ -130,11 +130,11 @@ private: static constexpr unsigned FLAG_RECURSIVE = 1<<2; static constexpr unsigned FLAG_REPAIR = 1<<3; - int op; + int32_t op; inodeno_t ino; fragset_t frags; std::string tag; inodeno_t origin; - unsigned flags = 0; + uint32_t flags = 0; }; #endif // CEPH_MMDSSCRUB_H diff --git a/src/messages/MMDSScrubStats.h b/src/messages/MMDSScrubStats.h index c60981be5907a..2cbb7f2f2116f 100644 --- a/src/messages/MMDSScrubStats.h +++ b/src/messages/MMDSScrubStats.h @@ -68,7 +68,7 @@ protected: ~MMDSScrubStats() override {} private: - unsigned epoch; + uint32_t epoch; std::set scrubbing_tags; bool update_scrubbing = false; bool aborting = false; -- 2.39.5