]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
blk: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:58:38 +0000 (11:58 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:23:37 +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/blk/kernel/KernelDevice.cc
src/blk/kernel/io_uring.cc
src/blk/spdk/NVMEDevice.cc
src/blk/spdk/NVMEDevice.h

index 304bcd732d43a9b70ae9222fc0e95af9c9df15e3..66e9bc622d788d0136af6a27832e343258fe87c6 100644 (file)
@@ -1064,7 +1064,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
     } else {
       r = -errno;
     }
-    derr << __func__ << " 0x" << std::hex << off << "~" << left
+    derr << __func__ << " 0x" << std::hex << off << "~" << std::left
          << std::dec << " error: " << cpp_strerror(r) << dendl;
     goto out;
   }
index 17bd35bb4c02bccf28f42fe88620a55d6ce800aa..5e7fd1227045d0fc4e5633ba03baf845008d5372 100644 (file)
@@ -8,6 +8,9 @@
 #include "liburing.h"
 #include <sys/epoll.h>
 
+using std::list;
+using std::make_unique;
+
 struct ioring_data {
   struct io_uring io_uring;
   pthread_mutex_t cq_mutex;
index 6bdf67b14ef1e7420ec712c2443ded110072a687..80377cd9b976d38f598598d83cc1f924f8d97fdd 100644 (file)
@@ -47,6 +47,8 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "bdev(" << sn << ") "
 
+using namespace std;
+
 static constexpr uint16_t data_buffer_default_num = 1024;
 
 static constexpr uint32_t data_buffer_size = 8192;
index cbd094d655d1cd5b82b2c9b29d72e4488b0ea3bd..323d7281f034c796fef78ce29303854601eec75f 100644 (file)
@@ -45,7 +45,7 @@ class NVMEDevice : public BlockDevice {
    * target for CONTROLLER IDENTIFY command during initialization
    */
   SharedDriverData *driver;
-  string name;
+  std::string name;
 
  public:
   SharedDriverData *get_driver() { return driver; }
@@ -76,9 +76,9 @@ class NVMEDevice : public BlockDevice {
 
   // for managing buffered readers/writers
   int invalidate_cache(uint64_t off, uint64_t len) override;
-  int open(const string& path) override;
+  int open(const std::string& path) override;
   void close() override;
-  int collect_metadata(const string& prefix, map<string,string> *pm) const override;
+  int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const override;
 };
 
 #endif