From 09d388e97ff43e614b7641799860c45e2a1e3be9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 17 Aug 2018 17:14:28 +0800 Subject: [PATCH] messages: define HEAD_VERSION and COMPAT_VERSION inlined otherwise we could have ../lib/libceph-common.so.0: undefined reference to `MOSDPGNotify::HEAD_VERSION when the compiler tries to be smart and pass them by reference. Signed-off-by: Kefu Chai --- src/messages/MBackfillReserve.h | 4 +- src/messages/MClientCapRelease.h | 4 +- src/messages/MClientCaps.h | 10 ++-- src/messages/MClientReconnect.h | 2 +- src/messages/MClientRequest.h | 4 +- src/messages/MClientSession.h | 4 +- src/messages/MConfig.h | 4 +- src/messages/MDataPing.h | 4 +- src/messages/MDiscoverReply.h | 2 +- src/messages/MExportCaps.h | 6 +-- src/messages/MForward.h | 4 +- src/messages/MGetConfig.h | 4 +- src/messages/MMDSBeacon.h | 4 +- src/messages/MMDSCacheRejoin.h | 10 ++-- src/messages/MMDSMap.h | 5 +- src/messages/MMDSSlaveRequest.h | 58 +++++++++++----------- src/messages/MMgrBeacon.h | 4 +- src/messages/MMgrClose.h | 4 +- src/messages/MMgrConfigure.h | 4 +- src/messages/MMgrOpen.h | 4 +- src/messages/MMgrReport.h | 4 +- src/messages/MMonElection.h | 12 ++--- src/messages/MMonGetVersionReply.h | 2 +- src/messages/MMonHealth.h | 2 +- src/messages/MMonHealthChecks.h | 4 +- src/messages/MMonMetadata.h | 2 +- src/messages/MMonMgrReport.h | 4 +- src/messages/MMonPaxos.h | 18 +++---- src/messages/MMonProbe.h | 4 +- src/messages/MMonScrub.h | 4 +- src/messages/MMonSubscribe.h | 4 +- src/messages/MMonSync.h | 4 +- src/messages/MNop.h | 4 +- src/messages/MOSDBoot.h | 4 +- src/messages/MOSDECSubOpRead.h | 4 +- src/messages/MOSDECSubOpReadReply.h | 4 +- src/messages/MOSDECSubOpWrite.h | 4 +- src/messages/MOSDECSubOpWriteReply.h | 4 +- src/messages/MOSDFailure.h | 4 +- src/messages/MOSDForceRecovery.h | 4 +- src/messages/MOSDMap.h | 4 +- src/messages/MOSDMarkMeDown.h | 4 +- src/messages/MOSDOp.h | 4 +- src/messages/MOSDOpReply.h | 4 +- src/messages/MOSDPGBackfill.h | 4 +- src/messages/MOSDPGBackfillRemove.h | 4 +- src/messages/MOSDPGCreate.h | 4 +- src/messages/MOSDPGCreate2.h | 4 +- src/messages/MOSDPGInfo.h | 4 +- src/messages/MOSDPGLog.h | 4 +- src/messages/MOSDPGNotify.h | 4 +- src/messages/MOSDPGPull.h | 4 +- src/messages/MOSDPGPush.h | 4 +- src/messages/MOSDPGPushReply.h | 4 +- src/messages/MOSDPGQuery.h | 4 +- src/messages/MOSDPGRecoveryDelete.h | 4 +- src/messages/MOSDPGRecoveryDeleteReply.h | 4 +- src/messages/MOSDPGRemove.h | 4 +- src/messages/MOSDPGScan.h | 4 +- src/messages/MOSDPGTrim.h | 4 +- src/messages/MOSDPGUpdateLogMissing.h | 4 +- src/messages/MOSDPGUpdateLogMissingReply.h | 4 +- src/messages/MOSDPing.h | 4 +- src/messages/MOSDRepOp.h | 4 +- src/messages/MOSDRepOpReply.h | 4 +- src/messages/MOSDRepScrub.h | 4 +- src/messages/MOSDRepScrubMap.h | 4 +- src/messages/MOSDScrub.h | 4 +- src/messages/MOSDScrub2.h | 4 +- src/messages/MOSDScrubReserve.h | 4 +- src/messages/MPoolOp.h | 4 +- src/messages/MRecoveryReserve.h | 4 +- src/messages/MRoute.h | 4 +- src/messages/MStatfs.h | 4 +- src/messages/MTimeCheck.h | 2 +- src/messages/MTimeCheck2.h | 4 +- src/messages/MWatchNotify.h | 4 +- src/mon/mon_types.h | 4 +- 78 files changed, 195 insertions(+), 196 deletions(-) diff --git a/src/messages/MBackfillReserve.h b/src/messages/MBackfillReserve.h index b8d64f825e304..c9c1f6bcac194 100644 --- a/src/messages/MBackfillReserve.h +++ b/src/messages/MBackfillReserve.h @@ -22,8 +22,8 @@ class MBackfillReserve : public MessageInstance public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 4; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 4; public: spg_t pgid; epoch_t query_epoch; diff --git a/src/messages/MClientCapRelease.h b/src/messages/MClientCapRelease.h index 8106d621c640b..76a4aae17d703 100644 --- a/src/messages/MClientCapRelease.h +++ b/src/messages/MClientCapRelease.h @@ -23,8 +23,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; public: struct ceph_mds_cap_release head; diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 38abc02437bac..c48c478f0f1d1 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -23,13 +23,13 @@ public: friend factory; private: - static const int HEAD_VERSION = 11; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 11; + static constexpr int COMPAT_VERSION = 1; public: - static const unsigned FLAG_SYNC = (1<<0); - static const unsigned FLAG_NO_CAPSNAP = (1<<1); // unused - static const unsigned FLAG_PENDING_CAPSNAP = (1<<2); + static constexpr unsigned FLAG_SYNC = (1<<0); + static constexpr unsigned FLAG_NO_CAPSNAP = (1<<1); // unused + static constexpr unsigned FLAG_PENDING_CAPSNAP = (1<<2); struct ceph_mds_caps_head head; diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h index 96e9b210e845d..47ac931c9df6f 100644 --- a/src/messages/MClientReconnect.h +++ b/src/messages/MClientReconnect.h @@ -24,7 +24,7 @@ class MClientReconnect : public MessageInstance { public: friend factory; private: - const static int HEAD_VERSION = 3; + static constexpr int HEAD_VERSION = 3; public: map caps; // only head inodes diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index f190979a9c50e..d109ca59b5b58 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -52,8 +52,8 @@ class MClientRequest : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 1; public: mutable struct ceph_mds_request_head head; /* XXX HACK! */ diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h index a672812fc29d5..9fa79cf9fb89f 100644 --- a/src/messages/MClientSession.h +++ b/src/messages/MClientSession.h @@ -22,8 +22,8 @@ class MClientSession : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 1; public: ceph_mds_session_head head; diff --git a/src/messages/MConfig.h b/src/messages/MConfig.h index ca79b9aa39ef7..ab5d6a94b3726 100644 --- a/src/messages/MConfig.h +++ b/src/messages/MConfig.h @@ -9,8 +9,8 @@ class MConfig : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; map config; diff --git a/src/messages/MDataPing.h b/src/messages/MDataPing.h index 664e7ebcbbe20..b05d06c8c90fc 100644 --- a/src/messages/MDataPing.h +++ b/src/messages/MDataPing.h @@ -32,8 +32,8 @@ class MDataPing : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; std::string tag; uint32_t counter = 0; diff --git a/src/messages/MDiscoverReply.h b/src/messages/MDiscoverReply.h index a25fa135a6d16..c5ab5c81e7d27 100644 --- a/src/messages/MDiscoverReply.h +++ b/src/messages/MDiscoverReply.h @@ -67,7 +67,7 @@ class MDiscoverReply : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; + static constexpr int HEAD_VERSION = 2; // info about original request inodeno_t base_ino; diff --git a/src/messages/MExportCaps.h b/src/messages/MExportCaps.h index 0b91f48ac4b6b..006a37526ae4f 100644 --- a/src/messages/MExportCaps.h +++ b/src/messages/MExportCaps.h @@ -23,9 +23,9 @@ class MExportCaps : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; - public: + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; +public: inodeno_t ino; bufferlist cap_bl; map client_map; diff --git a/src/messages/MForward.h b/src/messages/MForward.h index 9b34c086f95ac..2067d52a1934c 100644 --- a/src/messages/MForward.h +++ b/src/messages/MForward.h @@ -39,8 +39,8 @@ public: string msg_desc; // for operator<< only - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 4; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 4; MForward() : MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), tid(0), con_features(0), msg(NULL) {} diff --git a/src/messages/MGetConfig.h b/src/messages/MGetConfig.h index 11fc6c6fabbc6..2bbf1170373c1 100644 --- a/src/messages/MGetConfig.h +++ b/src/messages/MGetConfig.h @@ -9,8 +9,8 @@ class MGetConfig : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; EntityName name; ///< e.g., mon.a, client.foo string host; ///< our hostname diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index e72e20d1068af..6e1433d614cd5 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -184,8 +184,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 7; - static const int COMPAT_VERSION = 6; + static constexpr int HEAD_VERSION = 7; + static constexpr int COMPAT_VERSION = 6; uuid_d fsid; mds_gid_t global_id; diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h index 66e788b0bd7a9..3eef9f717c16d 100644 --- a/src/messages/MMDSCacheRejoin.h +++ b/src/messages/MMDSCacheRejoin.h @@ -32,13 +32,13 @@ public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; public: - static const int OP_WEAK = 1; // replica -> auth, i exist, + maybe open files. - static const int OP_STRONG = 2; // replica -> auth, i exist, + open files and lock state. - static const int OP_ACK = 3; // auth -> replica, here is your lock state. + static constexpr int OP_WEAK = 1; // replica -> auth, i exist, + maybe open files. + static constexpr int OP_STRONG = 2; // replica -> auth, i exist, + open files and lock state. + static constexpr int OP_ACK = 3; // auth -> replica, here is your lock state. static const char *get_opname(int op) { switch (op) { case OP_WEAK: return "weak"; diff --git a/src/messages/MMDSMap.h b/src/messages/MMDSMap.h index 482d32a5b1cba..2fef2beb53d70 100644 --- a/src/messages/MMDSMap.h +++ b/src/messages/MMDSMap.h @@ -24,9 +24,8 @@ class MMDSMap : public MessageInstance { public: friend factory; private: - - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; public: uuid_d fsid; epoch_t epoch = 0; diff --git a/src/messages/MMDSSlaveRequest.h b/src/messages/MMDSSlaveRequest.h index 9e80aff627f85..97e7cfd07a957 100644 --- a/src/messages/MMDSSlaveRequest.h +++ b/src/messages/MMDSSlaveRequest.h @@ -23,39 +23,39 @@ class MMDSSlaveRequest : public MessageInstance { public: friend factory; - static const int OP_XLOCK = 1; - static const int OP_XLOCKACK = -1; - static const int OP_UNXLOCK = 2; - static const int OP_AUTHPIN = 3; - static const int OP_AUTHPINACK = -3; + static constexpr int OP_XLOCK = 1; + static constexpr int OP_XLOCKACK = -1; + static constexpr int OP_UNXLOCK = 2; + static constexpr int OP_AUTHPIN = 3; + static constexpr int OP_AUTHPINACK = -3; - static const int OP_LINKPREP = 4; - static const int OP_UNLINKPREP = 5; - static const int OP_LINKPREPACK = -4; + static constexpr int OP_LINKPREP = 4; + static constexpr int OP_UNLINKPREP = 5; + static constexpr int OP_LINKPREPACK = -4; - static const int OP_RENAMEPREP = 7; - static const int OP_RENAMEPREPACK = -7; + static constexpr int OP_RENAMEPREP = 7; + static constexpr int OP_RENAMEPREPACK = -7; - static const int OP_WRLOCK = 8; - static const int OP_WRLOCKACK = -8; - static const int OP_UNWRLOCK = 9; + static constexpr int OP_WRLOCK = 8; + static constexpr int OP_WRLOCKACK = -8; + static constexpr int OP_UNWRLOCK = 9; - static const int OP_RMDIRPREP = 10; - static const int OP_RMDIRPREPACK = -10; + static constexpr int OP_RMDIRPREP = 10; + static constexpr int OP_RMDIRPREPACK = -10; - static const int OP_DROPLOCKS = 11; + static constexpr int OP_DROPLOCKS = 11; - static const int OP_RENAMENOTIFY = 12; - static const int OP_RENAMENOTIFYACK = -12; + static constexpr int OP_RENAMENOTIFY = 12; + static constexpr int OP_RENAMENOTIFYACK = -12; - static const int OP_FINISH = 17; - static const int OP_COMMITTED = -18; + static constexpr int OP_FINISH = 17; + static constexpr int OP_COMMITTED = -18; - static const int OP_ABORT = 20; // used for recovery only - //static const int OP_COMMIT = 21; // used for recovery only + static constexpr int OP_ABORT = 20; // used for recovery only + //static constexpr int OP_COMMIT = 21; // used for recovery only - static const char *get_opname(int o) { + static constexpr char *get_opname(int o) { switch (o) { case OP_XLOCK: return "xlock"; case OP_XLOCKACK: return "xlock_ack"; @@ -98,12 +98,12 @@ public: __s16 op; mutable __u16 flags; /* XXX HACK for mark_interrupted */ - static const unsigned FLAG_NONBLOCK = 1<<0; - static const unsigned FLAG_WOULDBLOCK = 1<<1; - static const unsigned FLAG_NOTJOURNALED = 1<<2; - static const unsigned FLAG_EROFS = 1<<3; - static const unsigned FLAG_ABORT = 1<<4; - static const unsigned FLAG_INTERRUPTED = 1<<5; + static constexpr unsigned FLAG_NONBLOCK = 1<<0; + static constexpr unsigned FLAG_WOULDBLOCK = 1<<1; + static constexpr unsigned FLAG_NOTJOURNALED = 1<<2; + static constexpr unsigned FLAG_EROFS = 1<<3; + static constexpr unsigned FLAG_ABORT = 1<<4; + static constexpr unsigned FLAG_INTERRUPTED = 1<<5; // for locking __u16 lock_type; // lock object type diff --git a/src/messages/MMgrBeacon.h b/src/messages/MMgrBeacon.h index 58905771db67c..789496131c3fa 100644 --- a/src/messages/MMgrBeacon.h +++ b/src/messages/MMgrBeacon.h @@ -27,8 +27,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 8; - static const int COMPAT_VERSION = 8; + static constexpr int HEAD_VERSION = 8; + static constexpr int COMPAT_VERSION = 8; protected: uint64_t gid; diff --git a/src/messages/MMgrClose.h b/src/messages/MMgrClose.h index 6d35e9ba7b7b9..25c31919e6612 100644 --- a/src/messages/MMgrClose.h +++ b/src/messages/MMgrClose.h @@ -10,8 +10,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; public: std::string daemon_name; diff --git a/src/messages/MMgrConfigure.h b/src/messages/MMgrConfigure.h index 3f1ff9b00ab55..34a981ba9a93b 100644 --- a/src/messages/MMgrConfigure.h +++ b/src/messages/MMgrConfigure.h @@ -26,8 +26,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; public: uint32_t stats_period = 0; diff --git a/src/messages/MMgrOpen.h b/src/messages/MMgrOpen.h index 721668c4b523b..0328f159d730b 100644 --- a/src/messages/MMgrOpen.h +++ b/src/messages/MMgrOpen.h @@ -22,8 +22,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 1; public: diff --git a/src/messages/MMgrReport.h b/src/messages/MMgrReport.h index 232e97400dedb..e1f69bba4e88c 100644 --- a/src/messages/MMgrReport.h +++ b/src/messages/MMgrReport.h @@ -75,8 +75,8 @@ public: friend factory; private: - static const int HEAD_VERSION = 6; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 6; + static constexpr int COMPAT_VERSION = 1; public: /** diff --git a/src/messages/MMonElection.h b/src/messages/MMonElection.h index 2e838b0bf7502..c296bc0507c27 100644 --- a/src/messages/MMonElection.h +++ b/src/messages/MMonElection.h @@ -25,14 +25,14 @@ public: friend factory; private: - static const int HEAD_VERSION = 7; - static const int COMPAT_VERSION = 5; + static constexpr int HEAD_VERSION = 7; + static constexpr int COMPAT_VERSION = 5; public: - static const int OP_PROPOSE = 1; - static const int OP_ACK = 2; - static const int OP_NAK = 3; - static const int OP_VICTORY = 4; + static constexpr int OP_PROPOSE = 1; + static constexpr int OP_ACK = 2; + static constexpr int OP_NAK = 3; + static constexpr int OP_VICTORY = 4; static const char *get_opname(int o) { switch (o) { case OP_PROPOSE: return "propose"; diff --git a/src/messages/MMonGetVersionReply.h b/src/messages/MMonGetVersionReply.h index 1eb3f567b331f..c49b4023b28f6 100644 --- a/src/messages/MMonGetVersionReply.h +++ b/src/messages/MMonGetVersionReply.h @@ -28,7 +28,7 @@ class MMonGetVersionReply : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; + static constexpr int HEAD_VERSION = 2; public: MMonGetVersionReply() : MessageInstance(CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION) { } diff --git a/src/messages/MMonHealth.h b/src/messages/MMonHealth.h index 393bb8040468f..f076e8675f4bd 100644 --- a/src/messages/MMonHealth.h +++ b/src/messages/MMonHealth.h @@ -22,7 +22,7 @@ class MMonHealth : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; + static constexpr int HEAD_VERSION = 1; int service_type = 0; int service_op = 0; diff --git a/src/messages/MMonHealthChecks.h b/src/messages/MMonHealthChecks.h index eeb8bac23c631..e69304a11cd78 100644 --- a/src/messages/MMonHealthChecks.h +++ b/src/messages/MMonHealthChecks.h @@ -11,8 +11,8 @@ class MMonHealthChecks : public MessageInstance public: friend factory; private: - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; public: // PGMapDigest is in data payload diff --git a/src/messages/MMonPaxos.h b/src/messages/MMonPaxos.h index 56ab8c5c01593..02d202dff0a30 100644 --- a/src/messages/MMonPaxos.h +++ b/src/messages/MMonPaxos.h @@ -24,18 +24,18 @@ class MMonPaxos : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 3; public: // op types - const static int OP_COLLECT = 1; // proposer: propose round - const static int OP_LAST = 2; // voter: accept proposed round - const static int OP_BEGIN = 3; // proposer: value proposed for this round - const static int OP_ACCEPT = 4; // voter: accept propsed value - const static int OP_COMMIT = 5; // proposer: notify learners of agreed value - const static int OP_LEASE = 6; // leader: extend peon lease - const static int OP_LEASE_ACK = 7; // peon: lease ack + static constexpr int OP_COLLECT = 1; // proposer: propose round + static constexpr int OP_LAST = 2; // voter: accept proposed round + static constexpr int OP_BEGIN = 3; // proposer: value proposed for this round + static constexpr int OP_ACCEPT = 4; // voter: accept propsed value + static constexpr int OP_COMMIT = 5; // proposer: notify learners of agreed value + static constexpr int OP_LEASE = 6; // leader: extend peon lease + static constexpr int OP_LEASE_ACK = 7; // peon: lease ack const static char *get_opname(int op) { switch (op) { case OP_COLLECT: return "collect"; diff --git a/src/messages/MMonProbe.h b/src/messages/MMonProbe.h index 2ee68de71e999..e244c3a94b587 100644 --- a/src/messages/MMonProbe.h +++ b/src/messages/MMonProbe.h @@ -24,8 +24,8 @@ class MMonProbe : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 6; - static const int COMPAT_VERSION = 5; + static constexpr int HEAD_VERSION = 6; + static constexpr int COMPAT_VERSION = 5; enum { OP_PROBE = 1, diff --git a/src/messages/MMonScrub.h b/src/messages/MMonScrub.h index 023fbdcd9d370..cb04ac2e85e6d 100644 --- a/src/messages/MMonScrub.h +++ b/src/messages/MMonScrub.h @@ -20,8 +20,8 @@ class MMonScrub : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; public: typedef enum { diff --git a/src/messages/MMonSubscribe.h b/src/messages/MMonSubscribe.h index bce11d3fc6acb..eafcf0b055b45 100644 --- a/src/messages/MMonSubscribe.h +++ b/src/messages/MMonSubscribe.h @@ -33,8 +33,8 @@ class MMonSubscribe : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 1; string hostname; map what; diff --git a/src/messages/MMonSync.h b/src/messages/MMonSync.h index c7c9d20d5e1cd..0f2f34862300e 100644 --- a/src/messages/MMonSync.h +++ b/src/messages/MMonSync.h @@ -19,8 +19,8 @@ class MMonSync : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; public: /** diff --git a/src/messages/MNop.h b/src/messages/MNop.h index 73f778cebd97c..018eafe178107 100644 --- a/src/messages/MNop.h +++ b/src/messages/MNop.h @@ -26,8 +26,8 @@ class MNop : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; __u32 tag; // ignored tag value diff --git a/src/messages/MOSDBoot.h b/src/messages/MOSDBoot.h index a76b07a4cafb1..eeaa7fefe5087 100644 --- a/src/messages/MOSDBoot.h +++ b/src/messages/MOSDBoot.h @@ -24,8 +24,8 @@ class MOSDBoot : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 6; - static const int COMPAT_VERSION = 6; + static constexpr int HEAD_VERSION = 6; + static constexpr int COMPAT_VERSION = 6; public: OSDSuperblock sb; diff --git a/src/messages/MOSDECSubOpRead.h b/src/messages/MOSDECSubOpRead.h index e1cdb78e06cb3..a2d63015f20d3 100644 --- a/src/messages/MOSDECSubOpRead.h +++ b/src/messages/MOSDECSubOpRead.h @@ -22,8 +22,8 @@ class MOSDECSubOpRead : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 4; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 4; public: enum { diff --git a/src/messages/MOSDForceRecovery.h b/src/messages/MOSDForceRecovery.h index 2a5b37f2443b7..eba5e5c93b29b 100644 --- a/src/messages/MOSDForceRecovery.h +++ b/src/messages/MOSDForceRecovery.h @@ -35,8 +35,8 @@ class MOSDForceRecovery : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; uuid_d fsid; vector forced_pgs; diff --git a/src/messages/MOSDMap.h b/src/messages/MOSDMap.h index 7ff35ba79ef10..a8822e7b3e47c 100644 --- a/src/messages/MOSDMap.h +++ b/src/messages/MOSDMap.h @@ -24,8 +24,8 @@ class MOSDMap : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 3; public: uuid_d fsid; diff --git a/src/messages/MOSDMarkMeDown.h b/src/messages/MOSDMarkMeDown.h index ce773fae32dd7..23523950e9d10 100644 --- a/src/messages/MOSDMarkMeDown.h +++ b/src/messages/MOSDMarkMeDown.h @@ -21,8 +21,8 @@ class MOSDMarkMeDown : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 8; - static const int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 8; + static constexpr int COMPAT_VERSION = 3; private: uint32_t client_inc = 0; diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h index 21422dd2f4810..1e5edd4b42c44 100644 --- a/src/messages/MOSDOpReply.h +++ b/src/messages/MOSDOpReply.h @@ -34,8 +34,8 @@ class MOSDOpReply : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 8; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 8; + static constexpr int COMPAT_VERSION = 2; object_t oid; pg_t pgid; diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index e57a38ccd5391..45e9aa9cdadbc 100644 --- a/src/messages/MOSDPGBackfill.h +++ b/src/messages/MOSDPGBackfill.h @@ -21,8 +21,8 @@ class MOSDPGBackfill : public MessageInstance { public: friend factory; - const static int HEAD_VERSION = 3; - const static int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 3; version_t epoch = 0; map mkpg; diff --git a/src/messages/MOSDPGCreate2.h b/src/messages/MOSDPGCreate2.h index 83cfc28ebe75a..3dd2e2069f7cb 100644 --- a/src/messages/MOSDPGCreate2.h +++ b/src/messages/MOSDPGCreate2.h @@ -14,8 +14,8 @@ class MOSDPGCreate2 : public MessageInstance { public: friend factory; - const static int HEAD_VERSION = 1; - const static int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; epoch_t epoch = 0; map> pgs; diff --git a/src/messages/MOSDPGInfo.h b/src/messages/MOSDPGInfo.h index 336a61d5b6bd9..8434651e4b875 100644 --- a/src/messages/MOSDPGInfo.h +++ b/src/messages/MOSDPGInfo.h @@ -23,8 +23,8 @@ class MOSDPGInfo : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 5; - static const int COMPAT_VERSION = 5; + static constexpr int HEAD_VERSION = 5; + static constexpr int COMPAT_VERSION = 5; epoch_t epoch = 0; diff --git a/src/messages/MOSDPGLog.h b/src/messages/MOSDPGLog.h index 4025c8f0d5592..86e65baeb8490 100644 --- a/src/messages/MOSDPGLog.h +++ b/src/messages/MOSDPGLog.h @@ -22,8 +22,8 @@ class MOSDPGLog : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 5; - static const int COMPAT_VERSION = 5; + static constexpr int HEAD_VERSION = 5; + static constexpr int COMPAT_VERSION = 5; epoch_t epoch = 0; /// query_epoch is the epoch of the query being responded to, or diff --git a/src/messages/MOSDPGNotify.h b/src/messages/MOSDPGNotify.h index 5cbf6569bc91a..2447525b4cbbd 100644 --- a/src/messages/MOSDPGNotify.h +++ b/src/messages/MOSDPGNotify.h @@ -27,8 +27,8 @@ class MOSDPGNotify : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 6; - static const int COMPAT_VERSION = 6; + static constexpr int HEAD_VERSION = 6; + static constexpr int COMPAT_VERSION = 6; epoch_t epoch = 0; /// query_epoch is the epoch of the query being responded to, or diff --git a/src/messages/MOSDPGPull.h b/src/messages/MOSDPGPull.h index 79c13a19e64ca..85043e021b069 100644 --- a/src/messages/MOSDPGPull.h +++ b/src/messages/MOSDPGPull.h @@ -21,8 +21,8 @@ class MOSDPGPull : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 2; vector pulls; diff --git a/src/messages/MOSDPGPush.h b/src/messages/MOSDPGPush.h index 77864cceabafe..611dbd9b361c5 100644 --- a/src/messages/MOSDPGPush.h +++ b/src/messages/MOSDPGPush.h @@ -21,8 +21,8 @@ class MOSDPGPush : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 2; public: pg_shard_t from; diff --git a/src/messages/MOSDPGPushReply.h b/src/messages/MOSDPGPushReply.h index dc0d6bfb98d24..a5c5d880e4424 100644 --- a/src/messages/MOSDPGPushReply.h +++ b/src/messages/MOSDPGPushReply.h @@ -21,8 +21,8 @@ class MOSDPGPushReply : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 4; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 4; version_t epoch = 0; diff --git a/src/messages/MOSDPGRecoveryDelete.h b/src/messages/MOSDPGRecoveryDelete.h index ac4152567fad7..4774978213a6d 100644 --- a/src/messages/MOSDPGRecoveryDelete.h +++ b/src/messages/MOSDPGRecoveryDelete.h @@ -14,8 +14,8 @@ class MOSDPGRecoveryDelete : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 3; epoch_t epoch = 0; diff --git a/src/messages/MOSDPGScan.h b/src/messages/MOSDPGScan.h index 4da8aac5128bb..04db4ae616597 100644 --- a/src/messages/MOSDPGScan.h +++ b/src/messages/MOSDPGScan.h @@ -21,8 +21,8 @@ class MOSDPGScan : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; public: enum { diff --git a/src/messages/MOSDPGTrim.h b/src/messages/MOSDPGTrim.h index ce8312dcaeed9..2ec971d4dedb7 100644 --- a/src/messages/MOSDPGTrim.h +++ b/src/messages/MOSDPGTrim.h @@ -22,8 +22,8 @@ class MOSDPGTrim : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; public: epoch_t epoch = 0; diff --git a/src/messages/MOSDPGUpdateLogMissing.h b/src/messages/MOSDPGUpdateLogMissing.h index 1764c23f1b555..f3db4bf935b9c 100644 --- a/src/messages/MOSDPGUpdateLogMissing.h +++ b/src/messages/MOSDPGUpdateLogMissing.h @@ -22,8 +22,8 @@ class MOSDPGUpdateLogMissing : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 4; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 4; public: enum { diff --git a/src/messages/MOSDRepOp.h b/src/messages/MOSDRepOp.h index daacad60406f2..fc6d06c1f7583 100644 --- a/src/messages/MOSDRepOp.h +++ b/src/messages/MOSDRepOp.h @@ -26,8 +26,8 @@ class MOSDRepOp : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; public: epoch_t map_epoch, min_epoch; diff --git a/src/messages/MOSDRepOpReply.h b/src/messages/MOSDRepOpReply.h index 239864846586a..8f158bce0abd9 100644 --- a/src/messages/MOSDRepOpReply.h +++ b/src/messages/MOSDRepOpReply.h @@ -32,8 +32,8 @@ class MOSDRepOpReply : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 9; - static const int COMPAT_VERSION = 6; + static constexpr int HEAD_VERSION = 9; + static constexpr int COMPAT_VERSION = 6; spg_t pgid; // PG to scrub eversion_t scrub_from; // only scrub log entries after scrub_from diff --git a/src/messages/MOSDRepScrubMap.h b/src/messages/MOSDRepScrubMap.h index 96705d0f51daf..45a736cbff546 100644 --- a/src/messages/MOSDRepScrubMap.h +++ b/src/messages/MOSDRepScrubMap.h @@ -25,8 +25,8 @@ class MOSDRepScrubMap : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 2; uuid_d fsid; vector scrub_pgs; diff --git a/src/messages/MOSDScrub2.h b/src/messages/MOSDScrub2.h index 28e1d2a3bf32e..6e1a6145f77e4 100644 --- a/src/messages/MOSDScrub2.h +++ b/src/messages/MOSDScrub2.h @@ -13,8 +13,8 @@ class MOSDScrub2 : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; uuid_d fsid; epoch_t epoch; diff --git a/src/messages/MOSDScrubReserve.h b/src/messages/MOSDScrubReserve.h index 5cab78d59d24d..c8966c1a6ce9d 100644 --- a/src/messages/MOSDScrubReserve.h +++ b/src/messages/MOSDScrubReserve.h @@ -21,8 +21,8 @@ class MOSDScrubReserve : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 4; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 4; + static constexpr int COMPAT_VERSION = 2; public: uuid_d fsid; diff --git a/src/messages/MRecoveryReserve.h b/src/messages/MRecoveryReserve.h index 344eae5516b35..ae10f36349570 100644 --- a/src/messages/MRecoveryReserve.h +++ b/src/messages/MRecoveryReserve.h @@ -22,8 +22,8 @@ class MRecoveryReserve : public MessageInstance public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 2; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 2; public: spg_t pgid; epoch_t query_epoch; diff --git a/src/messages/MRoute.h b/src/messages/MRoute.h index b858abe414bbd..1e35a0b2bca46 100644 --- a/src/messages/MRoute.h +++ b/src/messages/MRoute.h @@ -24,8 +24,8 @@ class MRoute : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 3; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 3; uint64_t session_mon_tid; Message *msg; diff --git a/src/messages/MStatfs.h b/src/messages/MStatfs.h index 71f2d7fea5552..45601d78d330b 100644 --- a/src/messages/MStatfs.h +++ b/src/messages/MStatfs.h @@ -23,8 +23,8 @@ class MStatfs : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 2; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; public: uuid_d fsid; diff --git a/src/messages/MTimeCheck.h b/src/messages/MTimeCheck.h index 5905c6b6a7574..628640a753421 100644 --- a/src/messages/MTimeCheck.h +++ b/src/messages/MTimeCheck.h @@ -19,7 +19,7 @@ class MTimeCheck : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; + static constexpr int HEAD_VERSION = 1; enum { OP_PING = 1, diff --git a/src/messages/MTimeCheck2.h b/src/messages/MTimeCheck2.h index 56243d10a92e9..6c100c672b0f4 100644 --- a/src/messages/MTimeCheck2.h +++ b/src/messages/MTimeCheck2.h @@ -18,8 +18,8 @@ class MTimeCheck2 : public MessageInstance { public: friend factory; - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; enum { OP_PING = 1, diff --git a/src/messages/MWatchNotify.h b/src/messages/MWatchNotify.h index 1300ba6d92e71..8da4738b35a11 100644 --- a/src/messages/MWatchNotify.h +++ b/src/messages/MWatchNotify.h @@ -23,8 +23,8 @@ class MWatchNotify : public MessageInstance { public: friend factory; private: - static const int HEAD_VERSION = 3; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 3; + static constexpr int COMPAT_VERSION = 1; public: uint64_t cookie; ///< client unique id for this watch or notify diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index 841353019d82b..095e1874cdae1 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -318,8 +318,8 @@ inline const char *ceph_mon_feature_name(uint64_t b) class mon_feature_t { - static const int HEAD_VERSION = 1; - static const int COMPAT_VERSION = 1; + static constexpr int HEAD_VERSION = 1; + static constexpr int COMPAT_VERSION = 1; // mon-specific features uint64_t features; -- 2.39.5