mirror of
https://github.com/ceph/ceph
synced 2024-12-25 21:03:31 +00:00
add more constness
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
01c99d0af3
commit
e6e493f37d
src
auth/cephx
common
librados
msg
@ -31,7 +31,7 @@ int CephxSessionHandler::sign_message(Message *m)
|
||||
return 0;
|
||||
}
|
||||
bufferlist bl_plaintext, bl_encrypted;
|
||||
ceph_msg_header header = m->get_header();
|
||||
const ceph_msg_header& header = m->get_header();
|
||||
std::string error;
|
||||
|
||||
ceph_msg_footer& en_footer = m->get_footer();
|
||||
@ -77,8 +77,8 @@ int CephxSessionHandler::check_message_signature(Message *m)
|
||||
|
||||
bufferlist bl_plaintext, bl_ciphertext;
|
||||
std::string sig_error;
|
||||
ceph_msg_header& header = m->get_header();
|
||||
ceph_msg_footer& footer = m->get_footer();
|
||||
const ceph_msg_header& header = m->get_header();
|
||||
const ceph_msg_footer& footer = m->get_footer();
|
||||
|
||||
if ((features & CEPH_FEATURE_MSG_AUTH) == 0) {
|
||||
// it's fine, we didn't negotiate this feature.
|
||||
|
@ -41,7 +41,7 @@ HeartbeatMap::~HeartbeatMap()
|
||||
assert(m_workers.empty());
|
||||
}
|
||||
|
||||
heartbeat_handle_d *HeartbeatMap::add_worker(string name)
|
||||
heartbeat_handle_d *HeartbeatMap::add_worker(const string& name)
|
||||
{
|
||||
m_rwlock.get_write();
|
||||
ldout(m_cct, 10) << "add_worker '" << name << "'" << dendl;
|
||||
@ -52,7 +52,7 @@ heartbeat_handle_d *HeartbeatMap::add_worker(string name)
|
||||
return h;
|
||||
}
|
||||
|
||||
void HeartbeatMap::remove_worker(heartbeat_handle_d *h)
|
||||
void HeartbeatMap::remove_worker(const heartbeat_handle_d *h)
|
||||
{
|
||||
m_rwlock.get_write();
|
||||
ldout(m_cct, 10) << "remove_worker '" << h->name << "'" << dendl;
|
||||
@ -61,7 +61,7 @@ void HeartbeatMap::remove_worker(heartbeat_handle_d *h)
|
||||
delete h;
|
||||
}
|
||||
|
||||
bool HeartbeatMap::_check(heartbeat_handle_d *h, const char *who, time_t now)
|
||||
bool HeartbeatMap::_check(const heartbeat_handle_d *h, const char *who, time_t now)
|
||||
{
|
||||
bool healthy = true;
|
||||
time_t was;
|
||||
|
@ -41,7 +41,7 @@ namespace ceph {
|
||||
*/
|
||||
|
||||
struct heartbeat_handle_d {
|
||||
std::string name;
|
||||
const std::string name;
|
||||
atomic_t timeout, suicide_timeout;
|
||||
time_t grace, suicide_grace;
|
||||
std::list<heartbeat_handle_d*>::iterator list_item;
|
||||
@ -54,8 +54,8 @@ struct heartbeat_handle_d {
|
||||
class HeartbeatMap {
|
||||
public:
|
||||
// register/unregister
|
||||
heartbeat_handle_d *add_worker(std::string name);
|
||||
void remove_worker(heartbeat_handle_d *h);
|
||||
heartbeat_handle_d *add_worker(const std::string& name);
|
||||
void remove_worker(const heartbeat_handle_d *h);
|
||||
|
||||
// reset the timeout so that it expects another touch within grace amount of time
|
||||
void reset_timeout(heartbeat_handle_d *h, time_t grace, time_t suicide_grace);
|
||||
@ -77,7 +77,7 @@ class HeartbeatMap {
|
||||
time_t m_inject_unhealthy_until;
|
||||
std::list<heartbeat_handle_d*> m_workers;
|
||||
|
||||
bool _check(heartbeat_handle_d *h, const char *who, time_t now);
|
||||
bool _check(const heartbeat_handle_d *h, const char *who, time_t now);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
cct = c;
|
||||
}
|
||||
|
||||
uint64_t get_nref() {
|
||||
uint64_t get_nref() const {
|
||||
return nref.read();
|
||||
}
|
||||
};
|
||||
|
@ -28,9 +28,9 @@ struct ListObjectImpl {
|
||||
ListObjectImpl(std::string n, std::string o, std::string l):
|
||||
nspace(n), oid(o), locator(l) {}
|
||||
|
||||
const std::string& get_nspace() { return nspace; }
|
||||
const std::string& get_oid() { return oid; }
|
||||
const std::string& get_locator() { return locator; }
|
||||
const std::string& get_nspace() const { return nspace; }
|
||||
const std::string& get_oid() const { return oid; }
|
||||
const std::string& get_locator() const { return locator; }
|
||||
};
|
||||
WRITE_EQ_OPERATORS_3(ListObjectImpl, nspace, oid, locator)
|
||||
WRITE_CMP_OPERATORS_3(ListObjectImpl, nspace, oid, locator)
|
||||
|
@ -313,15 +313,17 @@ public:
|
||||
Throttle *get_message_throttler() { return msg_throttler; }
|
||||
|
||||
void set_dispatch_throttle_size(uint64_t s) { dispatch_throttle_size = s; }
|
||||
uint64_t get_dispatch_throttle_size() { return dispatch_throttle_size; }
|
||||
uint64_t get_dispatch_throttle_size() const { return dispatch_throttle_size; }
|
||||
|
||||
const ceph_msg_header &get_header() const { return header; }
|
||||
ceph_msg_header &get_header() { return header; }
|
||||
void set_header(const ceph_msg_header &e) { header = e; }
|
||||
void set_footer(const ceph_msg_footer &e) { footer = e; }
|
||||
const ceph_msg_footer &get_footer() const { return footer; }
|
||||
ceph_msg_footer &get_footer() { return footer; }
|
||||
void set_src(const entity_name_t& src) { header.src = src; }
|
||||
|
||||
uint32_t get_magic() { return magic; }
|
||||
uint32_t get_magic() const { return magic; }
|
||||
void set_magic(int _magic) { magic = _magic; }
|
||||
|
||||
/*
|
||||
@ -346,7 +348,7 @@ public:
|
||||
clear_buffers(); // let subclass drop buffers as well
|
||||
}
|
||||
|
||||
bool empty_payload() { return payload.length() == 0; }
|
||||
bool empty_payload() const { return payload.length() == 0; }
|
||||
bufferlist& get_payload() { return payload; }
|
||||
void set_payload(bufferlist& bl) {
|
||||
if (byte_throttler)
|
||||
|
@ -2174,7 +2174,7 @@ int AsyncConnection::_send(Message *m)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int AsyncConnection::write_message(ceph_msg_header& header, ceph_msg_footer& footer,
|
||||
int AsyncConnection::write_message(const ceph_msg_header& header, const ceph_msg_footer& footer,
|
||||
bufferlist& blist)
|
||||
{
|
||||
bufferlist bl;
|
||||
|
@ -63,7 +63,7 @@ class AsyncConnection : public Connection {
|
||||
int randomize_out_seq();
|
||||
void handle_ack(uint64_t seq);
|
||||
void _send_keepalive_or_ack(bool ack=false, utime_t *t=NULL);
|
||||
int write_message(ceph_msg_header& header, ceph_msg_footer& footer, bufferlist& blist);
|
||||
int write_message(const ceph_msg_header& header, const ceph_msg_footer& footer, bufferlist& blist);
|
||||
int _reply_accept(char tag, ceph_msg_connect &connect, ceph_msg_connect_reply &reply,
|
||||
bufferlist authorizer_reply) {
|
||||
bufferlist reply_bl;
|
||||
@ -203,7 +203,6 @@ class AsyncConnection : public Connection {
|
||||
return statenames[state];
|
||||
}
|
||||
|
||||
CephContext *cc;
|
||||
AsyncMessenger *async_msgr;
|
||||
int global_seq;
|
||||
__u32 connect_seq, peer_global_seq;
|
||||
|
@ -1798,8 +1798,8 @@ void Pipe::writer()
|
||||
m->encode(features, msgr->crcflags);
|
||||
|
||||
// prepare everything
|
||||
ceph_msg_header& header = m->get_header();
|
||||
ceph_msg_footer& footer = m->get_footer();
|
||||
const ceph_msg_header& header = m->get_header();
|
||||
const ceph_msg_footer& footer = m->get_footer();
|
||||
|
||||
// Now that we have all the crcs calculated, handle the
|
||||
// digital signature for the message, if the pipe has session
|
||||
@ -2237,7 +2237,7 @@ int Pipe::write_keepalive2(char tag, const utime_t& t)
|
||||
}
|
||||
|
||||
|
||||
int Pipe::write_message(ceph_msg_header& header, ceph_msg_footer& footer, bufferlist& blist)
|
||||
int Pipe::write_message(const ceph_msg_header& header, const ceph_msg_footer& footer, bufferlist& blist)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -230,7 +230,7 @@ class DispatchQueue;
|
||||
|
||||
int read_message(Message **pm,
|
||||
AuthSessionHandler *session_security_copy);
|
||||
int write_message(ceph_msg_header& h, ceph_msg_footer& f, bufferlist& body);
|
||||
int write_message(const ceph_msg_header& h, const ceph_msg_footer& f, bufferlist& body);
|
||||
/**
|
||||
* Write the given data (of length len) to the Pipe's socket. This function
|
||||
* will loop until all passed data has been written out.
|
||||
|
Loading…
Reference in New Issue
Block a user