]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Build target 'common' without using namespace in headers
authorAdam C. Emerson <aemerson@redhat.com>
Sat, 7 Mar 2020 09:28:53 +0000 (04:28 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Sat, 7 Mar 2020 09:28:53 +0000 (04:28 -0500)
Part of a changeset to allow building all of 'common' without relying
on 'using namespace std' or 'using namespace ceph' at toplevel in
headers.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/osd/ClassHandler.cc
src/osd/OSDMap.h
src/osd/OSDMapMapping.cc
src/osd/OSDMapMapping.h
src/osd/osd_op_util.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index 0f9f5111c8b49ac0e7ed4e680e29b786cb39111e..2bf6a69ad100ddf2d15d684f196fdd25cf1893a7 100644 (file)
 #define CLS_PREFIX "libcls_"
 #define CLS_SUFFIX ".so"
 
+using std::map;
+using std::set;
+using std::string;
+
+using ceph::bufferlist;
+
 
 int ClassHandler::open_class(const string& cname, ClassData **pcls)
 {
@@ -319,7 +325,7 @@ int ClassHandler::ClassMethod::exec(cls_method_context_t ctx, bufferlist& indata
       ret = method(ctx, indata.c_str(), indata.length(), &out, &olen);
       if (out) {
         // assume *out was allocated via cls_alloc (which calls malloc!)
-        buffer::ptr bp = buffer::claim_malloc(olen, out);
+       ceph::buffer::ptr bp = ceph::buffer::claim_malloc(olen, out);
         outdata.push_back(bp);
       }
     } else {
index cdbacbb1e63132bc76c533ce67020a8a96c160a1..634e385c41bae0d3631a9d5b8b35495533127bea 100644 (file)
@@ -1054,17 +1054,17 @@ public:
    */
   uint64_t get_up_osd_features() const;
 
-  void get_upmap_pgs(vector<pg_t> *upmap_pgs) const;
+  void get_upmap_pgs(std::vector<pg_t> *upmap_pgs) const;
   bool check_pg_upmaps(
     CephContext *cct,
-    const vector<pg_t>& to_check,
-    vector<pg_t> *to_cancel,
-    map<pg_t, mempool::osdmap::vector<pair<int,int>>> *to_remap) const;
+    const std::vector<pg_t>& to_check,
+    std::vector<pg_t> *to_cancel,
+    std::map<pg_t, mempool::osdmap::vector<std::pair<int,int>>> *to_remap) const;
   void clean_pg_upmaps(
     CephContext *cct,
     Incremental *pending_inc,
-    const vector<pg_t>& to_cancel,
-    const map<pg_t, mempool::osdmap::vector<pair<int,int>>>& to_remap) const;
+    const std::vector<pg_t>& to_cancel,
+    const std::map<pg_t, mempool::osdmap::vector<std::pair<int,int>>>& to_remap) const;
   bool clean_pg_upmaps(CephContext *cct, Incremental *pending_inc) const;
 
   int apply_incremental(const Incremental &inc);
@@ -1427,7 +1427,7 @@ public:
       pg_upmap_items.count(pg);
   }
 
-  bool check_full(const set<pg_shard_t> &missing_on) const {
+  bool check_full(const std::set<pg_shard_t> &missing_on) const {
     for (auto shard : missing_on) {
       if (get_state(shard.osd) & CEPH_OSD_FULL)
        return true;
index ba59c21dfbed3c453aa3187ad5783793d7920307..9cd1fbf58238fb26102143eddc7cbe785c075541 100644 (file)
@@ -8,6 +8,8 @@
 
 #include "common/debug.h"
 
+using std::vector;
+
 MEMPOOL_DEFINE_OBJECT_FACTORY(OSDMapMapping, osdmapmapping,
                              osdmap_mapping);
 
index 37ec74f6f50b55cf8849291a1d51ba9e8b138e7e..4096c389de455ecc714548559075b699750e67ad 100644 (file)
@@ -33,7 +33,7 @@ public:
     }
 
     // child must implement either form of process
-    virtual void process(const vector<pg_t>& pgs) = 0;
+    virtual void process(const std::vector<pg_t>& pgs) = 0;
     virtual void process(int64_t poolid, unsigned ps_begin, unsigned ps_end) = 0;
     virtual void complete() = 0;
 
@@ -100,9 +100,9 @@ protected:
     Job *job;
     int64_t pool;
     unsigned begin, end;
-    vector<pg_t> pgs;
+    std::vector<pg_t> pgs;
 
-    Item(Job *j, vector<pg_t> pgs) : job(j), pgs(pgs) {}
+    Item(Job *j, std::vector<pg_t> pgs) : job(j), pgs(pgs) {}
     Item(Job *j, int64_t p, unsigned b, unsigned e)
       : job(j),
        pool(p),
@@ -158,7 +158,7 @@ public:
   void queue(
     Job *job,
     unsigned pgs_per_item,
-    const vector<pg_t>& input_pgs);
+    const std::vector<pg_t>& input_pgs);
 
   void drain() {
     wq.drain();
@@ -275,7 +275,7 @@ private:
       : Job(osdmap), mapping(m) {
       mapping->_start(*osdmap);
     }
-    void process(const vector<pg_t>& pgs) override {}
+    void process(const std::vector<pg_t>& pgs) override {}
     void process(int64_t pool, unsigned ps_begin, unsigned ps_end) override {
       mapping->_update_range(*osdmap, pool, ps_begin, ps_end);
     }
index 626779843c76964474b18ec0f211f1c1ded57b9c..48e3cb4b46a9ff11d7f16e57730978665b1efe4a 100644 (file)
@@ -6,6 +6,12 @@
 #include "osd/ClassHandler.h"
 #include "messages/MOSDOp.h"
 
+using std::ostream;
+using std::string;
+using std::vector;
+
+using ceph::bufferlist;
+
 bool OpInfo::check_rmw(int flag) const {
   ceph_assert(rmw_flags != 0);
   return rmw_flags & flag;
index cc5d91d528f9a5a0234f6fdc5ca747f20701ebc4..416f5cafd762aa81bccc3660c048023fe37aceea 100644 (file)
@@ -51,11 +51,14 @@ using std::stringstream;
 using std::unique_ptr;
 using std::vector;
 
+using ceph::bufferlist;
 using ceph::decode;
 using ceph::decode_nohead;
 using ceph::encode;
 using ceph::encode_nohead;
 using ceph::Formatter;
+using ceph::make_timespan;
+using ceph::JSONFormatter;
 
 using namespace std::literals;
 
@@ -3715,7 +3718,7 @@ public:
   pair<epoch_t, epoch_t> get_bounds() const override {
     return make_pair(first, last + 1);
   }
-  void adjust_start_backwards(epoch_t last_epoch_clean) {
+  void adjust_start_backwards(epoch_t last_epoch_clean) override {
     first = last_epoch_clean;
   }
 
@@ -6961,7 +6964,7 @@ int PGLSPlainFilter::init(ceph::bufferlist::const_iterator &params)
   try {
     decode(xattr, params);
     decode(val, params);
-  } catch (buffer::error &e) {
+  } catch (ceph::buffer::error &e) {
     return -EINVAL;
   }
   return 0;
index eec67724f24ab83095010f19a9b842041ca83fd2..5c0f0a9ad6f7d41002ddaad941ba144df38dc943 100644 (file)
@@ -12,7 +12,7 @@
  * modify it under the terms of the GNU Lesser General Public
  * License version 2.1, as published by the Free Software 
  * Foundation.  See file COPYING.
- * 
+ *
  */
 
 #ifndef CEPH_OSD_TYPES_H
@@ -2372,7 +2372,7 @@ struct osd_stat_t {
     uint32_t front_max[3];
     uint32_t front_last;
   };
-  map<int, Interfaces> hb_pingtime;  ///< map of osd id to Interfaces
+  std::map<int, Interfaces> hb_pingtime;  ///< map of osd id to Interfaces
 
   osd_stat_t() : snap_trim_queue_len(0), num_snap_trimming(0),
        num_shards_repaired(0)  {}
@@ -3686,7 +3686,7 @@ struct pg_lease_t {
   void dump(ceph::Formatter *f) const;
   static void generate_test_instances(std::list<pg_lease_t*>& o);
 
-  friend ostream& operator<<(ostream& out, const pg_lease_t& l) {
+  friend std::ostream& operator<<(std::ostream& out, const pg_lease_t& l) {
     return out << "pg_lease(ru " << l.readable_until
               << " ub " << l.readable_until_ub
               << " int " << l.interval << ")";
@@ -3713,7 +3713,7 @@ struct pg_lease_ack_t {
   void dump(ceph::Formatter *f) const;
   static void generate_test_instances(std::list<pg_lease_ack_t*>& o);
 
-  friend ostream& operator<<(ostream& out, const pg_lease_ack_t& l) {
+  friend std::ostream& operator<<(std::ostream& out, const pg_lease_ack_t& l) {
     return out << "pg_lease_ack(ruub " << l.readable_until_ub << ")";
   }
 };
@@ -3905,7 +3905,7 @@ private:
    * finally, clean_offsets becomes {[5~10], [30~10]}
    */
   void trim();
-  friend ostream& operator<<(ostream& out, const ObjectCleanRegions& ocr);
+  friend std::ostream& operator<<(std::ostream& out, const ObjectCleanRegions& ocr);
 public:
   ObjectCleanRegions() : new_object(false), clean_omap(true) {
     clean_offsets.insert(0, (uint64_t)-1);
@@ -3927,13 +3927,13 @@ public:
   bool omap_is_dirty() const;
   bool object_is_exist() const;
 
-  void encode(bufferlist &bl) const;
-  void decode(bufferlist::const_iterator &bl);
-  void dump(Formatter *f) const;
-  static void generate_test_instances(list<ObjectCleanRegions*>& o);
+  void encode(ceph::buffer::list &bl) const;
+  void decode(ceph::buffer::list::const_iterator &bl);
+  void dump(ceph::Formatter *f) const;
+  static void generate_test_instances(std::list<ObjectCleanRegions*>& o);
 };
 WRITE_CLASS_ENCODER(ObjectCleanRegions)
-ostream& operator<<(ostream& out, const ObjectCleanRegions& ocr);
+std::ostream& operator<<(std::ostream& out, const ObjectCleanRegions& ocr);
 
 
 struct OSDOp {
@@ -4001,18 +4001,18 @@ std::ostream& operator<<(std::ostream& out, const OSDOp& op);
 
 struct pg_log_op_return_item_t {
   int32_t rval;
-  bufferlist bl;
-  void encode(bufferlist& p) const {
+  ceph::buffer::list bl;
+  void encode(ceph::buffer::list& p) const {
     using ceph::encode;
     encode(rval, p);
     encode(bl, p);
   }
-  void decode(bufferlist::const_iterator& p) {
+  void decode(ceph::buffer::list::const_iterator& p) {
     using ceph::decode;
     decode(rval, p);
     decode(bl, p);
   }
-  void dump(Formatter *f) const {
+  void dump(ceph::Formatter *f) const {
     f->dump_int("rval", rval);
     f->dump_unsigned("bl_length", bl.length());
   }
@@ -4025,7 +4025,7 @@ struct pg_log_op_return_item_t {
                         const pg_log_op_return_item_t& rhs) {
     return !(lhs == rhs);
   }
-  friend ostream& operator<<(ostream& out, const pg_log_op_return_item_t& i) {
+  friend std::ostream& operator<<(std::ostream& out, const pg_log_op_return_item_t& i) {
     return out << "r=" << i.rval << "+" << i.bl.length() << "b";
   }
 };
@@ -4091,7 +4091,7 @@ struct pg_log_entry_t {
   utime_t     mtime;  // this is the _user_ mtime, mind you
   int32_t return_code; // only stored for ERRORs for dup detection
 
-  vector<pg_log_op_return_item_t> op_returns;
+  std::vector<pg_log_op_return_item_t> op_returns;
 
   __s32      op;
   bool invalid_hash; // only when decoding sobject_t based entries
@@ -4185,7 +4185,7 @@ struct pg_log_dup_t {
   version_t user_version; // the user version for this entry
   int32_t return_code; // only stored for ERRORs for dup detection
 
-  vector<pg_log_op_return_item_t> op_returns;
+  std::vector<pg_log_op_return_item_t> op_returns;
 
   pg_log_dup_t()
     : user_version(0), return_code(0)
@@ -6220,11 +6220,11 @@ WRITE_CLASS_ENCODER(pool_pg_num_history_t)
 
 // prefix pgmeta_oid keys with _ so that PGLog::read_log_and_missing() can
 // easily skip them
-static const string_view infover_key = "_infover"sv;
-static const string_view info_key = "_info"sv;
-static const string_view biginfo_key = "_biginfo"sv;
-static const string_view epoch_key = "_epoch"sv;
-static const string_view fastinfo_key = "_fastinfo"sv;
+static const std::string_view infover_key = "_infover";
+static const std::string_view info_key = "_info";
+static const std::string_view biginfo_key = "_biginfo";
+static const std::string_view epoch_key = "_epoch";
+static const std::string_view fastinfo_key = "_fastinfo";
 
 static const __u8 pg_latest_struct_v = 10;
 // v10 is the new past_intervals encoding
@@ -6236,8 +6236,8 @@ static const __u8 pg_compat_struct_v = 10;
 
 int prepare_info_keymap(
   CephContext* cct,
-  map<string,bufferlist> *km,
-  string *key_to_remove,
+  std::map<std::string,ceph::buffer::list> *km,
+  std::string *key_to_remove,
   epoch_t epoch,
   pg_info_t &info,
   pg_info_t &last_written_info,
@@ -6299,10 +6299,10 @@ public:
 class PGLSPlainFilter : public PGLSFilter {
   std::string val;
 public:
-  int init(ceph::bufferlist::const_iterator &params) override;
+  int init(ceph::buffer::list::const_iterator &params) override;
   ~PGLSPlainFilter() override {}
   bool filter(const hobject_t& obj,
-              const ceph::bufferlist& xattr_data) const override;
+              const ceph::buffer::list& xattr_data) const override;
 };