]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: mark monc_lock a mutable
authorKefu Chai <kchai@redhat.com>
Tue, 14 Feb 2017 02:58:17 +0000 (10:58 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 14 Feb 2017 04:58:22 +0000 (12:58 +0800)
so we can label the getters of MonClient with the `const` specifier.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/MonClient.h

index 2c029afab39930638ef180f034d74a3b1ecf68c5..7e1d9da9b82dbe6d0bbbfe3bd62fdadf5cb9b20c 100644 (file)
@@ -119,7 +119,7 @@ private:
 
   entity_addr_t my_addr;
 
-  Mutex monc_lock;
+  mutable Mutex monc_lock;
   SafeTimer timer;
   Finisher finisher;
 
@@ -340,23 +340,23 @@ public:
     return my_addr;
   }
 
-  const uuid_d& get_fsid() {
+  const uuid_d& get_fsid() const {
     return monmap.fsid;
   }
 
-  entity_addr_t get_mon_addr(unsigned i) {
+  entity_addr_t get_mon_addr(unsigned i) const {
     Mutex::Locker l(monc_lock);
     if (i < monmap.size())
       return monmap.get_addr(i);
     return entity_addr_t();
   }
-  entity_inst_t get_mon_inst(unsigned i) {
+  entity_inst_t get_mon_inst(unsigned i) const {
     Mutex::Locker l(monc_lock);
     if (i < monmap.size())
       return monmap.get_inst(i);
     return entity_inst_t();
   }
-  int get_num_mon() {
+  int get_num_mon() const {
     Mutex::Locker l(monc_lock);
     return monmap.size();
   }