From: Sage Weil Date: Mon, 20 Feb 2017 19:18:11 +0000 (-0500) Subject: osd: constify misc messages X-Git-Tag: v12.0.1~279^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16e99f661d42f51eb313f028243d78460008e143;p=ceph.git osd: constify misc messages Signed-off-by: Sage Weil --- diff --git a/src/messages/MOSDFailure.h b/src/messages/MOSDFailure.h index 2b51a620a6f7..7f0fb8668612 100644 --- a/src/messages/MOSDFailure.h +++ b/src/messages/MOSDFailure.h @@ -59,7 +59,7 @@ public: bool is_immediate() const { return flags & FLAG_IMMEDIATE; } - epoch_t get_epoch() { return epoch; } + epoch_t get_epoch() const { return epoch; } void decode_payload() { bufferlist::iterator p = payload.begin(); diff --git a/src/messages/MOSDMarkMeDown.h b/src/messages/MOSDMarkMeDown.h index cb6772989b2c..46df68bd9595 100644 --- a/src/messages/MOSDMarkMeDown.h +++ b/src/messages/MOSDMarkMeDown.h @@ -40,8 +40,8 @@ class MOSDMarkMeDown : public PaxosServiceMessage { ~MOSDMarkMeDown() {} public: - entity_inst_t get_target() { return target_osd; } - epoch_t get_epoch() { return epoch; } + entity_inst_t get_target() const { return target_osd; } + epoch_t get_epoch() const { return epoch; } void decode_payload() { bufferlist::iterator p = payload.begin(); diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index 5c2db7b011b4..89e1a8a45c5f 100755 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -130,14 +130,14 @@ public: else return object_locator_t(hobj); } - object_t& get_oid() { + const object_t& get_oid() const { assert(!final_decode_needed); return hobj.oid; } const hobject_t &get_hobj() const { return hobj; } - snapid_t get_snapid() { + snapid_t get_snapid() const { assert(!final_decode_needed); return hobj.snap; } @@ -231,7 +231,7 @@ public: add_simple_op(CEPH_OSD_OP_STAT, 0, 0); } - bool has_flag(__u32 flag) { return flags & flag; }; + bool has_flag(__u32 flag) const { return flags & flag; }; bool wants_ack() const { return flags & CEPH_OSD_FLAG_ACK; } bool wants_ondisk() const { return flags & CEPH_OSD_FLAG_ONDISK; } bool wants_onnvram() const { return flags & CEPH_OSD_FLAG_ONNVRAM; } diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h index 3d51d1c21165..49c62ed9ea20 100644 --- a/src/messages/MOSDOpReply.h +++ b/src/messages/MOSDOpReply.h @@ -128,7 +128,8 @@ public: : Message(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION) { do_redirect = false; } - MOSDOpReply(MOSDOp *req, int r, epoch_t e, int acktype, bool ignore_out_data) + MOSDOpReply(const MOSDOp *req, int r, epoch_t e, int acktype, + bool ignore_out_data) : Message(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION), oid(req->hobj.oid), pgid(req->pgid.pgid), ops(req->ops) { diff --git a/src/messages/MOSDPGTrim.h b/src/messages/MOSDPGTrim.h index 6a1a8aa5a7a7..eb19aefa42bd 100644 --- a/src/messages/MOSDPGTrim.h +++ b/src/messages/MOSDPGTrim.h @@ -27,7 +27,7 @@ public: spg_t pgid; eversion_t trim_to; - epoch_t get_epoch() { return epoch; } + epoch_t get_epoch() const { return epoch; } MOSDPGTrim() : Message(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGTrim(version_t mv, spg_t p, eversion_t tt) : diff --git a/src/messages/MOSDRepOpReply.h b/src/messages/MOSDRepOpReply.h index 67c2d76bf735..b9c0c22d2af9 100644 --- a/src/messages/MOSDRepOpReply.h +++ b/src/messages/MOSDRepOpReply.h @@ -95,11 +95,11 @@ public: int get_result() { return result; } void set_last_complete_ondisk(eversion_t v) { last_complete_ondisk = v; } - eversion_t get_last_complete_ondisk() { return last_complete_ondisk; } + eversion_t get_last_complete_ondisk() const { return last_complete_ondisk; } public: MOSDRepOpReply( - MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, int at) : + const MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, int at) : MOSDFastDispatchOp(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(e), reqid(req->reqid), diff --git a/src/messages/MOSDSubOpReply.h b/src/messages/MOSDSubOpReply.h index aa300efc9314..95965697a6cf 100644 --- a/src/messages/MOSDSubOpReply.h +++ b/src/messages/MOSDSubOpReply.h @@ -116,8 +116,8 @@ public: epoch_t get_map_epoch() { return map_epoch; } - spg_t get_pg() { return pgid; } - hobject_t get_poid() { return poid; } + spg_t get_pg() const { return pgid; } + const hobject_t& get_poid() const { return poid; } int get_ack_type() { return ack_type; } bool is_ondisk() { return ack_type & CEPH_OSD_FLAG_ONDISK; } @@ -136,7 +136,7 @@ public: public: MOSDSubOpReply( - MOSDSubOp *req, pg_shard_t from, int result_, epoch_t e, int at) + const MOSDSubOp *req, pg_shard_t from, int result_, epoch_t e, int at) : MOSDFastDispatchOp(MSG_OSD_SUBOPREPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(e), reqid(req->reqid),