From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 21:17:38 +0000 (+0100) Subject: mds/LogEvent.h: change print() signature to const X-Git-Tag: v0.58~91^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c65cd5f5e93f2d3db9ac55b74c03a32144d331f;p=ceph.git mds/LogEvent.h: change print() signature to const Fix print() function of src/mds/LogEvent.h, declare as virtual void print(ostream& out) const {...} Adapt functions of derived classes. This should fix a problem with print function of derived classes EImportStart and EImportFinish, which had a const signature, hiding virtual function of the base class LogEvent (which wasn't const). Fix -Woverloaded-virtual warning from clang was: mds/events/EImportStart.h:43:8: warning: 'EImportStart::print' hides overloaded virtual function [-Woverloaded-virtual] void print(ostream& out) const { ^ mds/events/../LogEvent.h:95:16: note: hidden overloaded virtual function 'LogEvent::print' declared here virtual void print(ostream& out) { ^ In file included from mds/journal.cc:31: mds/events/EImportFinish.h:35:8: warning: 'EImportFinish::print' hides overloaded virtual function [-Woverloaded-virtual] void print(ostream& out) const { ^ mds/events/../LogEvent.h:95:16: note: hidden overloaded virtual function 'LogEvent::print' declared here virtual void print(ostream& out) { Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index 25990b6f104d..fdf145c85eaf 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -92,7 +92,7 @@ protected: ENCODE_FINISH(bl); } - virtual void print(ostream& out) { + virtual void print(ostream& out) const { out << "event(" << _type << ")"; } diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h index 0cb933e2389b..2889a3b032d7 100644 --- a/src/mds/events/ECommitted.h +++ b/src/mds/events/ECommitted.h @@ -26,7 +26,7 @@ public: ECommitted(metareqid_t r) : LogEvent(EVENT_COMMITTED), reqid(r) { } - void print(ostream& out) { + void print(ostream& out) const { out << "ECommitted " << reqid; } diff --git a/src/mds/events/EExport.h b/src/mds/events/EExport.h index 645c790b22d6..082e14babb85 100644 --- a/src/mds/events/EExport.h +++ b/src/mds/events/EExport.h @@ -38,7 +38,7 @@ public: set &get_bounds() { return bounds; } - void print(ostream& out) { + void print(ostream& out) const { out << "EExport " << base << " " << metablob; } diff --git a/src/mds/events/EFragment.h b/src/mds/events/EFragment.h index 5524de7827ee..bdbbd335e29f 100644 --- a/src/mds/events/EFragment.h +++ b/src/mds/events/EFragment.h @@ -30,7 +30,8 @@ public: EFragment(MDLog *mdlog, int o, inodeno_t i, frag_t bf, int b) : LogEvent(EVENT_FRAGMENT), metablob(mdlog), op(o), ino(i), basefrag(bf), bits(b) { } - void print(ostream& out) { + + void print(ostream& out) const { out << "EFragment " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << " " << metablob; } diff --git a/src/mds/events/EOpen.h b/src/mds/events/EOpen.h index 3ec677c14f7f..792540ef5dab 100644 --- a/src/mds/events/EOpen.h +++ b/src/mds/events/EOpen.h @@ -27,7 +27,7 @@ public: EOpen(MDLog *mdlog) : LogEvent(EVENT_OPEN), metablob(mdlog) { } - void print(ostream& out) { + void print(ostream& out) const { out << "EOpen " << metablob << ", " << inos.size() << " open files"; } diff --git a/src/mds/events/EResetJournal.h b/src/mds/events/EResetJournal.h index 7fc3847d2adf..c782f29a8dd8 100644 --- a/src/mds/events/EResetJournal.h +++ b/src/mds/events/EResetJournal.h @@ -28,7 +28,7 @@ class EResetJournal : public LogEvent { void decode(bufferlist::iterator& bl); void dump(Formatter *f) const; static void generate_test_instances(list& ls); - void print(ostream& out) { + void print(ostream& out) const { out << "EResetJournal"; } diff --git a/src/mds/events/ESession.h b/src/mds/events/ESession.h index e2e269fa4298..91ad6c45ae43 100644 --- a/src/mds/events/ESession.h +++ b/src/mds/events/ESession.h @@ -51,7 +51,7 @@ class ESession : public LogEvent { void dump(Formatter *f) const; static void generate_test_instances(list& ls); - void print(ostream& out) { + void print(ostream& out) const { if (open) out << "ESession " << client_inst << " open cmapv " << cmapv; else diff --git a/src/mds/events/ESessions.h b/src/mds/events/ESessions.h index e239a0da8e97..fe943a881fd2 100644 --- a/src/mds/events/ESessions.h +++ b/src/mds/events/ESessions.h @@ -48,7 +48,7 @@ public: void dump(Formatter *f) const; static void generate_test_instances(list& ls); - void print(ostream& out) { + void print(ostream& out) const { out << "ESessions " << client_map.size() << " opens cmapv " << cmapv; } diff --git a/src/mds/events/ESlaveUpdate.h b/src/mds/events/ESlaveUpdate.h index fd32486e8e26..40d9c22f6d47 100644 --- a/src/mds/events/ESlaveUpdate.h +++ b/src/mds/events/ESlaveUpdate.h @@ -123,7 +123,7 @@ public: master(mastermds), op(o), origop(oo) { } - void print(ostream& out) { + void print(ostream& out) const { if (type.length()) out << type << " "; out << " " << (int)op; diff --git a/src/mds/events/ESubtreeMap.h b/src/mds/events/ESubtreeMap.h index 0267a9259826..32a4abe5180d 100644 --- a/src/mds/events/ESubtreeMap.h +++ b/src/mds/events/ESubtreeMap.h @@ -27,7 +27,7 @@ public: ESubtreeMap() : LogEvent(EVENT_SUBTREEMAP), expire_pos(0) { } - void print(ostream& out) { + void print(ostream& out) const { out << "ESubtreeMap " << subtrees.size() << " subtrees " << ", " << ambiguous_subtrees.size() << " ambiguous " << metablob; diff --git a/src/mds/events/ETableClient.h b/src/mds/events/ETableClient.h index 8486b808cc3c..e415e60bd853 100644 --- a/src/mds/events/ETableClient.h +++ b/src/mds/events/ETableClient.h @@ -36,7 +36,7 @@ struct ETableClient : public LogEvent { void dump(Formatter *f) const; static void generate_test_instances(list& ls); - void print(ostream& out) { + void print(ostream& out) const { out << "ETableClient " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (tid) out << " tid " << tid; } diff --git a/src/mds/events/ETableServer.h b/src/mds/events/ETableServer.h index ee63e47a4162..132d3b6a6c90 100644 --- a/src/mds/events/ETableServer.h +++ b/src/mds/events/ETableServer.h @@ -41,7 +41,7 @@ struct ETableServer : public LogEvent { void dump(Formatter *f) const; static void generate_test_instances(list& ls); - void print(ostream& out) { + void print(ostream& out) const { out << "ETableServer " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op); if (reqid) out << " reqid " << reqid; diff --git a/src/mds/events/EUpdate.h b/src/mds/events/EUpdate.h index 79414fe5c7d3..645386e2511f 100644 --- a/src/mds/events/EUpdate.h +++ b/src/mds/events/EUpdate.h @@ -32,7 +32,7 @@ public: LogEvent(EVENT_UPDATE), metablob(mdlog), type(s), cmapv(0), had_slaves(false) { } - void print(ostream& out) { + void print(ostream& out) const { if (type.length()) out << "EUpdate " << type << " "; out << metablob;