From 19e029811cb97e6f1bb42012e8eb8eef97574fc0 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 26 Dec 2017 17:47:58 -0500 Subject: [PATCH] test: Use unqualified encode/decode This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson --- src/test/cls_hello/test_cls_hello.cc | 6 +- src/test/cls_log/test_cls_log.cc | 4 +- src/test/cls_lua/test_cls_lua.cc | 8 +- src/test/cls_statelog/test_cls_statelog.cc | 2 +- src/test/common/ObjectContents.h | 17 +-- src/test/common/test_bloom_filter.cc | 8 +- src/test/encoding.cc | 4 +- src/test/encoding/ceph_dencoder.cc | 5 - src/test/encoding/test_ceph_time.h | 9 +- src/test/journal/test_Entry.cc | 4 +- src/test/journal/test_ObjectPlayer.cc | 2 +- src/test/librados/aio.cc | 6 +- src/test/librados/io.cc | 6 +- src/test/librados/list.cc | 12 +- src/test/librados/misc.cc | 106 +++++++++--------- src/test/librados/tier.cc | 8 +- src/test/librados/watch_notify.cc | 44 ++++---- src/test/librados_test_stub/TestIoCtxImpl.cc | 14 +-- .../librados_test_stub/TestWatchNotify.cc | 4 +- .../librbd/image/test_mock_CloneRequest.cc | 6 +- .../librbd/trash/test_mock_MoveRequest.cc | 6 +- src/test/messenger/message_helper.h | 2 +- src/test/msgr/test_msgr.cc | 6 +- .../objectstore/DeterministicOpSequence.cc | 6 +- src/test/objectstore/FileStoreTracker.cc | 30 ++--- src/test/objectstore/TestObjectStoreState.cc | 4 +- src/test/objectstore/store_test.cc | 10 +- .../objectstore/test_idempotent_sequence.cc | 2 +- src/test/osd/Object.cc | 20 ++-- src/test/osd/RadosModel.h | 20 ++-- src/test/osd/TestPGLog.cc | 2 +- src/test/perf_local.cc | 42 +++---- .../image_deleter/test_mock_TrashWatcher.cc | 6 +- src/test/rgw/test_rgw_common.h | 58 +++++----- src/test/rgw/test_rgw_manifest.cc | 24 ++-- src/test/rgw/test_rgw_obj.cc | 22 ++-- src/test/test_denc.cc | 50 +++++---- src/test/test_snap_mapper.cc | 2 +- 38 files changed, 296 insertions(+), 291 deletions(-) diff --git a/src/test/cls_hello/test_cls_hello.cc b/src/test/cls_hello/test_cls_hello.cc index efd9fc749f5c0..55386a86fb227 100644 --- a/src/test/cls_hello/test_cls_hello.cc +++ b/src/test/cls_hello/test_cls_hello.cc @@ -162,9 +162,9 @@ TEST(ClsHello, Filter) { bufferlist filter_bl; std::string filter_name = "hello.hello"; - ::encode(filter_name, filter_bl); - ::encode("_theattr", filter_bl); - ::encode(target_str, filter_bl); + encode(filter_name, filter_bl); + encode("_theattr", filter_bl); + encode(target_str, filter_bl); NObjectIterator iter(ioctx.nobjects_begin(filter_bl)); bool foundit = false; diff --git a/src/test/cls_log/test_cls_log.cc b/src/test/cls_log/test_cls_log.cc index ca5ebafaf9bc2..7209382b27ac9 100644 --- a/src/test/cls_log/test_cls_log.cc +++ b/src/test/cls_log/test_cls_log.cc @@ -34,7 +34,7 @@ static int read_bl(bufferlist& bl, int *i) bufferlist::iterator iter = bl.begin(); try { - ::decode(*i, iter); + decode(*i, iter); } catch (buffer::error& err) { std::cout << "failed to decode buffer" << std::endl; return -EIO; @@ -46,7 +46,7 @@ static int read_bl(bufferlist& bl, int *i) void add_log(librados::ObjectWriteOperation *op, utime_t& timestamp, string& section, string&name, int i) { bufferlist bl; - ::encode(i, bl); + encode(i, bl); cls_log_add(*op, timestamp, section, name, bl); } diff --git a/src/test/cls_lua/test_cls_lua.cc b/src/test/cls_lua/test_cls_lua.cc index e97dcef5c7df0..1cd3a00d2faa9 100644 --- a/src/test/cls_lua/test_cls_lua.cc +++ b/src/test/cls_lua/test_cls_lua.cc @@ -595,7 +595,7 @@ TEST_F(ClsLua, Write) { /* write some data into object */ string written = "Hello World"; bufferlist inbl; - ::encode(written, inbl); + encode(written, inbl); ASSERT_EQ(0, clslua_exec(test_script, &inbl, "write")); /* have Lua read out of the object */ @@ -606,7 +606,7 @@ TEST_F(ClsLua, Write) { /* compare what Lua read to what we wrote */ string read; - ::decode(read, outbl); + decode(read, outbl); ASSERT_EQ(read, written); } @@ -735,7 +735,7 @@ TEST_F(ClsLua, MapClear) { TEST_F(ClsLua, MapSetVal) { /* build some input value */ bufferlist orig_val; - ::encode("this is the original value yay", orig_val); + encode("this is the original value yay", orig_val); /* have the lua script stuff the data into a map value */ ASSERT_EQ(0, clslua_exec(test_script, &orig_val, "map_set_val")); @@ -747,7 +747,7 @@ TEST_F(ClsLua, MapSetVal) { ASSERT_EQ(0, ioctx.omap_get_vals_by_keys(oid, out_keys, &out_map)); bufferlist out_bl = out_map["foo"]; string out_val; - ::decode(out_val, out_bl); + decode(out_val, out_bl); ASSERT_EQ(out_val, "this is the original value yay"); } diff --git a/src/test/cls_statelog/test_cls_statelog.cc b/src/test/cls_statelog/test_cls_statelog.cc index 9cc6175ad785c..18b9b95c96965 100644 --- a/src/test/cls_statelog/test_cls_statelog.cc +++ b/src/test/cls_statelog/test_cls_statelog.cc @@ -36,7 +36,7 @@ static void reset_rop(librados::ObjectReadOperation **pop) { void add_log(librados::ObjectWriteOperation *op, const string& client_id, const string& op_id, string& obj, uint32_t state) { bufferlist bl; - ::encode(state, bl); + encode(state, bl); utime_t ts = ceph_clock_now(); diff --git a/src/test/common/ObjectContents.h b/src/test/common/ObjectContents.h index 3892c75bb59da..3b802fc36d85a 100644 --- a/src/test/common/ObjectContents.h +++ b/src/test/common/ObjectContents.h @@ -78,10 +78,10 @@ public: } explicit ObjectContents(bufferlist::iterator &bp) { - ::decode(_size, bp); - ::decode(seeds, bp); - ::decode(written, bp); - ::decode(_exists, bp); + decode(_size, bp); + decode(seeds, bp); + decode(written, bp); + decode(_exists, bp); } void clone_range(ObjectContents &other, @@ -111,10 +111,11 @@ public: } void encode(bufferlist &bl) const { - ::encode(_size, bl); - ::encode(seeds, bl); - ::encode(written, bl); - ::encode(_exists, bl); + using ceph::encode; + encode(_size, bl); + encode(seeds, bl); + encode(written, bl); + encode(_exists, bl); } }; diff --git a/src/test/common/test_bloom_filter.cc b/src/test/common/test_bloom_filter.cc index dc388c3639f9e..f556b2776e062 100644 --- a/src/test/common/test_bloom_filter.cc +++ b/src/test/common/test_bloom_filter.cc @@ -62,7 +62,7 @@ TEST(BloomFilter, Sweep) { double actual = (double)hit / (double)test; bufferlist bl; - ::encode(bf, bl); + encode(bf, bl); double byte_per_insert = (double)bl.length() / (double)max; @@ -102,7 +102,7 @@ TEST(BloomFilter, SweepInt) { double actual = (double)hit / (double)test; bufferlist bl; - ::encode(bf, bl); + encode(bf, bl); double byte_per_insert = (double)bl.length() / (double)max; @@ -145,7 +145,7 @@ TEST(BloomFilter, CompressibleSweep) { double actual = (double)hit / (double)test; bufferlist bl; - ::encode(bf, bl); + encode(bf, bl); double byte_per_insert = (double)bl.length() / (double)max; unsigned est_after = bf.approx_unique_element_count(); @@ -184,7 +184,7 @@ TEST(BloomFilter, BinSweep) { for (int j=0; jinsert(10000 * (i+1) + j); } - ::encode(*ls.front(), bl); + encode(*ls.front(), bl); } int hit = 0; diff --git a/src/test/encoding.cc b/src/test/encoding.cc index f05789af43f35..8c0025ce8f27b 100644 --- a/src/test/encoding.cc +++ b/src/test/encoding.cc @@ -165,12 +165,12 @@ public: friend void decode(ConstructorCounter &s, bufferlist::iterator& p) { - ::decode(s.data, p); + decode(s.data, p); } friend void encode(const ConstructorCounter &s, bufferlist& p) { - ::encode(s.data, p); + encode(s.data, p); } friend ostream& operator<<(ostream &oss, const ConstructorCounter &cc) diff --git a/src/test/encoding/ceph_dencoder.cc b/src/test/encoding/ceph_dencoder.cc index 3f0581cab8fe2..dd5a79202978f 100644 --- a/src/test/encoding/ceph_dencoder.cc +++ b/src/test/encoding/ceph_dencoder.cc @@ -112,7 +112,6 @@ public: bufferlist::iterator p = bl.begin(); p.seek(seek); try { - using ::decode; using ceph::decode; decode(*m_object, p); } @@ -160,7 +159,6 @@ public: : DencoderBase(stray_ok, nondeterministic) {} void encode(bufferlist& out, uint64_t features) override { out.clear(); - using ::encode; using ceph::encode; encode(*this->m_object, out); } @@ -190,10 +188,7 @@ public: DencoderImplFeaturefulNoCopy(bool stray_ok, bool nondeterministic) : DencoderBase(stray_ok, nondeterministic) {} void encode(bufferlist& out, uint64_t features) override { - using ceph::encode; - using ::encode; out.clear(); - using ::encode; using ceph::encode; encode(*(this->m_object), out, features); } diff --git a/src/test/encoding/test_ceph_time.h b/src/test/encoding/test_ceph_time.h index 722d29bf1ea14..18f89314b7ab8 100644 --- a/src/test/encoding/test_ceph_time.h +++ b/src/test/encoding/test_ceph_time.h @@ -2,7 +2,10 @@ #define TEST_CEPH_TIME_H #include + +#include "include/encoding.h" #include "common/ceph_time.h" +#include "common/Formatter.h" // wrapper for ceph::real_time that implements the dencoder interface class real_time_wrapper { @@ -12,10 +15,12 @@ class real_time_wrapper { real_time_wrapper(const ceph::real_time& t) : t(t) {} void encode(bufferlist& bl) const { - ::encode(t, bl); + using ceph::encode; + encode(t, bl); } void decode(bufferlist::iterator &p) { - ::decode(t, p); + using ceph::decode; + decode(t, p); } void dump(Formatter* f) { auto epoch_time = ceph::real_clock::to_time_t(t); diff --git a/src/test/journal/test_Entry.cc b/src/test/journal/test_Entry.cc index 49b060ecbde87..ff0e82c01f0cf 100644 --- a/src/test/journal/test_Entry.cc +++ b/src/test/journal/test_Entry.cc @@ -62,7 +62,7 @@ TEST_F(TestEntry, IsReadableBadPreamble) { uint64_t stray_bytes = 0x1122334455667788; bufferlist full_bl; - ::encode(stray_bytes, full_bl); + encode(stray_bytes, full_bl); encode(entry, full_bl); uint32_t bytes_needed; @@ -85,7 +85,7 @@ TEST_F(TestEntry, IsReadableBadCRC) { bufferlist bad_bl; bad_bl.substr_of(full_bl, 0, full_bl.length() - 4); - ::encode(full_bl.crc32c(1), bad_bl); + encode(full_bl.crc32c(1), bad_bl); uint32_t bytes_needed; ASSERT_FALSE(journal::Entry::is_readable(bad_bl.begin(), &bytes_needed)); diff --git a/src/test/journal/test_ObjectPlayer.cc b/src/test/journal/test_ObjectPlayer.cc index 661a9eb36064d..3c255c9ed6ccf 100644 --- a/src/test/journal/test_ObjectPlayer.cc +++ b/src/test/journal/test_ObjectPlayer.cc @@ -158,7 +158,7 @@ TYPED_TEST(TestObjectPlayer, FetchCorrupt) { bufferlist bl; encode(entry1, bl); - ::encode(this->create_payload("corruption"), bl); + encode(this->create_payload("corruption"), bl); encode(entry2, bl); ASSERT_EQ(0, this->append(this->get_object_name(oid), bl)); diff --git a/src/test/librados/aio.cc b/src/test/librados/aio.cc index 23b9bba109bee..d30438074b0b7 100644 --- a/src/test/librados/aio.cc +++ b/src/test/librados/aio.cc @@ -591,7 +591,7 @@ TEST(LibRadosAio, RoundTripPP3) op1.read(0, sizeof(buf), &bl, NULL); op1.set_op_flags2(LIBRADOS_OP_FLAG_FADVISE_DONTNEED|LIBRADOS_OP_FLAG_FADVISE_RANDOM); bufferlist init_value_bl; - ::encode(static_cast(-1), init_value_bl); + encode(static_cast(-1), init_value_bl); bufferlist csum_bl; op1.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, 0, 0, 0, &csum_bl, nullptr); @@ -607,9 +607,9 @@ TEST(LibRadosAio, RoundTripPP3) auto csum_bl_it = csum_bl.begin(); uint32_t csum_count; uint32_t csum; - ::decode(csum_count, csum_bl_it); + decode(csum_count, csum_bl_it); ASSERT_EQ(1U, csum_count); - ::decode(csum, csum_bl_it); + decode(csum, csum_bl_it); ASSERT_EQ(bl.crc32c(-1), csum); ioctx.remove("test_obj"); destroy_one_pool_pp(pool_name, cluster); diff --git a/src/test/librados/io.cc b/src/test/librados/io.cc index 5094f756987af..0f879fa45e180 100644 --- a/src/test/librados/io.cc +++ b/src/test/librados/io.cc @@ -326,16 +326,16 @@ TEST_F(LibRadosIoPP, Checksum) { bl.append(buf, sizeof(buf)); ASSERT_EQ(0, ioctx.write("foo", bl, sizeof(buf), 0)); bufferlist init_value_bl; - ::encode(static_cast(-1), init_value_bl); + encode(static_cast(-1), init_value_bl); bufferlist csum_bl; ASSERT_EQ(0, ioctx.checksum("foo", LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, sizeof(buf), 0, 0, &csum_bl)); auto csum_bl_it = csum_bl.begin(); uint32_t csum_count; - ::decode(csum_count, csum_bl_it); + decode(csum_count, csum_bl_it); ASSERT_EQ(1U, csum_count); uint32_t csum; - ::decode(csum, csum_bl_it); + decode(csum, csum_bl_it); ASSERT_EQ(bl.crc32c(-1), csum); } diff --git a/src/test/librados/list.cc b/src/test/librados/list.cc index db90ac80c3aa6..ab027ad0ed432 100644 --- a/src/test/librados/list.cc +++ b/src/test/librados/list.cc @@ -935,9 +935,9 @@ TEST_F(LibRadosListPP, ListObjectsFilterPP) { bufferlist filter_bl; std::string filter_name = "plain"; - ::encode(filter_name, filter_bl); - ::encode("_theattr", filter_bl); - ::encode(target_str, filter_bl); + encode(filter_name, filter_bl); + encode("_theattr", filter_bl); + encode(target_str, filter_bl); NObjectIterator iter(ioctx.nobjects_begin(filter_bl)); bool foundit = false; @@ -1230,9 +1230,9 @@ TEST_F(LibRadosListPP, EnumerateObjectsFilterPP) { bufferlist filter_bl; std::string filter_name = "plain"; - ::encode(filter_name, filter_bl); - ::encode("_theattr", filter_bl); - ::encode(target_str, filter_bl); + encode(filter_name, filter_bl); + encode("_theattr", filter_bl); + encode(target_str, filter_bl); ObjectCursor c = ioctx.object_list_begin(); ObjectCursor end = ioctx.object_list_end(); diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc index 2c957fe1b3205..a931c7d718ac4 100644 --- a/src/test/librados/misc.cc +++ b/src/test/librados/misc.cc @@ -284,13 +284,13 @@ static std::string read_key_from_tmap(IoCtx& ioctx, const std::string &obj, bufferlist::iterator p = bl.begin(); bufferlist header; map m; - ::decode(header, p); - ::decode(m, p); + decode(header, p); + decode(m, p); map::iterator i = m.find(key); if (i == m.end()) return ""; std::string retstring; - ::decode(retstring, i->second); + decode(retstring, i->second); return retstring; } @@ -300,11 +300,11 @@ static std::string add_key_to_tmap(IoCtx &ioctx, const std::string &obj, __u8 c = CEPH_OSD_TMAP_SET; bufferlist tmbl; - ::encode(c, tmbl); - ::encode(key, tmbl); + encode(c, tmbl); + encode(key, tmbl); bufferlist blbl; - ::encode(val, blbl); - ::encode(blbl, tmbl); + encode(val, blbl); + encode(blbl, tmbl); int ret = ioctx.tmap_update(obj, tmbl); if (ret) { ostringstream oss; @@ -321,8 +321,8 @@ static int remove_key_from_tmap(IoCtx &ioctx, const std::string &obj, __u8 c = CEPH_OSD_TMAP_RM; bufferlist tmbl; - ::encode(c, tmbl); - ::encode(key, tmbl); + encode(c, tmbl); + encode(key, tmbl); int ret = ioctx.tmap_update(obj, tmbl); if (ret) { ostringstream oss; @@ -340,9 +340,9 @@ TEST_F(LibRadosMiscPP, TmapUpdatePP) { bufferlist emptybl; bufferlist tmbl; - ::encode(c, tmbl); - ::encode(my_tmap, tmbl); - ::encode(emptybl, tmbl); + encode(c, tmbl); + encode(my_tmap, tmbl); + encode(emptybl, tmbl); ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl)); } @@ -369,9 +369,9 @@ TEST_F(LibRadosMiscPP, TmapUpdateMisorderedPP) { bufferlist emptybl; bufferlist tmbl; - ::encode(c, tmbl); - ::encode(my_tmap, tmbl); - ::encode(emptybl, tmbl); + encode(c, tmbl); + encode(my_tmap, tmbl); + encode(emptybl, tmbl); ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl)); } @@ -379,19 +379,19 @@ TEST_F(LibRadosMiscPP, TmapUpdateMisorderedPP) { { __u8 c = CEPH_OSD_TMAP_SET; bufferlist tmbl; - ::encode(c, tmbl); - ::encode("a", tmbl); + encode(c, tmbl); + encode("a", tmbl); bufferlist blbl; - ::encode("old", blbl); - ::encode(blbl, tmbl); + encode("old", blbl); + encode(blbl, tmbl); - ::encode(c, tmbl); - ::encode("b", tmbl); - ::encode(blbl, tmbl); + encode(c, tmbl); + encode("b", tmbl); + encode(blbl, tmbl); - ::encode(c, tmbl); - ::encode("c", tmbl); - ::encode(blbl, tmbl); + encode(c, tmbl); + encode("c", tmbl); + encode(blbl, tmbl); ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl)); } @@ -400,19 +400,19 @@ TEST_F(LibRadosMiscPP, TmapUpdateMisorderedPP) { { __u8 c = CEPH_OSD_TMAP_SET; bufferlist tmbl; - ::encode(c, tmbl); - ::encode("b", tmbl); + encode(c, tmbl); + encode("b", tmbl); bufferlist blbl; - ::encode("new", blbl); - ::encode(blbl, tmbl); + encode("new", blbl); + encode(blbl, tmbl); - ::encode(c, tmbl); - ::encode("a", tmbl); - ::encode(blbl, tmbl); + encode(c, tmbl); + encode("a", tmbl); + encode(blbl, tmbl); - ::encode(c, tmbl); - ::encode("c", tmbl); - ::encode(blbl, tmbl); + encode(c, tmbl); + encode("c", tmbl); + encode(blbl, tmbl); ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl)); } @@ -433,15 +433,15 @@ TEST_F(LibRadosMiscPP, TmapUpdateMisorderedPutPP) { // create unsorted tmap string h("header"); bufferlist bl; - ::encode(h, bl); + encode(h, bl); uint32_t n = 3; - ::encode(n, bl); - ::encode(string("b"), bl); - ::encode(string("bval"), bl); - ::encode(string("a"), bl); - ::encode(string("aval"), bl); - ::encode(string("c"), bl); - ::encode(string("cval"), bl); + encode(n, bl); + encode(string("b"), bl); + encode(string("bval"), bl); + encode(string("a"), bl); + encode(string("aval"), bl); + encode(string("c"), bl); + encode(string("cval"), bl); bufferlist orig = bl; // tmap_put steals bl content ASSERT_EQ(0, ioctx.tmap_put("foo", bl)); @@ -461,8 +461,8 @@ TEST_F(LibRadosMiscPP, Tmap2OmapPP) { omap["3"].append("c"); { bufferlist bl; - ::encode(hdr, bl); - ::encode(omap, bl); + encode(hdr, bl); + encode(omap, bl); ASSERT_EQ(0, ioctx.tmap_put("foo", bl)); } @@ -519,7 +519,7 @@ TEST_F(LibRadosMisc, Exec) { bl.append(buf2, res); bufferlist::iterator iter = bl.begin(); uint64_t all_features; - ::decode(all_features, iter); + decode(all_features, iter); // make sure *some* features are specified; don't care which ones ASSERT_NE(all_features, (unsigned)0); } @@ -532,7 +532,7 @@ TEST_F(LibRadosMiscPP, ExecPP) { ASSERT_EQ(0, r); bufferlist::iterator iter = out.begin(); uint64_t all_features; - ::decode(all_features, iter); + decode(all_features, iter); // make sure *some* features are specified; don't care which ones ASSERT_NE(all_features, (unsigned)0); } @@ -1134,7 +1134,7 @@ TYPED_TEST(LibRadosChecksum, Subset) { typename TestFixture::init_value_t init_value = -1; bufferlist init_value_bl; - ::encode(init_value, init_value_bl); + encode(init_value, init_value_bl); std::vector checksum_bls(csum_count); std::vector checksum_rvals(csum_count); @@ -1152,11 +1152,11 @@ TYPED_TEST(LibRadosChecksum, Subset) { auto bl_it = checksum_bls[i].begin(); uint32_t count; - ::decode(count, bl_it); + decode(count, bl_it); ASSERT_EQ(1U, count); typename TestFixture::value_t value; - ::decode(value, bl_it); + decode(value, bl_it); bufferlist content_sub_bl; content_sub_bl.substr_of(this->content_bl, i * chunk_size, chunk_size); @@ -1177,7 +1177,7 @@ TYPED_TEST(LibRadosChecksum, Chunked) { typename TestFixture::init_value_t init_value = -1; bufferlist init_value_bl; - ::encode(init_value, init_value_bl); + encode(init_value, init_value_bl); bufferlist checksum_bl; int checksum_rval; @@ -1191,7 +1191,7 @@ TYPED_TEST(LibRadosChecksum, Chunked) { auto bl_it = checksum_bl.begin(); uint32_t count; - ::decode(count, bl_it); + decode(count, bl_it); ASSERT_EQ(csum_count, count); std::vector expected_values(csum_count); @@ -1205,7 +1205,7 @@ TYPED_TEST(LibRadosChecksum, Chunked) { for (uint32_t i = 0; i < csum_count; ++i) { typename TestFixture::value_t value; - ::decode(value, bl_it); + decode(value, bl_it); ASSERT_EQ(expected_values[i], value); } } diff --git a/src/test/librados/tier.cc b/src/test/librados/tier.cc index cfdf6de8f8fba..f4324b2d51d4e 100644 --- a/src/test/librados/tier.cc +++ b/src/test/librados/tier.cc @@ -2368,7 +2368,7 @@ TEST_F(LibRadosTwoPoolsPP, HitSetRead) { if (hbl.length()) { bufferlist::iterator p = hbl.begin(); HitSet hs; - ::decode(hs, p); + decode(hs, p); if (hs.contains(oid)) { cout << "ok, hit_set contains " << oid << std::endl; break; @@ -2466,7 +2466,7 @@ TEST_F(LibRadosTwoPoolsPP, HitSetWrite) { try { bufferlist::iterator p = bl.begin(); - ::decode(hitsets[i], p); + decode(hitsets[i], p); } catch (buffer::error& e) { std::cout << "failed to decode hit set; bl len is " << bl.length() << "\n"; @@ -5185,7 +5185,7 @@ TEST_F(LibRadosTwoPoolsECPP, HitSetRead) { if (hbl.length()) { bufferlist::iterator p = hbl.begin(); HitSet hs; - ::decode(hs, p); + decode(hs, p); if (hs.contains(oid)) { cout << "ok, hit_set contains " << oid << std::endl; break; @@ -5250,7 +5250,7 @@ TEST_F(LibRadosTierECPP, HitSetWrite) { //std::cout << std::endl; bufferlist::iterator p = bl.begin(); - ::decode(hitsets[i], p); + decode(hitsets[i], p); // cope with racing splits by refreshing pg_num if (i == num_pg - 1) diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index a525d518ffada..4da6957680594 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -345,8 +345,8 @@ TEST_F(LibRadosWatchNotify, WatchNotify2) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(1u, reply_map.size()); ASSERT_EQ(0u, missed_map.size()); ASSERT_EQ(1u, notify_cookies.size()); @@ -396,8 +396,8 @@ TEST_F(LibRadosWatchNotify, AioWatchNotify2) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(1u, reply_map.size()); ASSERT_EQ(0u, missed_map.size()); ASSERT_EQ(1u, notify_cookies.size()); @@ -450,8 +450,8 @@ TEST_F(LibRadosWatchNotify, AioNotify) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(1u, reply_map.size()); ASSERT_EQ(0u, missed_map.size()); ASSERT_EQ(1u, notify_cookies.size()); @@ -497,8 +497,8 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2) { bufferlist::iterator p = bl_reply.begin(); std::map,bufferlist> reply_map; std::set > missed_map; - ::decode(reply_map, p); - ::decode(missed_map, p); + decode(reply_map, p); + decode(missed_map, p); ASSERT_EQ(1u, notify_cookies.size()); ASSERT_EQ(1u, notify_cookies.count(handle)); ASSERT_EQ(1u, reply_map.size()); @@ -536,8 +536,8 @@ TEST_P(LibRadosWatchNotifyPP, AioWatchNotify2) { bufferlist::iterator p = bl_reply.begin(); std::map,bufferlist> reply_map; std::set > missed_map; - ::decode(reply_map, p); - ::decode(missed_map, p); + decode(reply_map, p); + decode(missed_map, p); ASSERT_EQ(1u, notify_cookies.size()); ASSERT_EQ(1u, notify_cookies.count(handle)); ASSERT_EQ(1u, reply_map.size()); @@ -578,8 +578,8 @@ TEST_P(LibRadosWatchNotifyPP, AioNotify) { bufferlist::iterator p = bl_reply.begin(); std::map,bufferlist> reply_map; std::set > missed_map; - ::decode(reply_map, p); - ::decode(missed_map, p); + decode(reply_map, p); + decode(missed_map, p); ASSERT_EQ(1u, notify_cookies.size()); ASSERT_EQ(1u, notify_cookies.count(handle)); ASSERT_EQ(1u, reply_map.size()); @@ -622,8 +622,8 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Multi) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(2u, reply_map.size()); ASSERT_EQ(5u, reply_map.begin()->second.length()); ASSERT_EQ(0u, missed_map.size()); @@ -667,8 +667,8 @@ TEST_F(LibRadosWatchNotify, WatchNotify2Timeout) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(0u, reply_map.size()); ASSERT_EQ(1u, missed_map.size()); } @@ -759,8 +759,8 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify3) { bufferlist::iterator p = bl_reply.begin(); std::map,bufferlist> reply_map; std::set > missed_map; - ::decode(reply_map, p); - ::decode(missed_map, p); + decode(reply_map, p); + decode(missed_map, p); ASSERT_EQ(1u, notify_cookies.size()); ASSERT_EQ(1u, notify_cookies.count(handle)); ASSERT_EQ(1u, reply_map.size()); @@ -833,8 +833,8 @@ TEST_F(LibRadosWatchNotify, Watch3Timeout) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(0u, reply_map.size()); ASSERT_EQ(0u, missed_map.size()); } @@ -863,8 +863,8 @@ TEST_F(LibRadosWatchNotify, Watch3Timeout) { std::map, bufferlist> reply_map; std::set > missed_map; bufferlist::iterator reply_p = reply.begin(); - ::decode(reply_map, reply_p); - ::decode(missed_map, reply_p); + decode(reply_map, reply_p); + decode(missed_map, reply_p); ASSERT_EQ(1u, reply_map.size()); ASSERT_EQ(0u, missed_map.size()); ASSERT_EQ(1u, notify_cookies.count(handle)); diff --git a/src/test/librados_test_stub/TestIoCtxImpl.cc b/src/test/librados_test_stub/TestIoCtxImpl.cc index 56ce88690b4c4..6cfde3cdcac33 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestIoCtxImpl.cc @@ -284,20 +284,20 @@ int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) { return r; } bufferlist::iterator iter = inbl.begin(); - ::decode(tmap_header, iter); - ::decode(tmap, iter); + decode(tmap_header, iter); + decode(tmap, iter); } __u8 c; std::string key; bufferlist value; bufferlist::iterator iter = cmdbl.begin(); - ::decode(c, iter); - ::decode(key, iter); + decode(c, iter); + decode(key, iter); switch (c) { case CEPH_OSD_TMAP_SET: - ::decode(value, iter); + decode(value, iter); tmap[key] = value; break; case CEPH_OSD_TMAP_RM: @@ -311,8 +311,8 @@ int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) { } bufferlist out; - ::encode(tmap_header, out); - ::encode(tmap, out); + encode(tmap_header, out); + encode(tmap, out); r = write_full(oid, out, m_snapc); return r; } diff --git a/src/test/librados_test_stub/TestWatchNotify.cc b/src/test/librados_test_stub/TestWatchNotify.cc index 6f69092fe4e3f..492c5a8dbc86a 100644 --- a/src/test/librados_test_stub/TestWatchNotify.cc +++ b/src/test/librados_test_stub/TestWatchNotify.cc @@ -302,8 +302,8 @@ void TestWatchNotify::finish_notify(TestRadosClient *rados_client, << ": completing" << dendl; if (notify_handle->pbl != NULL) { - ::encode(notify_handle->notify_responses, *notify_handle->pbl); - ::encode(notify_handle->pending_watcher_ids, *notify_handle->pbl); + encode(notify_handle->notify_responses, *notify_handle->pbl); + encode(notify_handle->pending_watcher_ids, *notify_handle->pbl); } notify_handle->rados_client->get_aio_finisher()->queue( diff --git a/src/test/librbd/image/test_mock_CloneRequest.cc b/src/test/librbd/image/test_mock_CloneRequest.cc index 0515db7b062df..71b53e4aeda01 100644 --- a/src/test/librbd/image/test_mock_CloneRequest.cc +++ b/src/test/librbd/image/test_mock_CloneRequest.cc @@ -237,7 +237,7 @@ public: const std::map& metadata, int r) { bufferlist out_bl; - ::encode(metadata, out_bl); + encode(metadata, out_bl); EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx), exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("metadata_list"), _, _, _)) @@ -252,7 +252,7 @@ public: const std::map& metadata, int r) { bufferlist in_bl; - ::encode(metadata, in_bl); + encode(metadata, in_bl); EXPECT_CALL(get_mock_io_ctx(io_ctx), exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("metadata_set"), @@ -269,7 +269,7 @@ public: void expect_mirror_mode_get(MockTestImageCtx &mock_image_ctx, cls::rbd::MirrorMode mirror_mode, int r) { bufferlist out_bl; - ::encode(static_cast(mirror_mode), out_bl); + encode(static_cast(mirror_mode), out_bl); EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx), exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"), diff --git a/src/test/librbd/trash/test_mock_MoveRequest.cc b/src/test/librbd/trash/test_mock_MoveRequest.cc index 43a31f89092fe..e315efac38643 100644 --- a/src/test/librbd/trash/test_mock_MoveRequest.cc +++ b/src/test/librbd/trash/test_mock_MoveRequest.cc @@ -68,7 +68,7 @@ struct TestMockTrashMoveRequest : public TestMockFixture { cls::rbd::TrashImageSpec trash_image_spec; bufferlist::iterator bl_it = in_bl.begin(); - ::decode(id, bl_it); + decode(id, bl_it); decode(trash_image_spec, bl_it); EXPECT_EQ(id, image_id); @@ -91,8 +91,8 @@ struct TestMockTrashMoveRequest : public TestMockFixture { const std::string& name, const std::string& id, int r) { bufferlist in_bl; - ::encode(name, in_bl); - ::encode(id, in_bl); + encode(name, in_bl); + encode(id, in_bl); EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx), exec(StrEq("rbd_directory"), _, StrEq("rbd"), StrEq("dir_remove_image"), diff --git a/src/test/messenger/message_helper.h b/src/test/messenger/message_helper.h index bec2c685cf206..c65f42ee05a80 100644 --- a/src/test/messenger/message_helper.h +++ b/src/test/messenger/message_helper.h @@ -38,7 +38,7 @@ static inline Message* new_ping_monstyle(const char *tag, int mult) stringstream ss; f->flush(ss); - ::encode(ss.str(), bl); + encode(ss.str(), bl); m->set_payload(bl); return m; diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index ad9ca091fc694..32608de84db79 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -868,7 +868,7 @@ class SyntheticDispatcher : public Dispatcher { Payload pl; auto p = m->get_data().begin(); - ::decode(pl, p); + decode(pl, p); if (pl.who == Payload::PING) { lderr(g_ceph_context) << __func__ << " conn=" << m->get_connection() << pl << dendl; reply_message(m, pl); @@ -901,7 +901,7 @@ class SyntheticDispatcher : public Dispatcher { void reply_message(const Message *m, Payload& pl) { pl.who = Payload::PONG; bufferlist bl; - ::encode(pl, bl); + encode(pl, bl); MPing *rm = new MPing(); rm->set_data(bl); m->get_connection()->send_message(rm); @@ -912,7 +912,7 @@ class SyntheticDispatcher : public Dispatcher { Message *m = new MPing(); Payload pl{Payload::PING, index++, data}; bufferlist bl; - ::encode(pl, bl); + encode(pl, bl); m->set_data(bl); if (!con->get_messenger()->get_default_policy().lossy) { Mutex::Locker l(lock); diff --git a/src/test/objectstore/DeterministicOpSequence.cc b/src/test/objectstore/DeterministicOpSequence.cc index 772715eb4ccbe..f92a4cf8f39cc 100644 --- a/src/test/objectstore/DeterministicOpSequence.cc +++ b/src/test/objectstore/DeterministicOpSequence.cc @@ -133,7 +133,7 @@ int DeterministicOpSequence::_gen_obj_id(rngen_t& gen) void DeterministicOpSequence::note_txn(ObjectStore::Transaction *t) { bufferlist bl; - ::encode(txn, bl); + encode(txn, bl); t->truncate(txn_coll, ghobject_t(txn_object), 0); t->write(txn_coll, ghobject_t(txn_object), 0, bl.length(), bl); dout(10) << __func__ << " " << txn << dendl; @@ -448,8 +448,8 @@ void DeterministicOpSequence::_do_coll_create(coll_t cid, uint32_t pg_num, uint6 note_txn(&t); t.create_collection(cid, 32); bufferlist hint; - ::encode(pg_num, hint); - ::encode(num_objs, hint); + encode(pg_num, hint); + encode(num_objs, hint); t.collection_hint(cid, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint); dout(0) << "Give collection: " << cid << " a hint, pg_num is: " << pg_num << ", num_objs is: " << num_objs << dendl; diff --git a/src/test/objectstore/FileStoreTracker.cc b/src/test/objectstore/FileStoreTracker.cc index de0e3a7d020cf..16490ba44ad8c 100644 --- a/src/test/objectstore/FileStoreTracker.cc +++ b/src/test/objectstore/FileStoreTracker.cc @@ -51,12 +51,12 @@ int FileStoreTracker::init() restart_seq = 0; if (!got.empty()) { bufferlist::iterator bp = got.begin()->second.begin(); - ::decode(restart_seq, bp); + decode(restart_seq, bp); } ++restart_seq; KeyValueDB::Transaction t = db->get_transaction(); got.clear(); - ::encode(restart_seq, got["STATUS"]); + encode(restart_seq, got["STATUS"]); t->set("STATUS", got); db->submit_transaction(t); return 0; @@ -219,14 +219,14 @@ struct ObjStatus { } }; void encode(const ObjStatus &obj, bufferlist &bl) { - ::encode(obj.last_applied, bl); - ::encode(obj.last_committed, bl); - ::encode(obj.restart_seq, bl); + encode(obj.last_applied, bl); + encode(obj.last_committed, bl); + encode(obj.restart_seq, bl); } void decode(ObjStatus &obj, bufferlist::iterator &bl) { - ::decode(obj.last_applied, bl); - ::decode(obj.last_committed, bl); - ::decode(obj.restart_seq, bl); + decode(obj.last_applied, bl); + decode(obj.last_committed, bl); + decode(obj.restart_seq, bl); } @@ -240,7 +240,7 @@ ObjStatus get_obj_status(const pair &obj, ObjStatus retval; if (!got.empty()) { bufferlist::iterator bp = got.begin()->second.begin(); - ::decode(retval, bp); + decode(retval, bp); } return retval; } @@ -250,7 +250,7 @@ void set_obj_status(const pair &obj, KeyValueDB::Transaction t) { map to_set; - ::encode(status, to_set["META"]); + encode(status, to_set["META"]); t->set(obj_to_meta_prefix(obj), to_set); } @@ -340,7 +340,7 @@ ObjectContents FileStoreTracker::get_current_content( bufferlist bl = iter->value(); bufferlist::iterator bp = bl.begin(); pair val; - ::decode(val, bp); + decode(val, bp); assert(seq_to_key(val.first) == iter->key()); bp = val.second.begin(); return ObjectContents(bp); @@ -359,7 +359,7 @@ ObjectContents FileStoreTracker::get_content( return ObjectContents(); pair val; bufferlist::iterator bp = got.begin()->second.begin(); - ::decode(val, bp); + decode(val, bp); bp = val.second.begin(); assert(val.first == version); return ObjectContents(bp); @@ -376,7 +376,7 @@ pair FileStoreTracker::get_valid_reads( pair val; bufferlist bl = iter->value(); bufferlist::iterator bp = bl.begin(); - ::decode(val, bp); + decode(val, bp); bounds.second = val.first + 1; } @@ -436,13 +436,13 @@ uint64_t FileStoreTracker::set_content(const pair &obj, pair val; bufferlist bl = iter->value(); bufferlist::iterator bp = bl.begin(); - ::decode(val, bp); + decode(val, bp); most_recent = val.first; } bufferlist buf_content; content.encode(buf_content); map to_set; - ::encode(make_pair(most_recent + 1, buf_content), + encode(make_pair(most_recent + 1, buf_content), to_set[seq_to_key(most_recent + 1)]); t->set(obj_to_prefix(obj), to_set); db->submit_transaction(t); diff --git a/src/test/objectstore/TestObjectStoreState.cc b/src/test/objectstore/TestObjectStoreState.cc index 7eab8b3842ffa..54f4639323ab3 100644 --- a/src/test/objectstore/TestObjectStoreState.cc +++ b/src/test/objectstore/TestObjectStoreState.cc @@ -54,8 +54,8 @@ void TestObjectStoreState::init(int colls, int objs) bufferlist hint; uint32_t pg_num = colls; uint64_t num_objs = uint64_t(objs / colls); - ::encode(pg_num, hint); - ::encode(num_objs, hint); + encode(pg_num, hint); + encode(num_objs, hint); t->collection_hint(entry->m_coll, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint); dout(5) << "give collection hint, number of objects per collection: " << num_objs << dendl; t->touch(coll_t::meta(), entry->m_meta_obj); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 619298dba22df..5eb81afe020e0 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -428,7 +428,7 @@ TEST_P(StoreTest, FiemapEmpty) { store->fiemap(cid, oid, 0, 100000, bl); map m, e; bufferlist::iterator p = bl.begin(); - ::decode(m, p); + decode(m, p); cout << " got " << m << std::endl; e[0] = 100000; EXPECT_TRUE(m == e || m.empty()); @@ -467,7 +467,7 @@ TEST_P(StoreTest, FiemapHoles) { store->fiemap(cid, oid, 0, SKIP_STEP * (MAX_EXTENTS - 1) + 3, bl); map m, e; bufferlist::iterator p = bl.begin(); - ::decode(m, p); + decode(m, p); cout << " got " << m << std::endl; ASSERT_TRUE(!m.empty()); ASSERT_GE(m[0], 3u); @@ -487,7 +487,7 @@ TEST_P(StoreTest, FiemapHoles) { store->fiemap(cid, oid, SKIP_STEP, SKIP_STEP * (MAX_EXTENTS - 2) + 3, bl); map m, e; auto p = bl.begin(); - ::decode(m, p); + decode(m, p); cout << " got " << m << std::endl; ASSERT_TRUE(!m.empty()); // kstore always returns [0, object_size] regardless of offset and length @@ -612,8 +612,8 @@ TEST_P(StoreTest, SimpleColPreHashTest) { t.create_collection(cid, 5); cerr << "create collection" << std::endl; bufferlist hint; - ::encode(pg_num, hint); - ::encode(expected_num_objs, hint); + encode(pg_num, hint); + encode(expected_num_objs, hint); t.collection_hint(cid, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint); cerr << "collection hint" << std::endl; r = apply_transaction(store, &osr, std::move(t)); diff --git a/src/test/objectstore/test_idempotent_sequence.cc b/src/test/objectstore/test_idempotent_sequence.cc index c4049beb80bf4..08df9a5771cf5 100644 --- a/src/test/objectstore/test_idempotent_sequence.cc +++ b/src/test/objectstore/test_idempotent_sequence.cc @@ -118,7 +118,7 @@ int run_get_last_op(std::string& filestore_path, std::string& journal_path) int32_t txn = 0; if (bl.length()) { bufferlist::iterator p = bl.begin(); - ::decode(txn, p); + decode(txn, p); } store->umount(); diff --git a/src/test/osd/Object.cc b/src/test/osd/Object.cc index 077146573971f..a8390f7041747 100644 --- a/src/test/osd/Object.cc +++ b/src/test/osd/Object.cc @@ -11,22 +11,22 @@ void ContDesc::encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(objnum, bl); - ::encode(cursnap, bl); - ::encode(seqnum, bl); - ::encode(prefix, bl); - ::encode(oid, bl); + encode(objnum, bl); + encode(cursnap, bl); + encode(seqnum, bl); + encode(prefix, bl); + encode(oid, bl); ENCODE_FINISH(bl); } void ContDesc::decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(objnum, bl); - ::decode(cursnap, bl); - ::decode(seqnum, bl); - ::decode(prefix, bl); - ::decode(oid, bl); + decode(objnum, bl); + decode(cursnap, bl); + decode(seqnum, bl); + decode(prefix, bl); + decode(oid, bl); DECODE_FINISH(bl); } diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index d0ea5b82c5234..be496b622d668 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -848,7 +848,7 @@ public: } bufferlist contbl; - ::encode(cont, contbl); + encode(cont, contbl); pair *cb_arg = new pair( this, @@ -1027,7 +1027,7 @@ public: } bufferlist contbl; - ::encode(cont, contbl); + encode(cont, contbl); pair *cb_arg = new pair( this, @@ -1249,7 +1249,7 @@ public: &results[index], &retvals[index]); bufferlist init_value_bl; - ::encode(static_cast(-1), init_value_bl); + encode(static_cast(-1), init_value_bl); read_op.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, 0, len, 0, &checksums[index], &checksum_retvals[index]); } else { @@ -1408,7 +1408,7 @@ public: if (old_value.has_contents()) { ContDesc to_check; bufferlist::iterator p = headerbl.begin(); - ::decode(to_check, p); + decode(to_check, p); if (to_check != old_value.most_recent()) { cerr << num << ": oid " << oid << " found incorrect object contents " << to_check << ", expected " << old_value.most_recent() << std::endl; @@ -1431,8 +1431,8 @@ public: try { auto bl_it = checksums[i].begin(); uint32_t csum_count; - ::decode(csum_count, bl_it); - ::decode(checksum, bl_it); + decode(csum_count, bl_it); + decode(checksum, bl_it); } catch (const buffer::error &err) { checksum_retvals[i] = -EBADMSG; } @@ -2024,7 +2024,7 @@ public: &retvals[index]); if (index != 0) { bufferlist init_value_bl; - ::encode(static_cast(-1), init_value_bl); + encode(static_cast(-1), init_value_bl); read_op.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, offset, length, 0, &checksums[index], &checksum_retvals[index]); } @@ -2161,8 +2161,8 @@ public: try { auto bl_it = checksums[1].begin(); uint32_t csum_count; - ::decode(csum_count, bl_it); - ::decode(checksum[1], bl_it); + decode(csum_count, bl_it); + decode(checksum[1], bl_it); } catch (const buffer::error &err) { checksum_retvals[1] = -EBADMSG; } @@ -2585,7 +2585,7 @@ public: if (r == 0) { HitSet hitset; bufferlist::iterator p = bl.begin(); - ::decode(hitset, p); + decode(hitset, p); cout << num << ": got hitset of type " << hitset.get_type_name() << " size " << bl.length() << std::endl; diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index a72b07a23dd14..c0242dd77cf4a 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -2328,7 +2328,7 @@ public: object_info_t existing_info; existing_info.version = eversion_t(6, 2); bufferlist enc_oi; - ::encode(existing_info, enc_oi, 0); + encode(existing_info, enc_oi, 0); ObjectStore::Transaction t2; t2.touch(test_coll, ghobject_t(existing_oid)); t2.setattr(test_coll, ghobject_t(existing_oid), OI_ATTR, enc_oi); diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index fd21ee4f60ded..6cafff111ceb1 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -188,18 +188,18 @@ struct DummyBlock { int a = 1, b = 2, c = 3, d = 4; void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); - ::encode(a, bl); - ::encode(b, bl); - ::encode(c, bl); - ::encode(d, bl); + encode(a, bl); + encode(b, bl); + encode(c, bl); + encode(d, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); - ::decode(a, bl); - ::decode(b, bl); - ::decode(c, bl); - ::decode(d, bl); + decode(a, bl); + decode(b, bl); + decode(c, bl); + decode(d, bl); DECODE_FINISH(bl); } }; @@ -214,9 +214,9 @@ double buffer_encode_decode() for (int i = 0; i < count; i++) { bufferlist b; DummyBlock dummy_block; - ::encode(dummy_block, b); + encode(dummy_block, b); bufferlist::iterator iter = b.begin(); - ::decode(dummy_block, iter); + decode(dummy_block, iter); } uint64_t stop = Cycles::rdtsc(); return Cycles::to_seconds(stop - start)/count; @@ -261,18 +261,18 @@ double buffer_encode() for (int i = 0; i < count; i++) { bufferlist b; DummyBlock dummy_block; - ::encode(dummy_block, b); + encode(dummy_block, b); uint64_t start = Cycles::rdtsc(); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); - ::encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); + encode(dummy_block, b); total += Cycles::rdtsc() - start; } return Cycles::to_seconds(total)/(count*10); diff --git a/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc b/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc index c401e37cb3db4..d23bc4c6f6559 100644 --- a/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc +++ b/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc @@ -160,11 +160,11 @@ public: std::map&& images, int r) { bufferlist bl; - ::encode(last_image_id, bl); - ::encode(static_cast(1024), bl); + encode(last_image_id, bl); + encode(static_cast(1024), bl); bufferlist out_bl; - ::encode(images, out_bl); + encode(images, out_bl); EXPECT_CALL(get_mock_io_ctx(io_ctx), exec(RBD_TRASH, _, StrEq("rbd"), StrEq("trash_list"), diff --git a/src/test/rgw/test_rgw_common.h b/src/test/rgw/test_rgw_common.h index 5530f8b9b368e..e434ceb2273c5 100644 --- a/src/test/rgw/test_rgw_common.h +++ b/src/test/rgw/test_rgw_common.h @@ -48,41 +48,41 @@ struct old_rgw_bucket { void encode(bufferlist& bl) const { ENCODE_START(8, 3, bl); - ::encode(name, bl); - ::encode(data_pool, bl); - ::encode(marker, bl); - ::encode(bucket_id, bl); - ::encode(index_pool, bl); - ::encode(data_extra_pool, bl); - ::encode(tenant, bl); + encode(name, bl); + encode(data_pool, bl); + encode(marker, bl); + encode(bucket_id, bl); + encode(index_pool, bl); + encode(data_extra_pool, bl); + encode(tenant, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl); - ::decode(name, bl); - ::decode(data_pool, bl); + decode(name, bl); + decode(data_pool, bl); if (struct_v >= 2) { - ::decode(marker, bl); + decode(marker, bl); if (struct_v <= 3) { uint64_t id; - ::decode(id, bl); + decode(id, bl); char buf[16]; snprintf(buf, sizeof(buf), "%llu", (long long)id); bucket_id = buf; } else { - ::decode(bucket_id, bl); + decode(bucket_id, bl); } } if (struct_v >= 5) { - ::decode(index_pool, bl); + decode(index_pool, bl); } else { index_pool = data_pool; } if (struct_v >= 7) { - ::decode(data_extra_pool, bl); + decode(data_extra_pool, bl); } if (struct_v >= 8) { - ::decode(tenant, bl); + decode(tenant, bl); } DECODE_FINISH(bl); } @@ -380,27 +380,27 @@ public: void encode(bufferlist& bl) const { ENCODE_START(5, 3, bl); - ::encode(bucket.name, bl); - ::encode(loc, bl); - ::encode(ns, bl); - ::encode(object, bl); - ::encode(bucket, bl); - ::encode(instance, bl); + encode(bucket.name, bl); + encode(loc, bl); + encode(ns, bl); + encode(object, bl); + encode(bucket, bl); + encode(instance, bl); if (!ns.empty() || !instance.empty()) { - ::encode(orig_obj, bl); + encode(orig_obj, bl); } ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); - ::decode(bucket.name, bl); - ::decode(loc, bl); - ::decode(ns, bl); - ::decode(object, bl); + decode(bucket.name, bl); + decode(loc, bl); + decode(ns, bl); + decode(object, bl); if (struct_v >= 2) - ::decode(bucket, bl); + decode(bucket, bl); if (struct_v >= 4) - ::decode(instance, bl); + decode(instance, bl); if (ns.empty() && instance.empty()) { if (object[0] != '_') { orig_obj = object; @@ -409,7 +409,7 @@ public: } } else { if (struct_v >= 5) { - ::decode(orig_obj, bl); + decode(orig_obj, bl); } else { ssize_t pos = object.find('_', 1); if (pos < 0) { diff --git a/src/test/rgw/test_rgw_manifest.cc b/src/test/rgw/test_rgw_manifest.cc index 8a64efe62ad1b..e72ecc50c7705 100644 --- a/src/test/rgw/test_rgw_manifest.cc +++ b/src/test/rgw/test_rgw_manifest.cc @@ -40,17 +40,17 @@ struct OldObjManifestPart { void encode(bufferlist& bl) const { ENCODE_START(2, 2, bl); - ::encode(loc, bl); - ::encode(loc_ofs, bl); - ::encode(size, bl); + encode(loc, bl); + encode(loc_ofs, bl); + encode(size, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl); - ::decode(loc, bl); - ::decode(loc_ofs, bl); - ::decode(size, bl); + decode(loc, bl); + decode(loc_ofs, bl); + decode(size, bl); DECODE_FINISH(bl); } @@ -87,15 +87,15 @@ public: void encode(bufferlist& bl) const { ENCODE_START(2, 2, bl); - ::encode(obj_size, bl); - ::encode(objs, bl); + encode(obj_size, bl); + encode(objs, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN_32(6, 2, 2, bl); - ::decode(obj_size, bl); - ::decode(objs, bl); + decode(obj_size, bl); + decode(objs, bl); DECODE_FINISH(bl); } @@ -357,13 +357,13 @@ TEST(TestRGWManifest, old_obj_manifest) { bufferlist bl; - ::encode(old_manifest , bl); + encode(old_manifest , bl); RGWObjManifest manifest; try { auto iter = bl.begin(); - ::decode(manifest, iter); + decode(manifest, iter); } catch (buffer::error& err) { ASSERT_TRUE(false); } diff --git a/src/test/rgw/test_rgw_obj.cc b/src/test/rgw/test_rgw_obj.cc index 0a83536a5f1ac..91dfc8dc66b36 100644 --- a/src/test/rgw/test_rgw_obj.cc +++ b/src/test/rgw/test_rgw_obj.cc @@ -93,18 +93,18 @@ void test_obj(const string& name, const string& ns, const string& instance) encode_json("obj1", obj1, formatter); bufferlist bl; - ::encode(obj1, bl); + encode(obj1, bl); rgw_obj obj2; - ::decode(obj2, bl); + decode(obj2, bl); check_parsed_correctly(obj2, name, ns, instance); encode_json("obj2", obj2, formatter); rgw_obj obj3(o); bufferlist bl3; - ::encode(obj3, bl3); - ::decode(obj3, bl3); + encode(obj3, bl3); + decode(obj3, bl3); encode_json("obj3", obj3, formatter); if (!instance.empty()) { @@ -227,17 +227,17 @@ TEST(TestRGWObj, old_to_raw) { bufferlist bl; - ::encode(old, bl); + encode(old, bl); rgw_obj new_obj; rgw_raw_obj raw_obj; try { bufferlist::iterator iter = bl.begin(); - ::decode(new_obj, iter); + decode(new_obj, iter); iter = bl.begin(); - ::decode(raw_obj, iter); + decode(raw_obj, iter); } catch (buffer::error& err) { ASSERT_TRUE(false); } @@ -247,7 +247,7 @@ TEST(TestRGWObj, old_to_raw) { rgw_obj new_obj2; rgw_raw_obj raw_obj2; - ::encode(new_obj, bl); + encode(new_obj, bl); dump(f, "raw_obj", raw_obj); dump(f, "new_obj", new_obj); @@ -255,7 +255,7 @@ TEST(TestRGWObj, old_to_raw) { try { bufferlist::iterator iter = bl.begin(); - ::decode(new_obj2, iter); + decode(new_obj2, iter); /* can't decode raw obj here, because we didn't encode an old versioned @@ -263,9 +263,9 @@ TEST(TestRGWObj, old_to_raw) { */ bl.clear(); - ::encode(raw_obj, bl); + encode(raw_obj, bl); iter = bl.begin(); - ::decode(raw_obj2, iter); + decode(raw_obj2, iter); } catch (buffer::error& err) { ASSERT_TRUE(false); } diff --git a/src/test/test_denc.cc b/src/test/test_denc.cc index 6a7c4a2defee0..178f56030f117 100644 --- a/src/test/test_denc.cc +++ b/src/test/test_denc.cc @@ -29,10 +29,10 @@ template void test_encode_decode(T v) { bufferlist bl; - ::encode(v, bl); + encode(v, bl); bufferlist::iterator p = bl.begin(); T out; - ::decode(out, p); + decode(out, p); ASSERT_EQ(v, out); } @@ -66,10 +66,10 @@ void test_denc(T v) { template void test_encode_decode_featured(T v) { bufferlist bl; - ::encode(v, bl, 123); + encode(v, bl, 123); bufferlist::iterator p = bl.begin(); T out; - ::decode(out, p); + decode(out, p); ASSERT_EQ(v, out); } @@ -151,8 +151,8 @@ TEST(denc, denc_counter) denc_counter_t single, single2; { bufferlist bl; - ::encode(single, bl); - ::decode(single2, bl); + encode(single, bl); + decode(single2, bl); } ASSERT_EQ(counts.num_bound_encode, 1); ASSERT_EQ(counts.num_encode, 1); @@ -183,10 +183,12 @@ TEST(denc, string) struct legacy_t { int32_t a = 1; void encode(bufferlist& bl) const { - ::encode(a, bl); + using ceph::encode; + encode(a, bl); } void decode(bufferlist::iterator& p) { - ::decode(a, p); + using ceph::decode; + decode(a, p); } legacy_t() {} legacy_t(int32_t i) : a(i) {} @@ -243,8 +245,8 @@ TEST(denc, vector) v.resize(100); { bufferlist bl; - ::encode(v, bl); - ::decode(v2, bl); + encode(v, bl); + decode(v2, bl); } ASSERT_EQ(counts.num_bound_encode, 100); ASSERT_EQ(counts.num_encode, 100); @@ -256,8 +258,8 @@ TEST(denc, vector) v.resize(100); { bufferlist bl; - ::encode(v, bl); - ::decode(v2, bl); + encode(v, bl); + decode(v2, bl); } ASSERT_EQ(counts.num_bound_encode, 1); ASSERT_EQ(counts.num_encode, 100); @@ -279,8 +281,8 @@ TEST(denc, list) } { bufferlist bl; - ::encode(l, bl); - ::decode(l2, bl); + encode(l, bl); + decode(l2, bl); } ASSERT_EQ(counts.num_bound_encode, 1); ASSERT_EQ(counts.num_encode, 100); @@ -386,7 +388,7 @@ TEST(denc, foo) foo_t a; test_denc(a); bufferlist bl; - ::encode(a, bl); + encode(a, bl); bl.hexdump(cout); } @@ -405,11 +407,11 @@ TEST(denc, pair) { auto a = bl.get_contiguous_appender(1000); denc(p, a); - ::encode(p, bl); + encode(p, bl); } pair lp; - ::encode(lp, bl); + encode(lp, bl); } template class C> @@ -591,7 +593,8 @@ struct Legacy { } void decode(buffer::list::iterator& p) { n_decode++; - ::decode(value, p); + using ceph::decode; + decode(value, p); } static void reset() { n_denc = n_decode = 0; @@ -608,7 +611,8 @@ bufferlist Legacy::encode_n(unsigned n, const vector& segments) { v.push_back(Legacy()); } bufferlist bl(n * sizeof(uint8_t)); - ::encode(v, bl); + using ceph::encode; + encode(v, bl); bufferlist segmented; auto p = bl.begin(); @@ -639,7 +643,7 @@ TEST(denc, no_copy_if_segmented_and_lengthy) // denc() is shared by encode() and decode(), so reset() right before // decode() Legacy::reset(); - ::decode(v, p); + decode(v, p); ASSERT_EQ(N_COPIES, v.size()); ASSERT_EQ(N_COPIES, Legacy::n_denc); ASSERT_EQ(0u, Legacy::n_decode); @@ -654,7 +658,7 @@ TEST(denc, no_copy_if_segmented_and_lengthy) auto p = segmented.begin(); vector v; Legacy::reset(); - ::decode(v, p); + decode(v, p); ASSERT_EQ(N_COPIES, v.size()); ASSERT_EQ(N_COPIES, Legacy::n_denc); ASSERT_EQ(0u, Legacy::n_decode); @@ -674,7 +678,7 @@ TEST(denc, no_copy_if_segmented_and_lengthy) ASSERT_LT(segmented.length() - p.get_off(), CEPH_PAGE_SIZE); vector v; Legacy::reset(); - ::decode(v, p); + decode(v, p); ASSERT_EQ(Legacy::n_denc, 100u); ASSERT_EQ(0u, Legacy::n_decode); } @@ -692,7 +696,7 @@ TEST(denc, no_copy_if_segmented_and_lengthy) ASSERT_GT(segmented.length() - p.get_off(), CEPH_PAGE_SIZE); vector v; Legacy::reset(); - ::decode(v, p); + decode(v, p); ASSERT_EQ(0u, Legacy::n_denc); ASSERT_EQ(CEPH_PAGE_SIZE * 2, Legacy::n_decode); } diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index 20d2a629b9640..10d96aa523d35 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -389,7 +389,7 @@ TEST_F(MapCacherTest, Simple) set truth_keys; string blah("asdf"); bufferlist bl; - ::encode(blah, bl); + encode(blah, bl); truth[string("asdf")] = bl; truth_keys.insert(truth.begin()->first); { -- 2.39.5