From 157162b129d1a2793bba3dc181907238055bc230 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 28 Mar 2019 20:39:28 -0400 Subject: [PATCH] mon: Update mon_types.h to work without using namespace Signed-off-by: Adam C. Emerson --- src/mon/mon_types.h | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index 0539ae2e05fb3..afb92f045bcba 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -51,7 +51,7 @@ inline const char *get_paxos_name(int p) { #define CEPH_MON_ONDISK_MAGIC "ceph mon volume v012" -extern const string CONFIG_PREFIX; +extern const std::string CONFIG_PREFIX; // map of entity_type -> features -> count struct FeatureMap { @@ -94,19 +94,19 @@ struct FeatureMap { return *this; } - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(m, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(m, p); DECODE_FINISH(p); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { for (auto& p : m) { f->open_array_section(ceph_entity_type_name(p.first)); for (auto& q : p.second) { @@ -147,7 +147,7 @@ struct LevelDBStoreStats { bytes_misc(0) {} - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { ceph_assert(f != NULL); f->dump_int("bytes_total", bytes_total); f->dump_int("bytes_sst", bytes_sst); @@ -156,7 +156,7 @@ struct LevelDBStoreStats { f->dump_stream("last_updated") << last_update; } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(bytes_total, bl); encode(bytes_sst, bl); @@ -166,7 +166,7 @@ struct LevelDBStoreStats { ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &p) { + void decode(ceph::buffer::list::const_iterator &p) { DECODE_START(1, p); decode(bytes_total, p); decode(bytes_sst, p); @@ -176,7 +176,7 @@ struct LevelDBStoreStats { DECODE_FINISH(p); } - static void generate_test_instances(list& ls) { + static void generate_test_instances(std::list& ls) { ls.push_back(new LevelDBStoreStats); ls.push_back(new LevelDBStoreStats); ls.back()->bytes_total = 1024*1024; @@ -196,7 +196,7 @@ struct DataStats { utime_t last_update; LevelDBStoreStats store_stats; - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { ceph_assert(f != NULL); f->dump_int("kb_total", (fs_stats.byte_total/1024)); f->dump_int("kb_used", (fs_stats.byte_used/1024)); @@ -208,7 +208,7 @@ struct DataStats { f->close_section(); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(3, 1, bl); encode(fs_stats.byte_total, bl); encode(fs_stats.byte_used, bl); @@ -218,7 +218,7 @@ struct DataStats { encode(store_stats, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &p) { + void decode(ceph::buffer::list::const_iterator &p) { DECODE_START(1, p); // we moved from having fields in kb to fields in byte if (struct_v > 2) { @@ -245,36 +245,36 @@ struct DataStats { WRITE_CLASS_ENCODER(DataStats) struct ScrubResult { - map prefix_crc; ///< prefix -> crc - map prefix_keys; ///< prefix -> key count + std::map prefix_crc; ///< prefix -> crc + std::map prefix_keys; ///< prefix -> key count bool operator!=(const ScrubResult& other) { return prefix_crc != other.prefix_crc || prefix_keys != other.prefix_keys; } - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(prefix_crc, bl); encode(prefix_keys, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(prefix_crc, p); decode(prefix_keys, p); DECODE_FINISH(p); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->open_object_section("crc"); - for (map::const_iterator p = prefix_crc.begin(); p != prefix_crc.end(); ++p) + for (auto p = prefix_crc.begin(); p != prefix_crc.end(); ++p) f->dump_unsigned(p->first.c_str(), p->second); f->close_section(); f->open_object_section("keys"); - for (map::const_iterator p = prefix_keys.begin(); p != prefix_keys.end(); ++p) + for (auto p = prefix_keys.begin(); p != prefix_keys.end(); ++p) f->dump_unsigned(p->first.c_str(), p->second); f->close_section(); } - static void generate_test_instances(list& ls) { + static void generate_test_instances(std::list& ls) { ls.push_back(new ScrubResult); ls.push_back(new ScrubResult); ls.back()->prefix_crc["foo"] = 123; @@ -283,12 +283,12 @@ struct ScrubResult { }; WRITE_CLASS_ENCODER(ScrubResult) -inline ostream& operator<<(ostream& out, const ScrubResult& r) { +inline std::ostream& operator<<(std::ostream& out, const ScrubResult& r) { return out << "ScrubResult(keys " << r.prefix_keys << " crc " << r.prefix_crc << ")"; } /// for information like os, kernel, hostname, memory info, cpu model. -typedef map Metadata; +typedef std::map Metadata; namespace ceph { namespace features { @@ -450,36 +450,36 @@ public: features &= ~(f.features); } - void print(ostream& out) const { + void print(std::ostream& out) const { out << "["; print_bit_str(features, out, ceph::features::mon::get_feature_name); out << "]"; } - void print_with_value(ostream& out) const { + void print_with_value(std::ostream& out) const { out << "["; print_bit_str(features, out, ceph::features::mon::get_feature_name, true); out << "]"; } - void dump(Formatter *f, const char *sec_name = NULL) const { + void dump(ceph::Formatter *f, const char *sec_name = NULL) const { f->open_array_section((sec_name ? sec_name : "features")); dump_bit_str(features, f, ceph::features::mon::get_feature_name); f->close_section(); } - void dump_with_value(Formatter *f, const char *sec_name = NULL) const { + void dump_with_value(ceph::Formatter *f, const char *sec_name = NULL) const { f->open_array_section((sec_name ? sec_name : "features")); dump_bit_str(features, f, ceph::features::mon::get_feature_name, true); f->close_section(); } - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(HEAD_VERSION, COMPAT_VERSION, bl); encode(features, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(COMPAT_VERSION, p); decode(features, p); DECODE_FINISH(p); @@ -601,7 +601,7 @@ inline mon_feature_t ceph::features::mon::get_feature_by_name(const std::string return FEATURE_NONE; } -inline ostream& operator<<(ostream& out, const mon_feature_t& f) { +inline std::ostream& operator<<(std::ostream& out, const mon_feature_t& f) { out << "mon_feature_t("; f.print(out); out << ")"; @@ -610,22 +610,22 @@ inline ostream& operator<<(ostream& out, const mon_feature_t& f) { struct ProgressEvent { - string message; ///< event description + std::string message; ///< event description float progress; ///< [0..1] - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(message, bl); encode(progress, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(message, p); decode(progress, p); DECODE_FINISH(p); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_string("message", message); f->dump_float("progress", progress); } -- 2.39.5