]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
messages: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:46:41 +0000 (11:46 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:21:39 +0000 (12:21 +0800)
* add "std::" prefix in headers
* add "using" declarations in .cc files.

so we don't rely on "using namespace std" in one or more included
headers.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/messages/MClientMetrics.h
src/messages/MMDSMetrics.h
src/messages/MMDSPing.h
src/messages/MMDSResolve.h
src/messages/MMDSScrubStats.h
src/messages/MMonCommand.h
src/messages/MMonCommandAck.h
src/messages/MMonJoin.h
src/messages/MMonPing.h

index 0745f4eaaab598a43335404db68091cfd0732e36..5db391fe7ac80c2d05faad48b53dea9595e5dd79 100644 (file)
@@ -28,7 +28,7 @@ public:
     return "client_metrics";
   }
 
-  void print(ostream &out) const override {
+  void print(std::ostream &out) const override {
     out << "client_metrics ";
     for (auto &i : updates) {
       i.print(&out);
index 4812e89bc30769e5d2ffe69547e61715a752efc4..4a8e036eb0a77d5257c9d62912f3ae067d78b9b1 100644 (file)
@@ -29,7 +29,7 @@ public:
     return "mds_metrics";
   }
 
-  void print(ostream &out) const override {
+  void print(std::ostream &out) const override {
     out << "mds_metrics from rank=" << metrics_message.rank << " carrying "
         << metrics_message.client_metrics_map.size() << " metric updates";
   }
index cf209baf69e7d18b54fce3caab08764d43d8e036..586ca91c1bcb98bc6d0a1bdc9a2642616ba24045 100644 (file)
@@ -27,7 +27,7 @@ public:
     return "mdsping";
   }
 
-  void print(ostream &out) const override {
+  void print(std::ostream &out) const override {
     out << "mdsping";
   }
 
index 6a6ff2771db718f3c42814dd7a3e6da8b3ecf111..7b4f7c123e5e9e236b936434052d358ac14d0174 100644 (file)
@@ -32,7 +32,7 @@ public:
     inodeno_t ino;
     std::map<client_t,Capability::Export> cap_exports;
     peer_inode_cap() {}
-    peer_inode_cap(inodeno_t a, map<client_t, Capability::Export> b) : ino(a), cap_exports(b) {}
+    peer_inode_cap(inodeno_t a, std::map<client_t, Capability::Export> b) : ino(a), cap_exports(b) {}
     void encode(ceph::buffer::list &bl) const 
     {
       ENCODE_START(1, 1, bl);
index ab4268ec52b81cd0e381f9e0d145f3088853f84c..c60981be5907a224ac07cb37b7cfefd5b67dc023 100644 (file)
@@ -23,7 +23,7 @@ class MMDSScrubStats : public MMDSOp {
 
 public:
   std::string_view get_type_name() const override { return "mds_scrub_stats"; }
-  void print(ostream& o) const override {
+  void print(std::ostream& o) const override {
     o << "mds_scrub_stats(e" << epoch;
     if (update_scrubbing)
       o << " [" << scrubbing_tags << "]";
index 494d5cf5606b6a7a77e8f46d00ed52e4f77be4a0..29e4269e87820d2c3363fee5cee1e6d87f901f2b 100644 (file)
@@ -46,17 +46,17 @@ public:
   void print(std::ostream& o) const override {
     cmdmap_t cmdmap;
     std::ostringstream ss;
-    string prefix;
+    std::string prefix;
     cmdmap_from_json(cmd, &cmdmap, ss);
     cmd_getval(cmdmap, "prefix", prefix);
     // Some config values contain sensitive data, so don't log them
     o << "mon_command(";
     if (prefix == "config set") {
-      string name;
+      std::string name;
       cmd_getval(cmdmap, "name", name);
       o << "[{prefix=" << prefix << ", name=" << name << "}]";
     } else if (prefix == "config-key set") {
-      string key;
+      std::string key;
       cmd_getval(cmdmap, "key", key);
       o << "[{prefix=" << prefix << ", key=" << key << "}]";
     } else {
index b49e8bcffdbbed65f72533ac4a4fe5e6b1e42b3b..d452035dbfc1dd8c38e9b6316637083a48f0a5de 100644 (file)
@@ -38,19 +38,19 @@ public:
   void print(std::ostream& o) const override {
     cmdmap_t cmdmap;
     std::ostringstream ss;
-    string prefix;
+    std::string prefix;
     cmdmap_from_json(cmd, &cmdmap, ss);
     cmd_getval(cmdmap, "prefix", prefix);
     // Some config values contain sensitive data, so don't log them
     o << "mon_command_ack(";
     if (prefix == "config set") {
-      string name;
+      std::string name;
       cmd_getval(cmdmap, "name", name);
       o << "[{prefix=" << prefix
         << ", name=" << name << "}]"
         << "=" << r << " " << rs << " v" << version << ")";
     } else if (prefix == "config-key set") {
-      string key;
+      std::string key;
       cmd_getval(cmdmap, "key", key);
       o << "[{prefix=" << prefix << ", key=" << key << "}]"
         << "=" << r << " " << rs << " v" << version << ")";
index 008617c555d66e3027d7de71f3d1ad6cabb03b5c..d047cc3d920fb1557a201beb673d2417da27a67f 100644 (file)
@@ -31,7 +31,7 @@ public:
    * location. Generally the monitor will force an update if it's given a
    * location from the CLI on boot-up, and then never force again (so that it
    * can be moved/updated via the ceph tool from elsewhere). */
-  map<string,string> crush_loc;
+  std::map<std::string,std::string> crush_loc;
   bool force_loc{false};
 
   MMonJoin() : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION} {}
@@ -39,7 +39,8 @@ public:
     : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), name(n), addrs(av)
   { }
-  MMonJoin(uuid_d &f, std::string n, const entity_addrvec_t& av, const map<string,string>& cloc, bool force)
+  MMonJoin(uuid_d &f, std::string n, const entity_addrvec_t& av,
+          const std::map<std::string,std::string>& cloc, bool force)
     : PaxosServiceMessage{MSG_MON_JOIN, 0, HEAD_VERSION, COMPAT_VERSION},
       fsid(f), name(n), addrs(av), crush_loc(cloc), force_loc(force)
   { }
index 682094958b43660990fcd943c892743164b21526..c6f697e501d38c4ce12305bb00a491da9daa8d9e 100644 (file)
@@ -96,7 +96,7 @@ public:
   }
 
   std::string_view get_type_name() const override { return "mon_ping"; }
-  void print(ostream& out) const override {
+  void print(std::ostream& out) const override {
     out << "mon_ping(" << get_op_name(op)
        << " stamp " << stamp
        << ")";