]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
all: add const to operator<< param 9501/head
authorMichal Jarzabek <stiopa@gmail.com>
Sat, 4 Jun 2016 22:24:06 +0000 (23:24 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Sun, 5 Jun 2016 21:12:56 +0000 (22:12 +0100)
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
24 files changed:
src/client/Inode.cc
src/client/Inode.h
src/cls/cephfs/cls_cephfs.cc
src/common/TextTable.cc
src/common/TextTable.h
src/common/ceph_json.cc
src/common/ceph_json.h
src/mds/LogEvent.h
src/mds/MDSMap.h
src/mds/Mutation.h
src/mds/flock.h
src/mon/AuthMonitor.cc
src/mon/LogMonitor.cc
src/mon/MonMap.h
src/msg/Message.h
src/osdc/Journaler.cc
src/osdc/ObjectCacher.h
src/rbd_replay/ios.cc
src/rbd_replay/ios.hpp
src/rgw/rgw_xml.cc
src/rgw/rgw_xml.h
src/test/old/testbucket.cc
src/test/osd/TestOpStat.cc
src/test/osd/TestOpStat.h

index 51c9d6299018c556822016883764465e1ddef7ad..0dca7bdaae6611496b3340aa98fc1ebeb1fbc3c8 100644 (file)
@@ -9,7 +9,7 @@
 #include "ClientSnapRealm.h"
 #include "UserGroups.h"
 
-ostream& operator<<(ostream &out, Inode &in)
+ostream& operator<<(ostream &out, const Inode &in)
 {
   out << in.vino() << "("
       << "faked_ino=" << in.faked_ino
@@ -23,7 +23,7 @@ ostream& operator<<(ostream &out, Inode &in)
       << " caps=" << ccap_string(in.caps_issued());
   if (!in.caps.empty()) {
     out << "(";
-    for (map<mds_rank_t,Cap*>::iterator p = in.caps.begin(); p != in.caps.end(); ++p) {
+    for (auto p = in.caps.begin(); p != in.caps.end(); ++p) {
       if (p != in.caps.begin())
         out << ',';
       out << p->first << '=' << ccap_string(p->second->issued);
@@ -147,7 +147,7 @@ bool Inode::is_any_caps()
   return !caps.empty() || snap_caps;
 }
 
-bool Inode::cap_is_valid(Cap* cap)
+bool Inode::cap_is_valid(Cap* cap) const
 {
   /*cout << "cap_gen     " << cap->session-> cap_gen << std::endl
     << "session gen " << cap->gen << std::endl
@@ -160,11 +160,11 @@ bool Inode::cap_is_valid(Cap* cap)
   return false;
 }
 
-int Inode::caps_issued(int *implemented)
+int Inode::caps_issued(int *implemented) const
 {
   int c = snap_caps;
   int i = 0;
-  for (map<mds_rank_t,Cap*>::iterator it = caps.begin();
+  for (map<mds_rank_t,Cap*>::const_iterator it = caps.begin();
        it != caps.end();
        ++it)
     if (cap_is_valid(it->second)) {
index 67128c5afa5d67975964dd7ca10601441f1161b1..8dac8db5314a254d341d761b101a4a56e39155e8 100644 (file)
@@ -320,7 +320,7 @@ struct Inode {
   }
   ~Inode() { }
 
-  vinodeno_t vino() { return vinodeno_t(ino, snapid); }
+  vinodeno_t vino() const { return vinodeno_t(ino, snapid); }
 
   struct Compare {
     bool operator() (Inode* const & left, Inode* const & right) {
@@ -340,8 +340,8 @@ struct Inode {
   void get_cap_ref(int cap);
   int put_cap_ref(int cap);
   bool is_any_caps();
-  bool cap_is_valid(Cap* cap);
-  int caps_issued(int *implemented = 0);
+  bool cap_is_valid(Cap* cap) const;
+  int caps_issued(int *implemented = 0) const;
   void touch_cap(Cap *cap);
   void try_touch_cap(mds_rank_t mds);
   bool caps_issued_mask(unsigned mask);
@@ -359,6 +359,6 @@ struct Inode {
   void dump(Formatter *f) const;
 };
 
-ostream& operator<<(ostream &out, Inode &in);
+ostream& operator<<(ostream &out, const Inode &in);
 
 #endif
index 8f54e3a69732cd64b4d34135e15cb2f61210825c..6e81a53e98666b6bd62da49a73afd3a43c40e294 100644 (file)
@@ -29,7 +29,7 @@ cls_method_handle_t h_accumulate_inode_metadata;
 
 
 
-std::ostream &operator<<(std::ostream &out, ObjCeiling &in)
+std::ostream &operator<<(std::ostream &out, const ObjCeiling &in)
 {
   out << "id: " << in.id << " size: " << in.size;
   return out;
index 4aef2f94ea7d6ad4dbc3a0f881bb979fd3e28a40..3c09fded605bb9560653b7c2f25f4e7dfa480813 100644 (file)
@@ -62,7 +62,7 @@ pad(string s, int width, TextTable::Align align)
   return string(lpad, ' ') + s + string(rpad, ' ');
 }
 
-std::ostream &operator<<(std::ostream& out, TextTable &t)
+std::ostream &operator<<(std::ostream &out, const TextTable &t)
 {
   for (unsigned int i = 0; i < t.col.size(); i++) {
     TextTable::TextTableColumn col = t.col[i];
index d17b2652243d600b36b987f03520f1bb4bd40d2f..20d3f0acf139a8730d9f690fdc10e03be3ed26ae 100644 (file)
@@ -147,7 +147,7 @@ public:
    * Render table to ostream (i.e. cout << table)
    */
 
-  friend std::ostream &operator<<(std::ostream& out, TextTable &t);
+  friend std::ostream &operator<<(std::ostream &out, const TextTable &t);
 
   /**
    * clear: Reset everything in a TextTable except column defs
index d1d33a91c00797f279e18969c79c3cd477bae24d..52be8421bb9fda2e81458a96964f288e4922054d 100644 (file)
@@ -40,7 +40,7 @@ JSONObj *JSONObjIter::operator*()
 }
 
 // does not work, FIXME
-ostream& operator<<(ostream& out, JSONObj& obj) {
+ostream& operator<<(ostream &out, const JSONObj &obj) {
    out << obj.name << ": " << obj.data_string;
    return out;
 }
index a812d7af1a267d25d49af92386144cab00357f54..67483490f34668b5791b9b14209d125d83debd4c 100644 (file)
@@ -73,7 +73,8 @@ public:
   JSONObjIter find_first(const string& name);
   JSONObj *find_obj(const string& name);
 
-  friend ostream& operator<<(ostream& out, JSONObj& obj); // does not work, FIXME
+  friend ostream& operator<<(ostream &out,
+                            const JSONObj &obj); // does not work, FIXME
 
   bool is_array();
   bool is_object();
index 8c1cd1b07f5acf56c73bbbd7de84db6337bc1e91..ecea57ca3ce57b2a1d70513793a53be49af34185 100644 (file)
@@ -118,7 +118,7 @@ public:
   virtual EMetaBlob *get_metablob() { return NULL; }
 };
 
-inline ostream& operator<<(ostream& out, LogEvent& le) {
+inline ostream& operator<<(ostream& out, const LogEvent &le) {
   le.print(out);
   return out;
 }
index 60aaf001070cb9a156616e9f000febf36e1b0df9..9dc9b5853668ce79d654dc361a41326dca9bff18 100644 (file)
@@ -632,7 +632,7 @@ public:
 WRITE_CLASS_ENCODER_FEATURES(MDSMap::mds_info_t)
 WRITE_CLASS_ENCODER_FEATURES(MDSMap)
 
-inline ostream& operator<<(ostream& out, MDSMap& m) {
+inline ostream& operator<<(ostream &out, const MDSMap &m) {
   m.print_summary(NULL, &out);
   return out;
 }
index f43d6609bacbdb8e6cb01c1dd412e6af895befb6..91e68db899a09697b7668200cec4535ba96a1f01 100644 (file)
@@ -158,14 +158,14 @@ public:
   void apply();
   void cleanup();
 
-  virtual void print(ostream &out) {
+  virtual void print(ostream &out) const {
     out << "mutation(" << this << ")";
   }
 
   virtual void dump(Formatter *f) const {}
 };
 
-inline ostream& operator<<(ostream& out, MutationImpl &mut)
+inline ostream& operator<<(ostream &out, const MutationImpl &mut)
 {
   mut.print(out);
   return out;
index fade1a88e3229432e1556b010fe8e83be34b6eb1..2cf9f0a3927b1350bb583abeceab90cffeaf7cd4 100644 (file)
@@ -277,18 +277,18 @@ public:
 WRITE_CLASS_ENCODER(ceph_lock_state_t)
 
 
-inline ostream& operator<<(ostream& out, ceph_lock_state_t& l) {
+inline ostream& operator<<(ostream &out, const ceph_lock_state_t &l) {
   out << "ceph_lock_state_t. held_locks.size()=" << l.held_locks.size()
       << ", waiting_locks.size()=" << l.waiting_locks.size()
       << ", client_held_lock_counts -- " << l.client_held_lock_counts
       << "\n client_waiting_lock_counts -- " << l.client_waiting_lock_counts
       << "\n held_locks -- ";
-    for (multimap<uint64_t, ceph_filelock>::iterator iter = l.held_locks.begin();
+    for (auto iter = l.held_locks.begin();
          iter != l.held_locks.end();
          ++iter)
       out << iter->second;
     out << "\n waiting_locks -- ";
-    for (multimap<uint64_t, ceph_filelock>::iterator iter =l.waiting_locks.begin();
+    for (auto iter =l.waiting_locks.begin();
          iter != l.waiting_locks.end();
          ++iter)
       out << iter->second << "\n";
index 9bfc81434f8041e0d9c7094251a39ca04fe722b6..e2348029d76d8826a7e15a59c90a922661696986 100644 (file)
@@ -37,7 +37,7 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, version_t v) {
                << ").auth v" << v << " ";
 }
 
-ostream& operator<<(ostream& out, AuthMonitor& pm)
+ostream& operator<<(ostream &out, const AuthMonitor &pm)
 {
   return out << "auth";
 }
index d04d97e7c14a064828f4955248200081c4f7d41e..8f3946f8a850e776050372ca56fd19340dfb205d 100644 (file)
@@ -41,7 +41,7 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, version_t v) {
                << ").log v" << v << " ";
 }
 
-ostream& operator<<(ostream& out, LogMonitor& pm)
+ostream& operator<<(ostream &out, const LogMonitor &pm)
 {
   return out << "log";
 }
index 68597f3328cbcdb3413077efdad61427a5851247..f9dbcce3c756d4544b017d21ec9a4a1300d860f3 100644 (file)
@@ -239,7 +239,7 @@ class MonMap {
 };
 WRITE_CLASS_ENCODER_FEATURES(MonMap)
 
-inline ostream& operator<<(ostream& out, MonMap& m) {
+inline ostream& operator<<(ostream &out, const MonMap &m) {
   m.print_summary(out);
   return out;
 }
index d9cd9a23bea025ec00779a8008b8dc4475e8e6fe..b95d83a38c155f989bd4c07dda9816dfab6b8551 100644 (file)
@@ -470,7 +470,7 @@ extern Message *decode_message(CephContext *cct, int crcflags,
                               ceph_msg_header &header,
                               ceph_msg_footer& footer, bufferlist& front,
                               bufferlist& middle, bufferlist& data);
-inline ostream& operator<<(ostream& out, Message& m) {
+inline ostream& operator<<(ostream &out, const Message &m) {
   m.print(out);
   if (m.get_header().version)
     out << " v" << m.get_header().version;
index 3e20aa93e151684618e13780e654452d44be99d5..2d6f85e5d7e3e4161f208d5d0e359b827f93dfd5 100644 (file)
@@ -89,7 +89,7 @@ void Journaler::_set_layout(file_layout_t const *l)
 
 /***************** HEADER *******************/
 
-ostream& operator<<(ostream& out, Journaler::Header &h)
+ostream& operator<<(ostream &out, const Journaler::Header &h)
 {
   return out << "loghead(trim " << h.trimmed_pos
             << ", expire " << h.expire_pos
index 0d93942c1f6752874ada4357591ba4353d0ac8a9..cdd6f33a228b04f6d77acb4ce4881e618fb93355 100644 (file)
@@ -165,13 +165,13 @@ class ObjectCacher {
       journal_tid = _journal_tid;
     }
 
-    bool is_missing() { return state == STATE_MISSING; }
-    bool is_dirty() { return state == STATE_DIRTY; }
-    bool is_clean() { return state == STATE_CLEAN; }
-    bool is_zero() { return state == STATE_ZERO; }
-    bool is_tx() { return state == STATE_TX; }
-    bool is_rx() { return state == STATE_RX; }
-    bool is_error() { return state == STATE_ERROR; }
+    bool is_missing() const { return state == STATE_MISSING; }
+    bool is_dirty() const { return state == STATE_DIRTY; }
+    bool is_clean() const { return state == STATE_CLEAN; }
+    bool is_zero() const { return state == STATE_ZERO; }
+    bool is_tx() const { return state == STATE_TX; }
+    bool is_rx() const { return state == STATE_RX; }
+    bool is_error() const { return state == STATE_ERROR; }
 
     // reference counting
     int get() {
@@ -276,14 +276,14 @@ class ObjectCacher {
       set_item.remove_myself();
     }
 
-    sobject_t get_soid() { return oid; }
+    sobject_t get_soid() const { return oid; }
     object_t get_oid() { return oid.oid; }
     snapid_t get_snap() { return oid.snap; }
-    ObjectSet *get_object_set() { return oset; }
+    ObjectSet *get_object_set() const { return oset; }
     string get_namespace() { return oloc.nspace; }
     uint64_t get_object_number() const { return object_no; }
 
-    object_locator_t& get_oloc() { return oloc; }
+    const object_locator_t& get_oloc() const { return oloc; }
     void set_object_locator(object_locator_t& l) { oloc = l; }
 
     bool can_close() {
@@ -778,7 +778,7 @@ public:
 };
 
 
-inline ostream& operator<<(ostream& out, ObjectCacher::BufferHead &bh)
+inline ostream& operator<<(ostream &out, const ObjectCacher::BufferHead &bh)
 {
   out << "bh[ " << &bh << " "
       << bh.start() << "~" << bh.length()
@@ -812,7 +812,7 @@ inline ostream& operator<<(ostream& out, ObjectCacher::BufferHead &bh)
   return out;
 }
 
-inline ostream& operator<<(ostream& out, ObjectCacher::ObjectSet &os)
+inline ostream& operator<<(ostream &out, const ObjectCacher::ObjectSet &os)
 {
   return out << "objectset[" << os.ino
             << " ts " << os.truncate_seq << "/" << os.truncate_size
@@ -821,7 +821,7 @@ inline ostream& operator<<(ostream& out, ObjectCacher::ObjectSet &os)
             << "]";
 }
 
-inline ostream& operator<<(ostream& out, ObjectCacher::Object &ob)
+inline ostream& operator<<(ostream &out, const ObjectCacher::Object &ob)
 {
   out << "object["
       << ob.get_soid() << " oset " << ob.oset << dec
index 52d885ac9b5953931e06154af9dba8e5b4a6cd89..f479e0dd9f8a7081d99d37ca9eee7c550bb06eed 100644 (file)
@@ -62,7 +62,7 @@ void IO::write_debug_base(ostream& out, string type) const {
 }
 
 
-ostream& operator<<(ostream& out, IO::ptr io) {
+ostream& operator<<(ostream &out, const IO::ptr &io) {
   io->write_debug(out);
   return out;
 }
index e6c0bf5fd52d418f6c158eb074eed4573e1a3826..7316bc1dcc82e44f197f8e4e7ba93c10675f8b43 100644 (file)
@@ -106,7 +106,7 @@ private:
 
 /// Used for dumping debug info.
 /// @related IO
-std::ostream& operator<<(std::ostream& out, IO::ptr io);
+std::ostream& operator<<(std::ostream &out, const IO::ptr &io);
 
 
 class StartThreadIO : public IO {
index df555f800ac2aeb91417f74d96ca8d7e65566002..ff067a4f1da155bd069614cca37beaa3fa45f6da 100644 (file)
@@ -45,7 +45,7 @@ get_next()
   return obj;
 }
 
-ostream& operator<<(ostream& out, XMLObj& obj) {
+ostream& operator<<(ostream &out, const XMLObj &obj) {
    out << obj.obj_type << ": " << obj.data;
    return out;
 }
index 257a15665abaa1d1d012f67de1bb60410bb8148f..49b1fb8655260f593a6780b7d86741f661a9a5dc 100644 (file)
@@ -56,7 +56,7 @@ public:
   XMLObjIter find(string name);
   XMLObj *find_first(string name);
 
-  friend ostream& operator<<(ostream& out, XMLObj& obj);
+  friend ostream& operator<<(ostream &out, const XMLObj &obj);
 };
 
 struct XML_ParserStruct;
index d8676da18faba7446e294627b843e2e5c1115079..cf1b095b50b4a23a0774da7da7461eb94a5951bb 100644 (file)
@@ -8,7 +8,7 @@ using namespace crush;
 using namespace std;
 
 
-ostream& operator<<(ostream& out, vector<int>& v)
+ostream& operator<<(ostream &out, const vector<int> &v)
 {
   out << "[";
   for (int i=0; i<v.size(); i++) {
index db6a82e22816026a0400001ebee16970db81f6a0..e8045fa43fbef34b692e538c7b37ff5a6644823f 100644 (file)
@@ -34,10 +34,10 @@ void TestOpStat::TypeStatus::export_latencies(map<double,uint64_t> &in) const
   }
 }
   
-std::ostream & operator<<(std::ostream &out, TestOpStat &rhs)
+std::ostream & operator<<(std::ostream &out, const TestOpStat &rhs)
 {
   rhs.stat_lock.Lock();
-  for (map<string,TestOpStat::TypeStatus>::iterator i = rhs.stats.begin();
+  for (auto i = rhs.stats.begin();
        i != rhs.stats.end();
        ++i) {
     map<double,uint64_t> latency;
index 3d70ece719e7465da64e7611f40232dce6c25a53..5bf4fc9595c359c44fc0a3c4a916cf11a8927df3 100644 (file)
@@ -10,7 +10,7 @@ class TestOp;
 
 class TestOpStat {
 public:
-  Mutex stat_lock;
+  mutable Mutex stat_lock;
 
   TestOpStat() : stat_lock("TestOpStat lock") {}
     
@@ -45,9 +45,9 @@ public:
 
   void begin(TestOp *in);
   void end(TestOp *in);
-  friend std::ostream & operator<<(std::ostream &, TestOpStat&);
+  friend std::ostream & operator<<(std::ostream &, const TestOpStat &);
 };
 
-std::ostream & operator<<(std::ostream &out, TestOpStat &rhs);
+std::ostream & operator<<(std::ostream &out, const TestOpStat &rhs);
 
 #endif