]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephfs-mirror: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 09:57:00 +0000 (17:57 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:23:38 +0000 (12:23 +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/tools/cephfs_mirror/FSMirror.cc
src/tools/cephfs_mirror/FSMirror.h
src/tools/cephfs_mirror/InstanceWatcher.cc
src/tools/cephfs_mirror/InstanceWatcher.h
src/tools/cephfs_mirror/PeerReplayer.cc
src/tools/cephfs_mirror/PeerReplayer.h
src/tools/cephfs_mirror/main.cc

index 76dcc11f6c6b71364e6b333fbe80d79bfe33a931..a0bf75d1e29778a207e48d9c0fd700dca43e629b 100644 (file)
@@ -23,6 +23,8 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "cephfs::mirror::FSMirror " << __func__
 
+using namespace std;
+
 namespace cephfs {
 namespace mirror {
 
index bae5a38e1b53cb93b70d546631e2be18f34d26f8..d2c9c07782adc2007b806f0cab2c8c098f41efe8 100644 (file)
@@ -92,11 +92,11 @@ private:
       : fs_mirror(fs_mirror) {
     }
 
-    void acquire_directory(string_view dir_path) override {
+    void acquire_directory(std::string_view dir_path) override {
       fs_mirror->handle_acquire_directory(dir_path);
     }
 
-    void release_directory(string_view dir_path) override {
+    void release_directory(std::string_view dir_path) override {
       fs_mirror->handle_release_directory(dir_path);
     }
   };
@@ -148,8 +148,8 @@ private:
   void shutdown_instance_watcher();
   void handle_shutdown_instance_watcher(int r);
 
-  void handle_acquire_directory(string_view dir_path);
-  void handle_release_directory(string_view dir_path);
+  void handle_acquire_directory(std::string_view dir_path);
+  void handle_release_directory(std::string_view dir_path);
 };
 
 } // namespace mirror
index 9c357da318548138d7f80bf5323d80cd880b51fb..aeb474274fb4a755d06d1be93842359383f58639 100644 (file)
@@ -17,6 +17,8 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "cephfs::mirror::InstanceWatcher " << __func__
 
+using namespace std;
+
 namespace cephfs {
 namespace mirror {
 
index 06edf5da97a27a8e559503e783e970f9a03dff71..dfe0cd05990e553dbc7122b93849d28af47efc5d 100644 (file)
@@ -25,8 +25,8 @@ public:
     virtual ~Listener() {
     }
 
-    virtual void acquire_directory(string_view dir_path) = 0;
-    virtual void release_directory(string_view dir_path) = 0;
+    virtual void acquire_directory(std::string_view dir_path) = 0;
+    virtual void release_directory(std::string_view dir_path) = 0;
   };
 
   static InstanceWatcher *create(librados::IoCtx &ioctx,
index 44796cb4973af0f5ba07b9c8b9740d9c6a5f01ea..d5ab7a215a143c7302e6db8cef11be2a80ff7320 100644 (file)
@@ -24,6 +24,8 @@
 #define dout_prefix *_dout << "cephfs::mirror::PeerReplayer("   \
                            << m_peer.uuid << ") " << __func__
 
+using namespace std;
+
 namespace cephfs {
 namespace mirror {
 
index 886c9532944b8828cc6936bac9a50d35e363423f..d45d3087e8d4a924c4041859e1c0b779d104a685 100644 (file)
@@ -31,10 +31,10 @@ public:
   void shutdown();
 
   // add a directory to mirror queue
-  void add_directory(string_view dir_root);
+  void add_directory(std::string_view dir_root);
 
   // remove a directory from queue
-  void remove_directory(string_view dir_root);
+  void remove_directory(std::string_view dir_root);
 
   // admin socket helpers
   void peer_status(Formatter *f);
index efaa89c35931e6cd72b1869c16d13fa548523160..2e1dd05edc1a5d7825b63988504bf0456e6c93a3 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <vector>
 
+using namespace std;
+
 void usage() {
   std::cout << "usage: cephfs-mirror [options...]" << std::endl;
   std::cout << "options:\n";