]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 03:53:50 +0000 (11:53 +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>
14 files changed:
src/os/FuseStore.cc
src/os/Transaction.cc
src/os/Transaction.h
src/os/bluestore/Allocator.h
src/os/bluestore/BitmapFreelistManager.h
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueRocksEnv.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/FreelistManager.h
src/os/bluestore/ZonedFreelistManager.h
src/os/bluestore/bluestore_tool.cc
src/os/filestore/FileStore.cc
src/os/kstore/KStore.cc

index dd9833e0861feaac7b3a2ef1356e27756760392c..a1a9aa6d007cd3996199bd165c0938b2fe6367ca 100644 (file)
@@ -27,6 +27,7 @@
 #undef dout_prefix
 #define dout_prefix *_dout << "fuse "
 
+using std::less;
 using std::list;
 using std::map;
 using std::set;
index ac3513ef4a4fca1611094d0372e6f61e47482a8a..f99b252205081904460faf1dd6db88e63e915e4e 100644 (file)
@@ -4,6 +4,7 @@
 #include "os/Transaction.h"
 #include "common/Formatter.h"
 
+using std::less;
 using std::list;
 using std::map;
 using std::ostream;
index f016aa6c315eec4a48693c984ee5a4888815114d..f28a257fcefc8e4d39f8a068d0e6a4b246516c5b 100644 (file)
@@ -744,7 +744,7 @@ public:
        return t->get_fadvise_flags();
     }
 
-    const vector<ghobject_t> &get_objects() const {
+    const std::vector<ghobject_t> &get_objects() const {
       return objects;
     }
   };
index 59be4a711d28ee54ae415f499205226e09c6b9c6..6f6325d57af9f223e1a1e7cedec8fc099d887802 100644 (file)
@@ -70,7 +70,7 @@ public:
                           int64_t block_size, const std::string_view name = "");
 
 
-  const string& get_name() const;
+  const std::string& get_name() const;
   int64_t get_capacity() const
   {
     return device_size;
index c6bfe469f1b4512b5075ccc5cedbc9f1cb8d4766..5b04e8fd28cc0651c1fc3cbdb3ffb93fc38c7225 100644 (file)
@@ -93,7 +93,7 @@ public:
     return bytes_per_block;
   }
   void get_meta(uint64_t target_size,
-    std::vector<std::pair<string, string>>*) const override;
+    std::vector<std::pair<std::string, std::string>>*) const override;
 };
 
 #endif
index 6f92965e4effd027a52d938ecbd43c17b3aa2df6..fe0b9aca941099ec1b5b6e119b3a84835c40929c 100644 (file)
@@ -214,7 +214,7 @@ public:
       buffer_appender.append(buf, len);
     }
 
-    void append(const byte *buf, size_t len) {
+    void append(const std::byte *buf, size_t len) {
       // allow callers to use byte type instead of char* as we simply pass byte array
       append((const char*)buf, len);
     }
index 045f773ac3ff553a7337f4b1f98d350c86180752..0d76a859719090fee7a15f4030a7bddac9c7a941 100644 (file)
@@ -7,6 +7,8 @@
 #include "kv/RocksDBStore.h"
 #include "string.h"
 
+using std::string_view;
+
 namespace {
 
 rocksdb::Status err_to_status(int r)
index fe1a11b9b5966503415ad1ca99d7f6321e1b2085..4f0b410e478afc85bdd697dbda7efbd241d6ca4b 100644 (file)
@@ -84,12 +84,15 @@ MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::SharedBlob, bluestore_shared_blob,
 // bluestore_txc
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::TransContext, bluestore_transcontext,
                              bluestore_txc);
+using std::byte;
 using std::deque;
 using std::min;
 using std::make_pair;
 using std::numeric_limits;
 using std::pair;
+using std::less;
 using std::list;
+using std::make_unique;
 using std::map;
 using std::max;
 using std::ostream;
@@ -97,6 +100,7 @@ using std::ostringstream;
 using std::set;
 using std::string;
 using std::stringstream;
+using std::unique_ptr;
 using std::vector;
 
 using ceph::bufferlist;
index f553db3454e6da91a96d1b252256ae71f39e4beb..5db9ec08a1ba76e506ac0064eeaf5d6dc763fb93 100644 (file)
@@ -2420,7 +2420,7 @@ public:
 private:
   int _check_or_set_bdev_label(std::string path, uint64_t size, std::string desc,
                               bool create);
-  int _set_bdev_label_size(const string& path, uint64_t size);
+  int _set_bdev_label_size(const std::string& path, uint64_t size);
 
   int _open_super_meta();
 
@@ -2700,7 +2700,7 @@ public:
   int expand_devices(std::ostream& out);
   std::string get_device_path(unsigned id);
 
-  int dump_bluefs_sizes(ostream& out);
+  int dump_bluefs_sizes(std::ostream& out);
 
 public:
   int statfs(struct store_statfs_t *buf,
@@ -3086,7 +3086,7 @@ private:
     std::lock_guard l(qlock);
     disk_size_mismatch_alert = s;
   }
-  void _set_spurious_read_errors_alert(const string& s) {
+  void _set_spurious_read_errors_alert(const std::string& s) {
     std::lock_guard l(qlock);
     spurious_read_errors_alert = s;
   }
index 18ca45f85649af3ebfef1adf3d137f9ffd949de9..4d375b430945611d6ee3fc1ffc74075119420834 100644 (file)
@@ -50,7 +50,7 @@ public:
   virtual uint64_t get_alloc_size() const = 0;
 
   virtual void get_meta(uint64_t target_size,
-    std::vector<std::pair<string, string>>*) const = 0;
+  std::vector<std::pair<std::string, std::string>>*) const = 0;
 
   void set_null_manager() {
     null_manager = true;
index 14ea9e39e76b861d4732999359fc78413dd52bf6..c6f9be3151e9ed4850f84a47e2628b6d912a813f 100644 (file)
@@ -22,7 +22,7 @@
 
 using cfg_reader_t = std::function<int(const std::string&, std::string*)>;
 
-const string CLEANING_IN_PROGRESS_KEY = "cleaning_in_progress";
+const std::string CLEANING_IN_PROGRESS_KEY = "cleaning_in_progress";
 
 class ZonedFreelistManager : public FreelistManager {
   std::string meta_prefix;    ///< device size, zone size, etc.
@@ -99,7 +99,7 @@ public:
   }
 
   void get_meta(uint64_t target_size,
-               std::vector<std::pair<string, string>>*) const override;
+               std::vector<std::pair<std::string, std::string>>*) const override;
 
   std::vector<zone_state_t> get_zone_states(KeyValueDB *kvdb) const;
   std::set<uint64_t> get_cleaning_in_progress_zones(KeyValueDB *kvdb) const;
index ee03dc1a02cd899c7e11589695bf9994bd4df637..b215d3e9ed17d97539165fdfc4e2c57693443434 100644 (file)
@@ -23,6 +23,7 @@
 #include "common/admin_socket.h"
 #include "kv/RocksDBStore.h"
 
+using namespace std;
 namespace fs = std::filesystem;
 namespace po = boost::program_options;
 
index 323bb6521cefda32130f1e7d807b0d8abd9e0b69..5ee012b04e29d899fc4865ecc6e0eeb33a9809ec 100644 (file)
 #define __FUNC__ __func__ << "(" << __LINE__ << ")"
 
 using std::cerr;
+using std::less;
 using std::list;
 using std::make_pair;
 using std::map;
index fe030859e22a6f5e5ee2a814704c4e719816d588..9526a756419cc80722afd44613544fa2ea28ad1c 100644 (file)
@@ -45,6 +45,7 @@
 
  */
 
+using std::less;
 using std::list;
 using std::make_pair;
 using std::map;