diff options
author | Sage Weil <sage.weil@dreamhost.com> | 2012-01-30 22:28:44 +0100 |
---|---|---|
committer | Sage Weil <sage.weil@dreamhost.com> | 2012-01-30 22:28:53 +0100 |
commit | 9987f8f95cf2e6f9d7619e50a8b7742762d974ee (patch) | |
tree | 0d6e55838dc8e6099af5dd00b6685920cd022643 /src/messages | |
parent | paxos: explicitly pass in send timestamp (diff) | |
download | ceph-9987f8f95cf2e6f9d7619e50a8b7742762d974ee.tar.xz ceph-9987f8f95cf2e6f9d7619e50a8b7742762d974ee.zip |
msg: go const-crazy on messages
- get_type_name()
- print()
and all the random crap they call.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Diffstat (limited to 'src/messages')
99 files changed, 253 insertions, 248 deletions
diff --git a/src/messages/MAuth.h b/src/messages/MAuth.h index d7922ebe35d..40a7fa5e3ea 100644 --- a/src/messages/MAuth.h +++ b/src/messages/MAuth.h @@ -29,8 +29,8 @@ private: ~MAuth() {} public: - const char *get_type_name() { return "auth"; } - void print(ostream& out) { + const char *get_type_name() const { return "auth"; } + void print(ostream& out) const { out << "auth(proto " << protocol << " " << auth_payload.length() << " bytes" << " epoch " << monmap_epoch << ")"; } diff --git a/src/messages/MAuthReply.h b/src/messages/MAuthReply.h index 31c1f993a35..8704346dc76 100644 --- a/src/messages/MAuthReply.h +++ b/src/messages/MAuthReply.h @@ -36,8 +36,8 @@ private: ~MAuthReply() {} public: - const char *get_type_name() { return "auth_reply"; } - void print(ostream& o) { + const char *get_type_name() const { return "auth_reply"; } + void print(ostream& o) const { char buf[80]; o << "auth_reply(proto " << protocol << " " << result << " " << strerror_r(-result, buf, sizeof(buf)); if (result_msg.length()) diff --git a/src/messages/MCacheExpire.h b/src/messages/MCacheExpire.h index db6eda4559e..c88583a1952 100644 --- a/src/messages/MCacheExpire.h +++ b/src/messages/MCacheExpire.h @@ -53,7 +53,7 @@ private: ~MCacheExpire() {} public: - virtual const char *get_type_name() { return "cache_expire";} + virtual const char *get_type_name() const { return "cache_expire";} void add_inode(dirfrag_t r, vinodeno_t vino, int nonce) { realms[r].inodes[vino] = nonce; diff --git a/src/messages/MClientCapRelease.h b/src/messages/MClientCapRelease.h index 1843b1849a4..5258c5d970f 100644 --- a/src/messages/MClientCapRelease.h +++ b/src/messages/MClientCapRelease.h @@ -31,8 +31,8 @@ private: ~MClientCapRelease() {} public: - const char *get_type_name() { return "client_cap_release";} - void print(ostream& out) { + const char *get_type_name() const { return "client_cap_release";} + void print(ostream& out) const { out << "client_cap_release(" << head.num << ")"; } diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 3aecfe2b235..d515304f93e 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -106,8 +106,8 @@ private: ~MClientCaps() {} public: - const char *get_type_name() { return "Cfcap";} - void print(ostream& out) { + const char *get_type_name() const { return "Cfcap";} + void print(ostream& out) const { out << "client_caps(" << ceph_cap_op_name(head.op) << " ino " << inodeno_t(head.ino) << " " << head.cap_id diff --git a/src/messages/MClientLease.h b/src/messages/MClientLease.h index 0470ad9f67a..2b80c2ad234 100644 --- a/src/messages/MClientLease.h +++ b/src/messages/MClientLease.h @@ -22,12 +22,12 @@ struct MClientLease : public Message { struct ceph_mds_lease h; string dname; - int get_action() { return h.action; } - ceph_seq_t get_seq() { return h.seq; } - int get_mask() { return h.mask; } - inodeno_t get_ino() { return inodeno_t(h.ino); } - snapid_t get_first() { return snapid_t(h.first); } - snapid_t get_last() { return snapid_t(h.last); } + int get_action() const { return h.action; } + ceph_seq_t get_seq() const { return h.seq; } + int get_mask() const { return h.mask; } + inodeno_t get_ino() const { return inodeno_t(h.ino); } + snapid_t get_first() const { return snapid_t(h.first); } + snapid_t get_last() const { return snapid_t(h.last); } MClientLease() : Message(CEPH_MSG_CLIENT_LEASE) {} MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl) : @@ -55,8 +55,8 @@ private: ~MClientLease() {} public: - const char *get_type_name() { return "client_lease"; } - void print(ostream& out) { + const char *get_type_name() const { return "client_lease"; } + void print(ostream& out) const { out << "client_lease(a=" << ceph_lease_op_name(get_action()) << " seq " << get_seq() << " mask " << get_mask(); diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h index 175aff0b1b1..aef97ee46df 100644 --- a/src/messages/MClientReconnect.h +++ b/src/messages/MClientReconnect.h @@ -30,8 +30,8 @@ private: ~MClientReconnect() {} public: - const char *get_type_name() { return "client_reconnect"; } - void print(ostream& out) { + const char *get_type_name() const { return "client_reconnect"; } + void print(ostream& out) const { out << "client_reconnect(" << caps.size() << " caps)"; } diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h index 05d96cb3675..ee3dbb92a4f 100644 --- a/src/messages/MClientReply.h +++ b/src/messages/MClientReply.h @@ -186,18 +186,18 @@ public: bufferlist snapbl; public: - int get_op() { return head.op; } + int get_op() const { return head.op; } void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; } - epoch_t get_mdsmap_epoch() { return head.mdsmap_epoch; } + epoch_t get_mdsmap_epoch() const { return head.mdsmap_epoch; } - int get_result() { return (__s32)(__u32)head.result; } + int get_result() const { return (__s32)(__u32)head.result; } void set_result(int r) { head.result = r; } void set_unsafe() { head.safe = 0; } - bool is_safe() { return head.safe; } + bool is_safe() const { return head.safe; } MClientReply() {} MClientReply(MClientRequest *req, int result = 0) : @@ -212,8 +212,8 @@ private: ~MClientReply() {} public: - const char *get_type_name() { return "creply"; } - void print(ostream& o) { + const char *get_type_name() const { return "creply"; } + void print(ostream& o) const { o << "client_reply(???:" << get_tid(); o << " = " << get_result(); if (get_result() <= 0) { diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index 2e27382a739..4e61fa48c35 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -104,7 +104,7 @@ public: (head.op == CEPH_MDS_OP_CREATE); } - int get_flags() { + int get_flags() const { return head.flags; } bool is_replay() { @@ -127,17 +127,17 @@ public: head.flags = head.flags | CEPH_MDS_FLAG_REPLAY; } - tid_t get_oldest_client_tid() { return head.oldest_client_tid; } - int get_num_fwd() { return head.num_fwd; } - int get_retry_attempt() { return head.num_retry; } - int get_op() { return head.op; } - unsigned get_caller_uid() { return head.caller_uid; } - unsigned get_caller_gid() { return head.caller_gid; } - - const string& get_path() { return path.get_path(); } - filepath& get_filepath() { return path; } - const string& get_path2() { return path2.get_path(); } - filepath& get_filepath2() { return path2; } + tid_t get_oldest_client_tid() const { return head.oldest_client_tid; } + int get_num_fwd() const { return head.num_fwd; } + int get_retry_attempt() const { return head.num_retry; } + int get_op() const { return head.op; } + unsigned get_caller_uid() const { return head.caller_uid; } + unsigned get_caller_gid() const { return head.caller_gid; } + + const string& get_path() const { return path.get_path(); } + const filepath& get_filepath() const { return path; } + const string& get_path2() const { return path2.get_path(); } + const filepath& get_filepath2() const { return path2; } int get_dentry_wanted() { return get_flags() & CEPH_MDS_FLAG_WANT_DENTRY; } @@ -157,8 +157,8 @@ public: ::encode_nohead(releases, payload); } - const char *get_type_name() { return "creq"; } - void print(ostream& out) { + const char *get_type_name() const { return "creq"; } + void print(ostream& out) const { out << "client_request(" << get_orig_source() << ":" << get_tid() << " " << ceph_mds_op_name(get_op()); diff --git a/src/messages/MClientRequestForward.h b/src/messages/MClientRequestForward.h index 814534cc6da..c212a4a30e9 100644 --- a/src/messages/MClientRequestForward.h +++ b/src/messages/MClientRequestForward.h @@ -37,8 +37,8 @@ public: int get_num_fwd() { return num_fwd; } bool must_resend() { return client_must_resend; } - const char *get_type_name() { return "client_request_forward"; } - void print(ostream& o) { + const char *get_type_name() const { return "client_request_forward"; } + void print(ostream& o) const { o << "client_request_forward(" << get_tid() << " to mds." << dest_mds << " num_fwd=" << num_fwd diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h index cd516495c67..4b98a983b0f 100644 --- a/src/messages/MClientSession.h +++ b/src/messages/MClientSession.h @@ -21,11 +21,11 @@ class MClientSession : public Message { public: ceph_mds_session_head head; - int get_op() { return head.op; } - version_t get_seq() { return head.seq; } - utime_t get_stamp() { return utime_t(head.stamp); } - int get_max_caps() { return head.max_caps; } - int get_max_leases() { return head.max_leases; } + int get_op() const { return head.op; } + version_t get_seq() const { return head.seq; } + utime_t get_stamp() const { return utime_t(head.stamp); } + int get_max_caps() const { return head.max_caps; } + int get_max_leases() const { return head.max_leases; } MClientSession() : Message(CEPH_MSG_CLIENT_SESSION) { } MClientSession(int o, version_t s=0) : @@ -45,8 +45,8 @@ private: ~MClientSession() {} public: - const char *get_type_name() { return "client_session"; } - void print(ostream& out) { + const char *get_type_name() const { return "client_session"; } + void print(ostream& out) const { out << "client_session(" << ceph_session_op_name(get_op()); if (get_seq()) out << " seq " << get_seq(); diff --git a/src/messages/MClientSnap.h b/src/messages/MClientSnap.h index d7d0383d6a9..7f7283e3405 100644 --- a/src/messages/MClientSnap.h +++ b/src/messages/MClientSnap.h @@ -34,8 +34,8 @@ private: ~MClientSnap() {} public: - const char *get_type_name() { return "client_snap"; } - void print(ostream& out) { + const char *get_type_name() const { return "client_snap"; } + void print(ostream& out) const { out << "client_snap(" << ceph_snap_op_name(head.op); if (head.split) out << " split=" << inodeno_t(head.split); diff --git a/src/messages/MCommand.h b/src/messages/MCommand.h index 4d2af0473b5..e2fe0752f34 100644 --- a/src/messages/MCommand.h +++ b/src/messages/MCommand.h @@ -35,8 +35,8 @@ private: ~MCommand() {} public: - const char *get_type_name() { return "command"; } - void print(ostream& o) { + const char *get_type_name() const { return "command"; } + void print(ostream& o) const { o << "command(tid " << get_tid() << ": "; for (unsigned i=0; i<cmd.size(); i++) { if (i) o << ' '; diff --git a/src/messages/MCommandReply.h b/src/messages/MCommandReply.h index 701d854daaa..eda184f4ce0 100644 --- a/src/messages/MCommandReply.h +++ b/src/messages/MCommandReply.h @@ -36,8 +36,8 @@ private: ~MCommandReply() {} public: - const char *get_type_name() { return "command_reply"; } - void print(ostream& o) { + const char *get_type_name() const { return "command_reply"; } + void print(ostream& o) const { o << "command_reply(tid " << get_tid() << ": " << r << " " << rs << ")"; } diff --git a/src/messages/MDentryLink.h b/src/messages/MDentryLink.h index 2b89a4e60d3..ed02bc20e6b 100644 --- a/src/messages/MDentryLink.h +++ b/src/messages/MDentryLink.h @@ -39,8 +39,8 @@ private: ~MDentryLink() {} public: - const char *get_type_name() { return "dentry_link";} - void print(ostream& o) { + const char *get_type_name() const { return "dentry_link";} + void print(ostream& o) const { o << "dentry_link(" << dirfrag << " " << dn << ")"; } diff --git a/src/messages/MDentryUnlink.h b/src/messages/MDentryUnlink.h index ca0ce354284..1cae33fbb83 100644 --- a/src/messages/MDentryUnlink.h +++ b/src/messages/MDentryUnlink.h @@ -36,8 +36,8 @@ private: ~MDentryUnlink() {} public: - const char *get_type_name() { return "dentry_unlink";} - void print(ostream& o) { + const char *get_type_name() const { return "dentry_unlink";} + void print(ostream& o) const { o << "dentry_unlink(" << dirfrag << " " << dn << ")"; } diff --git a/src/messages/MDirUpdate.h b/src/messages/MDirUpdate.h index cbe1031e0a6..e9914c235c7 100644 --- a/src/messages/MDirUpdate.h +++ b/src/messages/MDirUpdate.h @@ -27,12 +27,12 @@ class MDirUpdate : public Message { filepath path; public: - int get_source_mds() { return from_mds; } - dirfrag_t get_dirfrag() { return dirfrag; } - int get_dir_rep() { return dir_rep; } - set<int>& get_dir_rep_by() { return dir_rep_by; } - bool should_discover() { return discover > 0; } - filepath& get_path() { return path; } + int get_source_mds() const { return from_mds; } + dirfrag_t get_dirfrag() const { return dirfrag; } + int get_dir_rep() const { return dir_rep; } + const set<int>& get_dir_rep_by() const { return dir_rep_by; } + bool should_discover() const { return discover > 0; } + const filepath& get_path() const { return path; } void tried_discover() { if (discover) discover--; @@ -57,8 +57,8 @@ private: ~MDirUpdate() {} public: - const char *get_type_name() { return "dir_update"; } - void print(ostream& out) { + const char *get_type_name() const { return "dir_update"; } + void print(ostream& out) const { out << "dir_update(" << get_dirfrag() << ")"; } diff --git a/src/messages/MDiscover.h b/src/messages/MDiscover.h index b993c82eea0..937b51ec92f 100644 --- a/src/messages/MDiscover.h +++ b/src/messages/MDiscover.h @@ -69,8 +69,8 @@ private: ~MDiscover() {} public: - const char *get_type_name() { return "Dis"; } - void print(ostream &out) { + const char *get_type_name() const { return "Dis"; } + void print(ostream &out) const { out << "discover(" << header.tid << " " << base_ino << "." << base_dir_frag << " " << want; if (want_ino) diff --git a/src/messages/MDiscoverReply.h b/src/messages/MDiscoverReply.h index 4d3c60e5505..0b424157a68 100644 --- a/src/messages/MDiscoverReply.h +++ b/src/messages/MDiscoverReply.h @@ -146,8 +146,8 @@ private: ~MDiscoverReply() {} public: - const char *get_type_name() { return "discover_reply"; } - void print(ostream& out) { + const char *get_type_name() const { return "discover_reply"; } + void print(ostream& out) const { out << "discover_reply(" << header.tid << " " << base_ino << ")"; } diff --git a/src/messages/MExportCaps.h b/src/messages/MExportCaps.h index 167af27cbe4..dcb2298eebb 100644 --- a/src/messages/MExportCaps.h +++ b/src/messages/MExportCaps.h @@ -31,8 +31,8 @@ private: ~MExportCaps() {} public: - const char *get_type_name() { return "export_caps"; } - void print(ostream& o) { + const char *get_type_name() const { return "export_caps"; } + void print(ostream& o) const { o << "export_caps(" << ino << ")"; } diff --git a/src/messages/MExportCapsAck.h b/src/messages/MExportCapsAck.h index 623fb2b7a14..b8fcf1fa9ca 100644 --- a/src/messages/MExportCapsAck.h +++ b/src/messages/MExportCapsAck.h @@ -31,8 +31,8 @@ private: ~MExportCapsAck() {} public: - const char *get_type_name() { return "export_caps_ack"; } - void print(ostream& o) { + const char *get_type_name() const { return "export_caps_ack"; } + void print(ostream& o) const { o << "export_caps_ack(" << ino << ")"; } diff --git a/src/messages/MExportDir.h b/src/messages/MExportDir.h index c8542985a20..4f74e7a926e 100644 --- a/src/messages/MExportDir.h +++ b/src/messages/MExportDir.h @@ -35,8 +35,8 @@ private: ~MExportDir() {} public: - const char *get_type_name() { return "Ex"; } - void print(ostream& o) { + const char *get_type_name() const { return "Ex"; } + void print(ostream& o) const { o << "export(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirAck.h b/src/messages/MExportDirAck.h index 13ff47d21e1..8ad79d9f961 100644 --- a/src/messages/MExportDirAck.h +++ b/src/messages/MExportDirAck.h @@ -30,8 +30,8 @@ private: ~MExportDirAck() {} public: - const char *get_type_name() { return "ExAck"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExAck"; } + void print(ostream& o) const { o << "export_ack(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirCancel.h b/src/messages/MExportDirCancel.h index e87775436ce..52f7b124fa9 100644 --- a/src/messages/MExportDirCancel.h +++ b/src/messages/MExportDirCancel.h @@ -32,8 +32,8 @@ private: ~MExportDirCancel() {} public: - const char *get_type_name() { return "ExCancel"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExCancel"; } + void print(ostream& o) const { o << "export_cancel(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirDiscover.h b/src/messages/MExportDirDiscover.h index e8276f97ba0..7602bd91ee9 100644 --- a/src/messages/MExportDirDiscover.h +++ b/src/messages/MExportDirDiscover.h @@ -45,8 +45,8 @@ private: ~MExportDirDiscover() {} public: - const char *get_type_name() { return "ExDis"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExDis"; } + void print(ostream& o) const { o << "export_discover(" << dirfrag << " " << path << ")"; } diff --git a/src/messages/MExportDirDiscoverAck.h b/src/messages/MExportDirDiscoverAck.h index 79cd6c74fe0..2aafc7400b8 100644 --- a/src/messages/MExportDirDiscoverAck.h +++ b/src/messages/MExportDirDiscoverAck.h @@ -36,8 +36,8 @@ private: ~MExportDirDiscoverAck() {} public: - const char *get_type_name() { return "ExDisA"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExDisA"; } + void print(ostream& o) const { o << "export_discover_ack(" << dirfrag; if (success) o << " success)"; diff --git a/src/messages/MExportDirFinish.h b/src/messages/MExportDirFinish.h index b97902de932..6d05885f3e0 100644 --- a/src/messages/MExportDirFinish.h +++ b/src/messages/MExportDirFinish.h @@ -32,8 +32,8 @@ private: ~MExportDirFinish() {} public: - const char *get_type_name() { return "ExFin"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExFin"; } + void print(ostream& o) const { o << "export_finish(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirNotify.h b/src/messages/MExportDirNotify.h index 4b141ba1144..a209901d48b 100644 --- a/src/messages/MExportDirNotify.h +++ b/src/messages/MExportDirNotify.h @@ -40,8 +40,8 @@ private: ~MExportDirNotify() {} public: - const char *get_type_name() { return "ExNot"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExNot"; } + void print(ostream& o) const { o << "export_notify(" << base; o << " " << old_auth << " -> " << new_auth; if (ack) diff --git a/src/messages/MExportDirNotifyAck.h b/src/messages/MExportDirNotifyAck.h index a3d91366ddf..35a6956185b 100644 --- a/src/messages/MExportDirNotifyAck.h +++ b/src/messages/MExportDirNotifyAck.h @@ -34,8 +34,8 @@ private: ~MExportDirNotifyAck() {} public: - const char *get_type_name() { return "ExNotA"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExNotA"; } + void print(ostream& o) const { o << "export_notify_ack(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirPrep.h b/src/messages/MExportDirPrep.h index c45236d20d5..12f358ece03 100644 --- a/src/messages/MExportDirPrep.h +++ b/src/messages/MExportDirPrep.h @@ -48,8 +48,8 @@ private: ~MExportDirPrep() {} public: - const char *get_type_name() { return "ExP"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExP"; } + void print(ostream& o) const { o << "export_prep(" << dirfrag << ")"; } diff --git a/src/messages/MExportDirPrepAck.h b/src/messages/MExportDirPrepAck.h index 0593fc5aa73..b5d180d5765 100644 --- a/src/messages/MExportDirPrepAck.h +++ b/src/messages/MExportDirPrepAck.h @@ -32,8 +32,8 @@ private: ~MExportDirPrepAck() {} public: - const char *get_type_name() { return "ExPAck"; } - void print(ostream& o) { + const char *get_type_name() const { return "ExPAck"; } + void print(ostream& o) const { o << "export_prep_ack(" << dirfrag << ")"; } diff --git a/src/messages/MForward.h b/src/messages/MForward.h index 77f71b5086d..34a800408f2 100644 --- a/src/messages/MForward.h +++ b/src/messages/MForward.h @@ -61,8 +61,8 @@ public: msg = (PaxosServiceMessage *)decode_message(NULL, p); } - const char *get_type_name() { return "forward"; } - void print(ostream& o) { + const char *get_type_name() const { return "forward"; } + void print(ostream& o) const { if (msg) o << "forward(" << *msg << ") to leader"; else o << "forward(??? ) to leader"; diff --git a/src/messages/MGenericMessage.h b/src/messages/MGenericMessage.h index 13ce98eb6e4..e042bef00c8 100644 --- a/src/messages/MGenericMessage.h +++ b/src/messages/MGenericMessage.h @@ -30,7 +30,7 @@ class MGenericMessage : public Message { //void set_pcid(long pcid) { this->pcid = pcid; } //long get_pcid() { return pcid; } - const char *get_type_name() { return tname; } + const char *get_type_name() const { return tname; } void decode_payload() { } void encode_payload(uint64_t features) { } diff --git a/src/messages/MGetPoolStats.h b/src/messages/MGetPoolStats.h index c773487a58e..acf9637e4c5 100644 --- a/src/messages/MGetPoolStats.h +++ b/src/messages/MGetPoolStats.h @@ -36,8 +36,8 @@ private: ~MGetPoolStats() {} public: - const char *get_type_name() { return "getpoolstats"; } - void print(ostream& out) { + const char *get_type_name() const { return "getpoolstats"; } + void print(ostream& out) const { out << "getpoolstats(" << get_tid() << " " << pools << " v" << version << ")"; } diff --git a/src/messages/MGetPoolStatsReply.h b/src/messages/MGetPoolStatsReply.h index 2cda83d16d7..26f9e13ab70 100644 --- a/src/messages/MGetPoolStatsReply.h +++ b/src/messages/MGetPoolStatsReply.h @@ -34,8 +34,8 @@ private: ~MGetPoolStatsReply() {} public: - const char *get_type_name() { return "getpoolstats"; } - void print(ostream& out) { + const char *get_type_name() const { return "getpoolstats"; } + void print(ostream& out) const { out << "getpoolstatsreply(" << get_tid() << " v" << version << ")"; } diff --git a/src/messages/MHeartbeat.h b/src/messages/MHeartbeat.h index 848509fd1c2..bddffc0b001 100644 --- a/src/messages/MHeartbeat.h +++ b/src/messages/MHeartbeat.h @@ -46,7 +46,7 @@ private: ~MHeartbeat() {} public: - const char *get_type_name() { return "HB"; } + const char *get_type_name() const { return "HB"; } void encode_payload(uint64_t features) { ::encode(load, payload); diff --git a/src/messages/MInodeFileCaps.h b/src/messages/MInodeFileCaps.h index 5399598f6ad..b5fc0ddd346 100644 --- a/src/messages/MInodeFileCaps.h +++ b/src/messages/MInodeFileCaps.h @@ -34,8 +34,8 @@ private: ~MInodeFileCaps() {} public: - const char *get_type_name() { return "inode_file_caps";} - void print(ostream& out) { + const char *get_type_name() const { return "inode_file_caps";} + void print(ostream& out) const { out << "inode_file_caps(" << ino << " " << ccap_string(caps) << ")"; } diff --git a/src/messages/MLock.h b/src/messages/MLock.h index 3bda13f8ac5..0d66a001e24 100644 --- a/src/messages/MLock.h +++ b/src/messages/MLock.h @@ -59,8 +59,8 @@ private: ~MLock() {} public: - const char *get_type_name() { return "ILock"; } - void print(ostream& out) { + const char *get_type_name() const { return "ILock"; } + void print(ostream& out) const { out << "lock(a=" << get_lock_action_name(action) << " " << get_lock_type_name(lock_type) << " " << object_info diff --git a/src/messages/MLog.h b/src/messages/MLog.h index 3c4dfc94f85..61ca18b6944 100644 --- a/src/messages/MLog.h +++ b/src/messages/MLog.h @@ -34,8 +34,8 @@ private: ~MLog() {} public: - const char *get_type_name() { return "log"; } - void print(ostream& out) { + const char *get_type_name() const { return "log"; } + void print(ostream& out) const { out << "log("; if (entries.size()) out << entries.size() << " entries"; diff --git a/src/messages/MLogAck.h b/src/messages/MLogAck.h index f1ce5246fd3..8022e7ced57 100644 --- a/src/messages/MLogAck.h +++ b/src/messages/MLogAck.h @@ -28,8 +28,8 @@ private: ~MLogAck() {} public: - const char *get_type_name() { return "log_ack"; } - void print(ostream& out) { + const char *get_type_name() const { return "log_ack"; } + void print(ostream& out) const { out << "log(last " << last << ")"; } diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index c77a27aaf9a..e1c950d250b 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -51,7 +51,7 @@ public: epoch_t get_last_epoch_seen() { return version; } int get_state() { return state; } version_t get_seq() { return seq; } - const char *get_type_name() { return "mdsbeacon"; } + const char *get_type_name() const { return "mdsbeacon"; } int get_standby_for_rank() { return standby_for_rank; } const string& get_standby_for_name() { return standby_for_name; } @@ -62,7 +62,7 @@ public: void set_standby_for_name(string& n) { standby_for_name = n; } void set_standby_for_name(const char* c) { standby_for_name.assign(c); } - void print(ostream& out) { + void print(ostream& out) const { out << "mdsbeacon(" << global_id << "/" << name << " " << ceph_mds_state_name(state) << " seq " << seq << " v" << version << ")"; } diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h index 0052b3e5c63..e5a86ee45cb 100644 --- a/src/messages/MMDSCacheRejoin.h +++ b/src/messages/MMDSCacheRejoin.h @@ -196,8 +196,8 @@ private: ~MMDSCacheRejoin() {} public: - const char *get_type_name() { return "cache_rejoin"; } - void print(ostream& out) { + const char *get_type_name() const { return "cache_rejoin"; } + void print(ostream& out) const { out << "cache_rejoin " << get_opname(op); } diff --git a/src/messages/MMDSFindIno.h b/src/messages/MMDSFindIno.h index 3e291de0591..d8eddcb49b8 100644 --- a/src/messages/MMDSFindIno.h +++ b/src/messages/MMDSFindIno.h @@ -25,8 +25,8 @@ struct MMDSFindIno : public Message { MMDSFindIno() : Message(MSG_MDS_FINDINO) {} MMDSFindIno(tid_t t, inodeno_t i) : Message(MSG_MDS_FINDINO), tid(t), ino(i) {} - const char *get_type_name() { return "findino"; } - void print(ostream &out) { + const char *get_type_name() const { return "findino"; } + void print(ostream &out) const { out << "findino(" << tid << " " << ino << ")"; } diff --git a/src/messages/MMDSFindInoReply.h b/src/messages/MMDSFindInoReply.h index 64b48cae6c1..3d6ec6c6ce6 100644 --- a/src/messages/MMDSFindInoReply.h +++ b/src/messages/MMDSFindInoReply.h @@ -25,8 +25,8 @@ struct MMDSFindInoReply : public Message { MMDSFindInoReply() : Message(MSG_MDS_FINDINOREPLY) {} MMDSFindInoReply(tid_t t) : Message(MSG_MDS_FINDINOREPLY), tid(t) {} - const char *get_type_name() { return "findinoreply"; } - void print(ostream &out) { + const char *get_type_name() const { return "findinoreply"; } + void print(ostream &out) const { out << "findinoreply(" << tid << " " << path << ")"; } diff --git a/src/messages/MMDSFragmentNotify.h b/src/messages/MMDSFragmentNotify.h index 922f0093c80..10eb0c7d402 100644 --- a/src/messages/MMDSFragmentNotify.h +++ b/src/messages/MMDSFragmentNotify.h @@ -39,8 +39,8 @@ private: ~MMDSFragmentNotify() {} public: - const char *get_type_name() { return "fragment_notify"; } - void print(ostream& o) { + const char *get_type_name() const { return "fragment_notify"; } + void print(ostream& o) const { o << "fragment_notify(" << ino << "." << basefrag << " " << (int)bits << ")"; } diff --git a/src/messages/MMDSLoadTargets.h b/src/messages/MMDSLoadTargets.h index 0aeb6b63b5d..4022f32e36b 100644 --- a/src/messages/MMDSLoadTargets.h +++ b/src/messages/MMDSLoadTargets.h @@ -36,8 +36,8 @@ private: ~MMDSLoadTargets() {} public: - const char* get_type_name() { return "mds_load_targets"; } - void print(ostream& o) { + const char* get_type_name() const { return "mds_load_targets"; } + void print(ostream& o) const { o << "mds_load_targets(" << global_id << " " << targets << ")"; } diff --git a/src/messages/MMDSMap.h b/src/messages/MMDSMap.h index ae6ed9a34d0..b5558493746 100644 --- a/src/messages/MMDSMap.h +++ b/src/messages/MMDSMap.h @@ -67,8 +67,8 @@ private: ~MMDSMap() {} public: - const char *get_type_name() { return "mdsmap"; } - void print(ostream& out) { + const char *get_type_name() const { return "mdsmap"; } + void print(ostream& out) const { out << "mdsmap(e " << epoch << ")"; } diff --git a/src/messages/MMDSResolve.h b/src/messages/MMDSResolve.h index 9b929ef68f9..551ca991a47 100644 --- a/src/messages/MMDSResolve.h +++ b/src/messages/MMDSResolve.h @@ -30,9 +30,9 @@ private: ~MMDSResolve() {} public: - const char *get_type_name() { return "mds_resolve"; } + const char *get_type_name() const { return "mds_resolve"; } - void print(ostream& out) { + void print(ostream& out) const { out << "mds_resolve(" << subtrees.size() << "+" << ambiguous_imports.size() << " subtrees +" << slave_requests.size() << " slave requests)"; diff --git a/src/messages/MMDSResolveAck.h b/src/messages/MMDSResolveAck.h index 9fcee3e0b4f..2118abaaf49 100644 --- a/src/messages/MMDSResolveAck.h +++ b/src/messages/MMDSResolveAck.h @@ -30,8 +30,8 @@ private: ~MMDSResolveAck() {} public: - const char *get_type_name() { return "resolve_ack"; } - /*void print(ostream& out) { + const char *get_type_name() const { return "resolve_ack"; } + /*void print(ostream& out) const { out << "resolve_ack.size() << "+" << ambiguous_imap.size() << " imports +" << slave_requests.size() << " slave requests)"; diff --git a/src/messages/MMDSSlaveRequest.h b/src/messages/MMDSSlaveRequest.h index 628374eed70..4f2bb5948bd 100644 --- a/src/messages/MMDSSlaveRequest.h +++ b/src/messages/MMDSSlaveRequest.h @@ -161,8 +161,8 @@ public: ::decode(stray, p); } - const char *get_type_name() { return "slave_request"; } - void print(ostream& out) { + const char *get_type_name() const { return "slave_request"; } + void print(ostream& out) const { out << "slave_request(" << reqid << "." << attempt << " " << get_opname(op) diff --git a/src/messages/MMDSTableRequest.h b/src/messages/MMDSTableRequest.h index 3ce95173fa9..fcbfcb8638e 100644 --- a/src/messages/MMDSTableRequest.h +++ b/src/messages/MMDSTableRequest.h @@ -36,8 +36,8 @@ private: ~MMDSTableRequest() {} public: - virtual const char *get_type_name() { return "mds_table_request"; } - void print(ostream& o) { + virtual const char *get_type_name() const { return "mds_table_request"; } + void print(ostream& o) const { o << "mds_table_request(" << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (reqid) o << " " << reqid; diff --git a/src/messages/MMonCommand.h b/src/messages/MMonCommand.h index 26629d72067..c011596ad52 100644 --- a/src/messages/MMonCommand.h +++ b/src/messages/MMonCommand.h @@ -34,8 +34,8 @@ private: ~MMonCommand() {} public: - const char *get_type_name() { return "mon_command"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_command"; } + void print(ostream& o) const { o << "mon_command("; for (unsigned i=0; i<cmd.size(); i++) { if (i) o << ' '; diff --git a/src/messages/MMonCommandAck.h b/src/messages/MMonCommandAck.h index 3f7bcbcf713..bd3d62da54c 100644 --- a/src/messages/MMonCommandAck.h +++ b/src/messages/MMonCommandAck.h @@ -31,8 +31,8 @@ private: ~MMonCommandAck() {} public: - const char *get_type_name() { return "mon_command"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_command"; } + void print(ostream& o) const { o << "mon_command_ack(" << cmd << "=" << r << " " << rs << " v" << version << ")"; } diff --git a/src/messages/MMonElection.h b/src/messages/MMonElection.h index 2d1472af59f..26defa279d6 100644 --- a/src/messages/MMonElection.h +++ b/src/messages/MMonElection.h @@ -51,8 +51,8 @@ private: ~MMonElection() {} public: - const char *get_type_name() { return "election"; } - void print(ostream& out) { + const char *get_type_name() const { return "election"; } + void print(ostream& out) const { out << "election(" << fsid << " " << get_opname(op) << " " << epoch << ")"; } diff --git a/src/messages/MMonGetMap.h b/src/messages/MMonGetMap.h index 65cec30d5bb..d4bb61e751d 100644 --- a/src/messages/MMonGetMap.h +++ b/src/messages/MMonGetMap.h @@ -26,7 +26,7 @@ private: ~MMonGetMap() {} public: - const char *get_type_name() { return "mon_getmap"; } + const char *get_type_name() const { return "mon_getmap"; } void encode_payload(uint64_t features) { } void decode_payload() { } diff --git a/src/messages/MMonGetVersion.h b/src/messages/MMonGetVersion.h index 67a0285793b..14c64818476 100644 --- a/src/messages/MMonGetVersion.h +++ b/src/messages/MMonGetVersion.h @@ -29,11 +29,11 @@ class MMonGetVersion : public Message { public: MMonGetVersion() : Message(CEPH_MSG_MON_GET_VERSION) {} - const char *get_type_name() { + const char *get_type_name() const { return "mon_get_version"; } - void print(ostream& o) { + void print(ostream& o) const { o << "mon_get_version(what=" << what << " handle=" << handle << ")"; } diff --git a/src/messages/MMonGetVersionReply.h b/src/messages/MMonGetVersionReply.h index d954aea5fba..2451cbeefc2 100644 --- a/src/messages/MMonGetVersionReply.h +++ b/src/messages/MMonGetVersionReply.h @@ -28,11 +28,11 @@ class MMonGetVersionReply : public Message { public: MMonGetVersionReply() : Message(CEPH_MSG_MON_GET_VERSION_REPLY) {} - const char *get_type_name() { + const char *get_type_name() const { return "mon_check_map_ack"; } - void print(ostream& o) { + void print(ostream& o) const { o << "mon_check_map_ack(handle=" << handle << " version=" << version << ")"; } diff --git a/src/messages/MMonGlobalID.h b/src/messages/MMonGlobalID.h index d9c0aa27baf..7ec1acc9ad7 100644 --- a/src/messages/MMonGlobalID.h +++ b/src/messages/MMonGlobalID.h @@ -24,8 +24,8 @@ private: ~MMonGlobalID() {} public: - const char *get_type_name() { return "global_id"; } - void print(ostream& out) { + const char *get_type_name() const { return "global_id"; } + void print(ostream& out) const { out << "global_id (" << old_max_id << ")"; } diff --git a/src/messages/MMonJoin.h b/src/messages/MMonJoin.h index 30328297c84..c77bf35553c 100644 --- a/src/messages/MMonJoin.h +++ b/src/messages/MMonJoin.h @@ -36,8 +36,8 @@ private: ~MMonJoin() {} public: - const char *get_type_name() { return "mon_join"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_join"; } + void print(ostream& o) const { o << "mon_join(" << name << " " << addr << ")"; } diff --git a/src/messages/MMonMap.h b/src/messages/MMonMap.h index 5e2cc229a74..a314594752f 100644 --- a/src/messages/MMonMap.h +++ b/src/messages/MMonMap.h @@ -29,7 +29,7 @@ private: ~MMonMap() {} public: - const char *get_type_name() { return "mon_map"; } + const char *get_type_name() const { return "mon_map"; } void encode_payload(uint64_t features) { ::encode(monmapbl, payload); diff --git a/src/messages/MMonObserve.h b/src/messages/MMonObserve.h index 45049b7c46c..1228129c16f 100644 --- a/src/messages/MMonObserve.h +++ b/src/messages/MMonObserve.h @@ -34,8 +34,8 @@ private: ~MMonObserve() {} public: - const char *get_type_name() { return "mon_observe"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_observe"; } + void print(ostream& o) const { o << "observe(" << machine_id << " v" << ver << ")"; } diff --git a/src/messages/MMonObserveNotify.h b/src/messages/MMonObserveNotify.h index bc1998e5c6f..794cf141d7b 100644 --- a/src/messages/MMonObserveNotify.h +++ b/src/messages/MMonObserveNotify.h @@ -32,8 +32,8 @@ private: ~MMonObserveNotify() {} public: - const char *get_type_name() { return "mon_observe_notify"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_observe_notify"; } + void print(ostream& o) const { o << "mon_observe_notify(v" << ver << " " << bl.length() << " bytes"; if (is_latest) o << " latest"; diff --git a/src/messages/MMonPaxos.h b/src/messages/MMonPaxos.h index 33653c3c948..66f7a645bd6 100644 --- a/src/messages/MMonPaxos.h +++ b/src/messages/MMonPaxos.h @@ -73,9 +73,9 @@ private: ~MMonPaxos() {} public: - const char *get_type_name() { return "paxos"; } + const char *get_type_name() const { return "paxos"; } - void print(ostream& out) { + void print(ostream& out) const { out << "paxos(" << get_paxos_name(machine_id) << " " << get_opname(op) << " lc " << last_committed diff --git a/src/messages/MMonProbe.h b/src/messages/MMonProbe.h index 30ab98987fe..62c1a1655e7 100644 --- a/src/messages/MMonProbe.h +++ b/src/messages/MMonProbe.h @@ -60,8 +60,8 @@ private: ~MMonProbe() {} public: - const char *get_type_name() { return "mon_probe"; } - void print(ostream& out) { + const char *get_type_name() const { return "mon_probe"; } + void print(ostream& out) const { out << "mon_probe(" << get_opname(op) << " " << fsid << " name " << name; if (quorum.size()) out << " quorum " << quorum; diff --git a/src/messages/MMonSubscribe.h b/src/messages/MMonSubscribe.h index 647f4041c1d..c2c1636be0e 100644 --- a/src/messages/MMonSubscribe.h +++ b/src/messages/MMonSubscribe.h @@ -42,8 +42,8 @@ public: what[w].flags = flags; } - const char *get_type_name() { return "mon_subscribe"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_subscribe"; } + void print(ostream& o) const { o << "mon_subscribe(" << what << ")"; } diff --git a/src/messages/MMonSubscribeAck.h b/src/messages/MMonSubscribeAck.h index 6fe71772d0a..a2a1cded768 100644 --- a/src/messages/MMonSubscribeAck.h +++ b/src/messages/MMonSubscribeAck.h @@ -31,8 +31,8 @@ private: ~MMonSubscribeAck() {} public: - const char *get_type_name() { return "mon_subscribe_ack"; } - void print(ostream& o) { + const char *get_type_name() const { return "mon_subscribe_ack"; } + void print(ostream& o) const { o << "mon_subscribe_ack(" << interval << "s)"; } diff --git a/src/messages/MOSDAlive.h b/src/messages/MOSDAlive.h index 937b2274faa..12bbed351ac 100644 --- a/src/messages/MOSDAlive.h +++ b/src/messages/MOSDAlive.h @@ -39,8 +39,8 @@ public: ::decode(want, p); } - const char *get_type_name() { return "osd_alive"; } - void print(ostream &out) { + const char *get_type_name() const { return "osd_alive"; } + void print(ostream &out) const { out << "osd_alive(want up_thru " << want << " have " << version << ")"; } diff --git a/src/messages/MOSDBoot.h b/src/messages/MOSDBoot.h index 30643c478c1..2737e0da221 100644 --- a/src/messages/MOSDBoot.h +++ b/src/messages/MOSDBoot.h @@ -36,8 +36,8 @@ private: ~MOSDBoot() { } public: - const char *get_type_name() { return "osd_boot"; } - void print(ostream& out) { + const char *get_type_name() const { return "osd_boot"; } + void print(ostream& out) const { out << "osd_boot(osd." << sb.whoami << " v" << version << ")"; } diff --git a/src/messages/MOSDFailure.h b/src/messages/MOSDFailure.h index 7a86b809bfc..90c20a3167e 100644 --- a/src/messages/MOSDFailure.h +++ b/src/messages/MOSDFailure.h @@ -57,8 +57,8 @@ public: ::encode(is_failed, payload); } - const char *get_type_name() { return "osd_failure"; } - void print(ostream& out) { + const char *get_type_name() const { return "osd_failure"; } + void print(ostream& out) const { out << "osd_failure(" << target_osd << " e" << epoch << " v" << version << ")"; } }; diff --git a/src/messages/MOSDMap.h b/src/messages/MOSDMap.h index 5ac17b6451e..cea74f12fc3 100644 --- a/src/messages/MOSDMap.h +++ b/src/messages/MOSDMap.h @@ -27,18 +27,18 @@ class MOSDMap : public Message { map<epoch_t, bufferlist> incremental_maps; epoch_t oldest_map, newest_map; - epoch_t get_first() { + epoch_t get_first() const { epoch_t e = 0; - map<epoch_t, bufferlist>::iterator i = maps.begin(); + map<epoch_t, bufferlist>::const_iterator i = maps.begin(); if (i != maps.end()) e = i->first; i = incremental_maps.begin(); if (i != incremental_maps.end() && (e == 0 || i->first < e)) e = i->first; return e; } - epoch_t get_last() { + epoch_t get_last() const { epoch_t e = 0; - map<epoch_t, bufferlist>::reverse_iterator i = maps.rbegin(); + map<epoch_t, bufferlist>::const_reverse_iterator i = maps.rbegin(); if (i != maps.rend()) e = i->first; i = incremental_maps.rbegin(); if (i != incremental_maps.rend() && @@ -123,8 +123,8 @@ public: } } - const char *get_type_name() { return "omap"; } - void print(ostream& out) { + const char *get_type_name() const { return "omap"; } + void print(ostream& out) const { out << "osd_map(" << get_first() << ".." << get_last(); if (oldest_map || newest_map) out << " src has " << oldest_map << ".." << newest_map; diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index b08ef5fc5a6..1bca186f1ac 100644 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -60,13 +60,18 @@ public: snapid_t get_snapid() { return snapid; } void set_snapid(snapid_t s) { snapid = s; } // writ - snapid_t get_snap_seq() { return snap_seq; } - vector<snapid_t> &get_snaps() { return snaps; } + snapid_t get_snap_seq() const { return snap_seq; } + const vector<snapid_t> &get_snaps() const { return snaps; } + void set_snaps(const vector<snapid_t>& i) { + snaps = i; + } void set_snap_seq(snapid_t s) { snap_seq = s; } - osd_reqid_t get_reqid() { return osd_reqid_t(get_orig_source(), - client_inc, - header.tid); } + osd_reqid_t get_reqid() const { + return osd_reqid_t(get_orig_source(), + client_inc, + header.tid); + } int get_client_inc() { return client_inc; } tid_t get_client_tid() { return header.tid; } @@ -358,8 +363,8 @@ struct ceph_osd_request_head { } - const char *get_type_name() { return "osd_op"; } - void print(ostream& out) { + const char *get_type_name() const { return "osd_op"; } + void print(ostream& out) const { out << "osd_op(" << get_reqid(); out << " " << oid; diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h index 17b0270a11f..c60f834b69b 100644 --- a/src/messages/MOSDOpReply.h +++ b/src/messages/MOSDOpReply.h @@ -40,18 +40,18 @@ class MOSDOpReply : public Message { int32_t retry_attempt; public: - object_t get_oid() { return oid; } - pg_t get_pg() { return pgid; } - int get_flags() { return flags; } + object_t get_oid() const { return oid; } + pg_t get_pg() const { return pgid; } + int get_flags() const { return flags; } - bool is_ondisk() { return get_flags() & CEPH_OSD_FLAG_ONDISK; } - bool is_onnvram() { return get_flags() & CEPH_OSD_FLAG_ONNVRAM; } + bool is_ondisk() const { return get_flags() & CEPH_OSD_FLAG_ONDISK; } + bool is_onnvram() const { return get_flags() & CEPH_OSD_FLAG_ONNVRAM; } - int get_result() { return result; } + int get_result() const { return result; } eversion_t get_version() { return reassert_version; } - bool may_read() { return flags & CEPH_OSD_FLAG_READ; } - bool may_write() { return flags & CEPH_OSD_FLAG_WRITE; } + bool may_read() const { return flags & CEPH_OSD_FLAG_READ; } + bool may_write() const { return flags & CEPH_OSD_FLAG_WRITE; } void set_result(int r) { result = r; } void set_version(eversion_t v) { reassert_version = v; } @@ -190,9 +190,9 @@ public: } } - const char *get_type_name() { return "osd_op_reply"; } + const char *get_type_name() const { return "osd_op_reply"; } - void print(ostream& out) { + void print(ostream& out) const { out << "osd_op_reply(" << get_tid() << " " << oid << " " << ops; if (may_write()) { diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index 44afdf149cd..7e6c45e1e9a 100644 --- a/src/messages/MOSDPGBackfill.h +++ b/src/messages/MOSDPGBackfill.h @@ -25,7 +25,7 @@ public: OP_BACKFILL_FINISH = 3, OP_BACKFILL_FINISH_ACK = 4, }; - const char *get_op_name(int o) { + const char *get_op_name(int o) const { switch (o) { case OP_BACKFILL_PROGRESS: return "progress"; case OP_BACKFILL_FINISH: return "finish"; @@ -70,8 +70,8 @@ private: ~MOSDPGBackfill() {} public: - const char *get_type_name() { return "pg_backfill"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_backfill"; } + void print(ostream& out) const { out << "pg_backfill(" << get_op_name(op) << " " << pgid << " e " << map_epoch << "/" << query_epoch diff --git a/src/messages/MOSDPGCreate.h b/src/messages/MOSDPGCreate.h index 3dc6494ac5a..0efcb0145af 100644 --- a/src/messages/MOSDPGCreate.h +++ b/src/messages/MOSDPGCreate.h @@ -52,7 +52,7 @@ private: ~MOSDPGCreate() {} public: - const char *get_type_name() { return "pg_create"; } + const char *get_type_name() const { return "pg_create"; } void encode_payload(uint64_t features) { ::encode(epoch, payload); @@ -64,9 +64,9 @@ public: ::decode(mkpg, p); } - void print(ostream& out) { + void print(ostream& out) const { out << "osd pg create("; - for (map<pg_t,create_rec>::iterator i = mkpg.begin(); + for (map<pg_t,create_rec>::const_iterator i = mkpg.begin(); i != mkpg.end(); ++i) { out << "pg" << i->first << "," << i->second.created << "; "; diff --git a/src/messages/MOSDPGInfo.h b/src/messages/MOSDPGInfo.h index cd58e02aa1d..19ee76673d1 100644 --- a/src/messages/MOSDPGInfo.h +++ b/src/messages/MOSDPGInfo.h @@ -34,8 +34,8 @@ private: ~MOSDPGInfo() {} public: - const char *get_type_name() { return "pg_info"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_info"; } + void print(ostream& out) const { out << "pg_info(" << pg_info.size() << " pgs e" << epoch << ")"; } diff --git a/src/messages/MOSDPGLog.h b/src/messages/MOSDPGLog.h index 9b3cd853965..774e1357ae9 100644 --- a/src/messages/MOSDPGLog.h +++ b/src/messages/MOSDPGLog.h @@ -46,8 +46,8 @@ private: ~MOSDPGLog() {} public: - const char *get_type_name() { return "PGlog"; } - void print(ostream& out) { + const char *get_type_name() const { return "PGlog"; } + void print(ostream& out) const { out << "pg_log(" << info.pgid << " epoch " << epoch << " query_epoch " << query_epoch << ")"; } diff --git a/src/messages/MOSDPGMissing.h b/src/messages/MOSDPGMissing.h index 8173b2d8f41..17b6bdb8f82 100644 --- a/src/messages/MOSDPGMissing.h +++ b/src/messages/MOSDPGMissing.h @@ -36,8 +36,8 @@ private: ~MOSDPGMissing() {} public: - const char *get_type_name() { return "pg_missing"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_missing"; } + void print(ostream& out) const { out << "pg_missing(" << info.pgid << " e" << epoch << ")"; } diff --git a/src/messages/MOSDPGNotify.h b/src/messages/MOSDPGNotify.h index 9cc12cb26e2..3ea09b97adb 100644 --- a/src/messages/MOSDPGNotify.h +++ b/src/messages/MOSDPGNotify.h @@ -47,7 +47,7 @@ private: ~MOSDPGNotify() {} public: - const char *get_type_name() { return "PGnot"; } + const char *get_type_name() const { return "PGnot"; } void encode_payload(uint64_t features) { header.version = 2; @@ -63,9 +63,9 @@ public: ::decode(query_epoch, p); } } - void print(ostream& out) { + void print(ostream& out) const { out << "pg_notify("; - for (vector<PG::Info>::iterator i = pg_list.begin(); + for (vector<PG::Info>::const_iterator i = pg_list.begin(); i != pg_list.end(); ++i) { if (i != pg_list.begin()) diff --git a/src/messages/MOSDPGQuery.h b/src/messages/MOSDPGQuery.h index 9a46932f5ab..8e8a84b1cf1 100644 --- a/src/messages/MOSDPGQuery.h +++ b/src/messages/MOSDPGQuery.h @@ -39,10 +39,10 @@ private: ~MOSDPGQuery() {} public: - const char *get_type_name() { return "pg_query"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_query"; } + void print(ostream& out) const { out << "pg_query("; - for (map<pg_t,PG::Query>::iterator p = pg_list.begin(); p != pg_list.end(); ++p) { + for (map<pg_t,PG::Query>::const_iterator p = pg_list.begin(); p != pg_list.end(); ++p) { if (p != pg_list.begin()) out << ","; out << p->first; diff --git a/src/messages/MOSDPGRemove.h b/src/messages/MOSDPGRemove.h index 333201ceb86..bc8a343db0d 100644 --- a/src/messages/MOSDPGRemove.h +++ b/src/messages/MOSDPGRemove.h @@ -37,7 +37,7 @@ private: ~MOSDPGRemove() {} public: - const char *get_type_name() { return "PGrm"; } + const char *get_type_name() const { return "PGrm"; } void encode_payload(uint64_t features) { ::encode(epoch, payload); @@ -48,9 +48,9 @@ public: ::decode(epoch, p); ::decode(pg_list, p); } - void print(ostream& out) { + void print(ostream& out) const { out << "osd pg remove(" << "epoch " << epoch << "; "; - for (vector<pg_t>::iterator i = pg_list.begin(); + for (vector<pg_t>::const_iterator i = pg_list.begin(); i != pg_list.end(); ++i) { out << "pg" << *i << "; "; diff --git a/src/messages/MOSDPGScan.h b/src/messages/MOSDPGScan.h index 4ed1d91c6bf..cc69b92e170 100644 --- a/src/messages/MOSDPGScan.h +++ b/src/messages/MOSDPGScan.h @@ -24,7 +24,7 @@ public: OP_SCAN_GET_DIGEST = 1, // just objects and versions OP_SCAN_DIGEST = 2, // result }; - const char *get_op_name(int o) { + const char *get_op_name(int o) const { switch (o) { case OP_SCAN_GET_DIGEST: return "get_digest"; case OP_SCAN_DIGEST: return "digest"; @@ -68,8 +68,8 @@ private: ~MOSDPGScan() {} public: - const char *get_type_name() { return "pg_scan"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_scan"; } + void print(ostream& out) const { out << "pg_scan(" << get_op_name(op) << " " << pgid << " " << begin << "-" << end diff --git a/src/messages/MOSDPGTemp.h b/src/messages/MOSDPGTemp.h index 5eb5a557d27..fe5908ce067 100644 --- a/src/messages/MOSDPGTemp.h +++ b/src/messages/MOSDPGTemp.h @@ -42,8 +42,8 @@ public: ::decode(pg_temp, p); } - const char *get_type_name() { return "osd_pgtemp"; } - void print(ostream &out) { + const char *get_type_name() const { return "osd_pgtemp"; } + void print(ostream &out) const { out << "osd_pgtemp(e" << map_epoch << " " << pg_temp << " v" << version << ")"; } diff --git a/src/messages/MOSDPGTrim.h b/src/messages/MOSDPGTrim.h index 702cb5e5310..ad1efa3ac59 100644 --- a/src/messages/MOSDPGTrim.h +++ b/src/messages/MOSDPGTrim.h @@ -33,8 +33,8 @@ private: ~MOSDPGTrim() {} public: - const char *get_type_name() { return "pg_trim"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_trim"; } + void print(ostream& out) const { out << "pg_trim(" << pgid << " to " << trim_to << " e" << epoch << ")"; } diff --git a/src/messages/MOSDPing.h b/src/messages/MOSDPing.h index 7bdc8ef65fb..9956ef25ad9 100644 --- a/src/messages/MOSDPing.h +++ b/src/messages/MOSDPing.h @@ -29,7 +29,7 @@ class MOSDPing : public Message { YOU_DIED = 2, STOP_HEARTBEAT = 3, }; - const char *get_op_name(int op) { + const char *get_op_name(int op) const { switch (op) { case HEARTBEAT: return "heartbeat"; case START_HEARTBEAT: return "start_heartbeat"; @@ -69,8 +69,8 @@ public: ::encode(peer_stat, payload); } - const char *get_type_name() { return "osd_ping"; } - void print(ostream& out) { + const char *get_type_name() const { return "osd_ping"; } + void print(ostream& out) const { out << "osd_ping(" << get_op_name(op) << " e" << map_epoch << " as_of " << peer_as_of_epoch << ")"; } }; diff --git a/src/messages/MOSDRepScrub.h b/src/messages/MOSDRepScrub.h index 9837f287e18..522bfb22b21 100644 --- a/src/messages/MOSDRepScrub.h +++ b/src/messages/MOSDRepScrub.h @@ -41,8 +41,8 @@ private: ~MOSDRepScrub() {} public: - const char *get_type_name() { return "replica scrub"; } - void print(ostream& out) { + const char *get_type_name() const { return "replica scrub"; } + void print(ostream& out) const { out << "replica scrub(pg: "; out << pgid << ",from:" << scrub_from << ",to:" << scrub_to << "epoch:" << map_epoch; diff --git a/src/messages/MOSDScrub.h b/src/messages/MOSDScrub.h index 2f814e7d614..67633e82d14 100644 --- a/src/messages/MOSDScrub.h +++ b/src/messages/MOSDScrub.h @@ -38,8 +38,8 @@ private: ~MOSDScrub() {} public: - const char *get_type_name() { return "scrub"; } - void print(ostream& out) { + const char *get_type_name() const { return "scrub"; } + void print(ostream& out) const { out << "scrub("; if (scrub_pgs.empty()) out << "osd"; diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h index f7596e953e5..81aba7f3366 100644 --- a/src/messages/MOSDSubOp.h +++ b/src/messages/MOSDSubOp.h @@ -170,8 +170,8 @@ private: ~MOSDSubOp() {} public: - const char *get_type_name() { return "osd_sub_op"; } - void print(ostream& out) { + const char *get_type_name() const { return "osd_sub_op"; } + void print(ostream& out) const { out << "osd_sub_op(" << reqid << " " << pgid << " " << poid diff --git a/src/messages/MOSDSubOpReply.h b/src/messages/MOSDSubOpReply.h index 920fe78ac64..aa186372bbb 100644 --- a/src/messages/MOSDSubOpReply.h +++ b/src/messages/MOSDSubOpReply.h @@ -124,9 +124,9 @@ private: ~MOSDSubOpReply() {} public: - const char *get_type_name() { return "osd_op_reply"; } + const char *get_type_name() const { return "osd_op_reply"; } - void print(ostream& out) { + void print(ostream& out) const { out << "osd_sub_op_reply(" << reqid << " " << pgid << " " << poid << " " << ops; diff --git a/src/messages/MPGStats.h b/src/messages/MPGStats.h index e5af677070b..633800aad15 100644 --- a/src/messages/MPGStats.h +++ b/src/messages/MPGStats.h @@ -34,8 +34,8 @@ private: ~MPGStats() {}; public: - const char *get_type_name() { return "pg_stats"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_stats"; } + void print(ostream& out) const { out << "pg_stats(" << pg_stat.size() << " pgs tid " << get_tid() << " v " << version << ")"; } diff --git a/src/messages/MPGStatsAck.h b/src/messages/MPGStatsAck.h index 045ad4bfe16..f268b68f9b8 100644 --- a/src/messages/MPGStatsAck.h +++ b/src/messages/MPGStatsAck.h @@ -27,8 +27,8 @@ private: ~MPGStatsAck() {} public: - const char *get_type_name() { return "pg_stats_ack"; } - void print(ostream& out) { + const char *get_type_name() const { return "pg_stats_ack"; } + void print(ostream& out) const { out << "pg_stats_ack(" << pg_stat.size() << " pgs tid " << get_tid() << ")"; } diff --git a/src/messages/MPing.h b/src/messages/MPing.h index 005f11c786b..3cd051497ea 100644 --- a/src/messages/MPing.h +++ b/src/messages/MPing.h @@ -29,7 +29,7 @@ private: public: void decode_payload() { } void encode_payload(uint64_t features) { } - const char *get_type_name() { return "ping"; } + const char *get_type_name() const { return "ping"; } }; #endif diff --git a/src/messages/MPoolOp.h b/src/messages/MPoolOp.h index 5ed45944bab..c4ec9d86344 100644 --- a/src/messages/MPoolOp.h +++ b/src/messages/MPoolOp.h @@ -45,8 +45,8 @@ private: ~MPoolOp() {} public: - const char *get_type_name() { return "poolop"; } - void print(ostream& out) { + const char *get_type_name() const { return "poolop"; } + void print(ostream& out) const { out << "pool_op(" << ceph_pool_op_name(op) << " pool " << pool << " auid " << auid << " tid " << get_tid() diff --git a/src/messages/MPoolOpReply.h b/src/messages/MPoolOpReply.h index b3002289c62..702fdf757d9 100644 --- a/src/messages/MPoolOpReply.h +++ b/src/messages/MPoolOpReply.h @@ -44,9 +44,9 @@ public: response_data.claim(*blp); } - const char *get_type_name() { return "poolopreply"; } + const char *get_type_name() const { return "poolopreply"; } - void print(ostream& out) { + void print(ostream& out) const { out << "pool_op_reply(tid " << get_tid() << " " << cpp_strerror(-replyCode) << " v" << version << ")"; diff --git a/src/messages/MRemoveSnaps.h b/src/messages/MRemoveSnaps.h index 21fffc05cf5..6568ffaeb07 100644 --- a/src/messages/MRemoveSnaps.h +++ b/src/messages/MRemoveSnaps.h @@ -30,8 +30,8 @@ private: ~MRemoveSnaps() {} public: - const char *get_type_name() { return "remove_snaps"; } - void print(ostream& out) { + const char *get_type_name() const { return "remove_snaps"; } + void print(ostream& out) const { out << "remove_snaps(" << snaps << " v" << version << ")"; } diff --git a/src/messages/MRoute.h b/src/messages/MRoute.h index 050e265ef45..7efa13683ad 100644 --- a/src/messages/MRoute.h +++ b/src/messages/MRoute.h @@ -51,8 +51,8 @@ public: encode_message(msg, features, payload); } - const char *get_type_name() { return "route"; } - void print(ostream& o) { + const char *get_type_name() const { return "route"; } + void print(ostream& o) const { if (msg) o << "route(" << *msg; else diff --git a/src/messages/MStatfs.h b/src/messages/MStatfs.h index dac147f442e..61370a94344 100644 --- a/src/messages/MStatfs.h +++ b/src/messages/MStatfs.h @@ -33,8 +33,8 @@ private: ~MStatfs() {} public: - const char *get_type_name() { return "statfs"; } - void print(ostream& out) { + const char *get_type_name() const { return "statfs"; } + void print(ostream& out) const { out << "statfs(" << get_tid() << " v" << version << ")"; } diff --git a/src/messages/MStatfsReply.h b/src/messages/MStatfsReply.h index bdf52664d23..8ceec9c7b10 100644 --- a/src/messages/MStatfsReply.h +++ b/src/messages/MStatfsReply.h @@ -27,8 +27,8 @@ public: h.version = epoch; } - const char *get_type_name() { return "statfs_reply"; } - void print(ostream& out) { + const char *get_type_name() const { return "statfs_reply"; } + void print(ostream& out) const { out << "statfs_reply(" << header.tid << ")"; } diff --git a/src/messages/MWatchNotify.h b/src/messages/MWatchNotify.h index d39fc99b936..66632f72002 100644 --- a/src/messages/MWatchNotify.h +++ b/src/messages/MWatchNotify.h @@ -55,8 +55,8 @@ public: ::encode(bl, payload); } - const char *get_type_name() { return "watch-notify"; } - void print(ostream& out) { + const char *get_type_name() const { return "watch-notify"; } + void print(ostream& out) const { out << "watch-notify(c=" << cookie << " v=" << ver << " i=" << notify_id << " opcode=" << (int)opcode << ")"; } }; diff --git a/src/messages/PaxosServiceMessage.h b/src/messages/PaxosServiceMessage.h index 88c908d253f..341a0b3f308 100644 --- a/src/messages/PaxosServiceMessage.h +++ b/src/messages/PaxosServiceMessage.h @@ -56,7 +56,7 @@ class PaxosServiceMessage : public Message { return session; } - const char *get_type_name() { return "PaxosServiceMessage"; } + const char *get_type_name() const { return "PaxosServiceMessage"; } }; #endif |