From 7597b12354aed733b8002a8cd99190f5c99cd4c4 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 26 Dec 2017 16:44:14 -0500 Subject: [PATCH] tools: 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/tools/RadosDump.h | 110 +++++++++++++++-------------- src/tools/ceph_authtool.cc | 8 +-- src/tools/ceph_kvstore_tool.cc | 2 +- src/tools/ceph_monstore_tool.cc | 30 ++++---- src/tools/ceph_objectstore_tool.cc | 24 +++---- src/tools/cephfs/DataScan.cc | 22 +++--- src/tools/cephfs/Dumper.cc | 2 +- src/tools/cephfs/JournalScanner.cc | 2 +- src/tools/cephfs/JournalTool.cc | 34 ++++----- src/tools/cephfs/TableTool.cc | 4 +- src/tools/rados/rados.cc | 24 +++---- src/tools/radosacl.cc | 6 +- src/tools/rebuild_mondb.cc | 14 ++-- 13 files changed, 143 insertions(+), 139 deletions(-) diff --git a/src/tools/RadosDump.h b/src/tools/RadosDump.h index 450ad7a7d90f5..e27922d5a9e11 100644 --- a/src/tools/RadosDump.h +++ b/src/tools/RadosDump.h @@ -67,16 +67,18 @@ struct super_header { super_header() : magic(0), version(0), header_size(0), footer_size(0) { } void encode(bufferlist& bl) const { - ::encode(magic, bl); - ::encode(version, bl); - ::encode(header_size, bl); - ::encode(footer_size, bl); + using ceph::encode; + encode(magic, bl); + encode(version, bl); + encode(header_size, bl); + encode(footer_size, bl); } void decode(bufferlist::iterator& bl) { - ::decode(magic, bl); - ::decode(version, bl); - ::decode(header_size, bl); - ::decode(footer_size, bl); + using ceph::decode; + decode(magic, bl); + decode(version, bl); + decode(header_size, bl); + decode(footer_size, bl); } }; @@ -90,16 +92,16 @@ struct header { void encode(bufferlist& bl) const { uint32_t debug_type = (type << 24) | (type << 16) | shortmagic; ENCODE_START(1, 1, bl); - ::encode(debug_type, bl); - ::encode(size, bl); + encode(debug_type, bl); + encode(size, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { uint32_t debug_type; DECODE_START(1, bl); - ::decode(debug_type, bl); + decode(debug_type, bl); type = debug_type >> 24; - ::decode(size, bl); + decode(size, bl); DECODE_FINISH(bl); } }; @@ -110,12 +112,12 @@ struct footer { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(magic, bl); + encode(magic, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); - ::decode(magic, bl); + decode(magic, bl); DECODE_FINISH(bl); } }; @@ -133,20 +135,20 @@ struct pg_begin { // shard will be NO_SHARD for a replicated pool. This means // that we allow the decode by struct_v 2. ENCODE_START(3, 2, bl); - ::encode(pgid.pgid, bl); - ::encode(superblock, bl); - ::encode(pgid.shard, bl); + encode(pgid.pgid, bl); + encode(superblock, bl); + encode(pgid.shard, bl); ENCODE_FINISH(bl); } // NOTE: New super_ver prevents decode from ver 1 void decode(bufferlist::iterator& bl) { DECODE_START(3, bl); - ::decode(pgid.pgid, bl); + decode(pgid.pgid, bl); if (struct_v > 1) { - ::decode(superblock, bl); + decode(superblock, bl); } if (struct_v > 2) { - ::decode(pgid.shard, bl); + decode(pgid.shard, bl); } else { pgid.shard = shard_id_t::NO_SHARD; } @@ -169,24 +171,24 @@ struct object_begin { // pool. This means we will allow the decode by struct_v 1. void encode(bufferlist& bl) const { ENCODE_START(3, 1, bl); - ::encode(hoid.hobj, bl); - ::encode(hoid.generation, bl); - ::encode(hoid.shard_id, bl); - ::encode(oi, bl, -1); /* FIXME: we always encode with full features */ + encode(hoid.hobj, bl); + encode(hoid.generation, bl); + encode(hoid.shard_id, bl); + encode(oi, bl, -1); /* FIXME: we always encode with full features */ ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(3, bl); - ::decode(hoid.hobj, bl); + decode(hoid.hobj, bl); if (struct_v > 1) { - ::decode(hoid.generation, bl); - ::decode(hoid.shard_id, bl); + decode(hoid.generation, bl); + decode(hoid.shard_id, bl); } else { hoid.generation = ghobject_t::NO_GEN; hoid.shard_id = shard_id_t::NO_SHARD; } if (struct_v > 2) { - ::decode(oi, bl); + decode(oi, bl); } DECODE_FINISH(bl); } @@ -202,16 +204,16 @@ struct data_section { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(offset, bl); - ::encode(len, bl); - ::encode(databl, bl); + encode(offset, bl); + encode(len, bl); + encode(databl, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); - ::decode(offset, bl); - ::decode(len, bl); - ::decode(databl, bl); + decode(offset, bl); + decode(len, bl); + decode(databl, bl); DECODE_FINISH(bl); } }; @@ -233,12 +235,12 @@ struct attr_section { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(data, bl); + encode(data, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); - ::decode(data, bl); + decode(data, bl); DECODE_FINISH(bl); } }; @@ -250,12 +252,12 @@ struct omap_hdr_section { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(hdr, bl); + encode(hdr, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); - ::decode(hdr, bl); + decode(hdr, bl); DECODE_FINISH(bl); } }; @@ -268,12 +270,12 @@ struct omap_section { void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - ::encode(omap, bl); + encode(omap, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); - ::decode(omap, bl); + decode(omap, bl); DECODE_FINISH(bl); } }; @@ -309,26 +311,26 @@ struct metadata_section { void encode(bufferlist& bl) const { ENCODE_START(6, 6, bl); - ::encode(struct_ver, bl); - ::encode(map_epoch, bl); - ::encode(info, bl); - ::encode(log, bl); - ::encode(past_intervals, bl); + encode(struct_ver, bl); + encode(map_epoch, bl); + encode(info, bl); + encode(log, bl); + encode(past_intervals, bl); // Equivalent to osdmap.encode(bl, features); but // preserving exact layout for CRC checking. bl.append(osdmap_bl); - ::encode(divergent_priors, bl); - ::encode(missing, bl); + encode(divergent_priors, bl); + encode(missing, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(6, bl); - ::decode(struct_ver, bl); - ::decode(map_epoch, bl); - ::decode(info, bl); - ::decode(log, bl); + decode(struct_ver, bl); + decode(map_epoch, bl); + decode(info, bl); + decode(log, bl); if (struct_v >= 6) { - ::decode(past_intervals, bl); + decode(past_intervals, bl); } else if (struct_v > 1) { cout << "NOTICE: Older export with classic past_intervals" << std::endl; } else { @@ -340,10 +342,10 @@ struct metadata_section { cout << "WARNING: Older export without OSDMap information" << std::endl; } if (struct_v > 3) { - ::decode(divergent_priors, bl); + decode(divergent_priors, bl); } if (struct_v > 4) { - ::decode(missing, bl); + decode(missing, bl); } DECODE_FINISH(bl); } diff --git a/src/tools/ceph_authtool.cc b/src/tools/ceph_authtool.cc index 5172391832e58..294594d4c6b88 100644 --- a/src/tools/ceph_authtool.cc +++ b/src/tools/ceph_authtool.cc @@ -104,7 +104,7 @@ int main(int argc, const char **argv) } std::string my_val = *i; ++i; - ::encode(my_val, caps[my_key]); + encode(my_val, caps[my_key]); } else if (ceph_argparse_flag(args, i, "-p", "--print-key", (char*)NULL)) { print_key = true; } else if (ceph_argparse_flag(args, i, "-C", "--create-keyring", (char*)NULL)) { @@ -181,7 +181,7 @@ int main(int argc, const char **argv) if (r >= 0) { try { bufferlist::iterator iter = bl.begin(); - ::decode(keyring, iter); + decode(keyring, iter); } catch (const buffer::error &err) { cerr << "error reading file " << fn << std::endl; exit(1); @@ -212,7 +212,7 @@ int main(int argc, const char **argv) if (r >= 0) { try { bufferlist::iterator iter = obl.begin(); - ::decode(other, iter); + decode(other, iter); } catch (const buffer::error &err) { cerr << "error reading file " << import_keyring << std::endl; exit(1); @@ -259,7 +259,7 @@ int main(int argc, const char **argv) std::string val; if (cf.read("global", key_names[i], val) == 0) { bufferlist bl; - ::encode(val, bl); + encode(val, bl); string s(key_names[i]); caps[s] = bl; } diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 728b93f1e2efd..dc1188253dfbd 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -483,7 +483,7 @@ int main(int argc, const char *argv[]) std::cerr << "error reading version: " << errstr << std::endl; return 1; } - ::encode(v, val); + encode(v, val); } else if (subcmd == "in") { int ret = val.read_file(argv[7], &errstr); if (ret < 0 || !errstr.empty()) { diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index 7fbfb6c17bbcf..672e4a564e834 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -71,10 +71,10 @@ public: } bufferlist::iterator bliter = bl.begin(); uint8_t ver, ver2; - ::decode(ver, bliter); - ::decode(ver2, bliter); + decode(ver, bliter); + decode(ver2, bliter); uint32_t len; - ::decode(len, bliter); + decode(len, bliter); r = bl.read_fd(fd, len); if (r < 0) { std::cerr << "Got error: " << cpp_strerror(r) << " on read_fd" @@ -478,7 +478,7 @@ int inflate_pgmap(MonitorDBStore& st, unsigned n, bool can_be_trimmed) { bufferlist pg_bl = i->value(); pg_stat_t ps; bufferlist::iterator p = pg_bl.begin(); - ::decode(ps, p); + decode(ps, p); // will update the last_epoch_clean of all the pgs. pg_stat[pgid] = ps; } @@ -491,17 +491,17 @@ int inflate_pgmap(MonitorDBStore& st, unsigned n, bool can_be_trimmed) { bufferlist dirty_pgs; for (ceph::unordered_map::iterator ps = pg_stat.begin(); ps != pg_stat.end(); ++ps) { - ::encode(ps->first, dirty_pgs); + encode(ps->first, dirty_pgs); if (!can_be_trimmed) { ps->second.last_epoch_clean = first; } - ::encode(ps->second, dirty_pgs); + encode(ps->second, dirty_pgs); } utime_t inc_stamp = ceph_clock_now(); - ::encode(inc_stamp, trans_bl); + encode(inc_stamp, trans_bl); ::encode_destructively(dirty_pgs, trans_bl); bufferlist dirty_osds; - ::encode(dirty_osds, trans_bl); + encode(dirty_osds, trans_bl); txn->put("pgmap", ++ver, trans_bl); // update the db in batch if (txn->size() > 1024) { @@ -529,7 +529,7 @@ static int update_auth(MonitorDBStore& st, const string& keyring_path) bufferlist bl; __u8 v = 1; - ::encode(v, bl); + encode(v, bl); for (const auto& k : keyring.get_keys()) { KeyServerData::Incremental auth_inc; @@ -543,7 +543,7 @@ static int update_auth(MonitorDBStore& st, const string& keyring_path) AuthMonitor::Incremental inc; inc.inc_type = AuthMonitor::AUTH_DATA; - ::encode(auth_inc, inc.auth_data); + encode(auth_inc, inc.auth_data); inc.auth_type = CEPH_AUTH_CEPHX; inc.encode(bl, CEPH_FEATURES_ALL); @@ -618,7 +618,7 @@ static int update_mgrmap(MonitorDBStore& st) c.set_flag(MonCommand::FLAG_MGR); } bufferlist bl; - ::encode(mgr_command_descs, bl); + encode(mgr_command_descs, bl); t->put("mgr_command_desc", "", bl); } return st.apply_transaction(t); @@ -674,7 +674,7 @@ static int update_pgmap_meta(MonitorDBStore& st) { auto stamp = ceph_clock_now(); bufferlist bl; - ::encode(stamp, bl); + encode(stamp, bl); t->put(prefix, "stamp", bl); } { @@ -688,7 +688,7 @@ static int update_pgmap_meta(MonitorDBStore& st) if (full_ratio > 1.0) full_ratio /= 100.0; bufferlist bl; - ::encode(full_ratio, bl); + encode(full_ratio, bl); t->put(prefix, "full_ratio", bl); } { @@ -696,7 +696,7 @@ static int update_pgmap_meta(MonitorDBStore& st) if (backfillfull_ratio > 1.0) backfillfull_ratio /= 100.0; bufferlist bl; - ::encode(backfillfull_ratio, bl); + encode(backfillfull_ratio, bl); t->put(prefix, "backfillfull_ratio", bl); } { @@ -704,7 +704,7 @@ static int update_pgmap_meta(MonitorDBStore& st) if (nearfull_ratio > 1.0) nearfull_ratio /= 100.0; bufferlist bl; - ::encode(nearfull_ratio, bl); + encode(nearfull_ratio, bl); t->put(prefix, "nearfull_ratio", bl); } st.apply_transaction(t); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index ee339cd82c796..c7ef44f20dc31 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -113,7 +113,7 @@ int _action_on_all_objects_in_pg(ObjectStore *store, coll_t coll, action_on_obje } bufferlist::iterator bp = attr.begin(); try { - ::decode(oi, bp); + decode(oi, bp); } catch (...) { r = -EINVAL; cerr << "Error getting attr on : " << make_pair(coll, *obj) << ", " @@ -404,7 +404,7 @@ int mark_pg_for_removal(ObjectStore *fs, spg_t pgid, ObjectStore::Transaction *t // new omap key cout << "setting '_remove' omap key" << std::endl; map values; - ::encode((char)1, values["_remove"]); + encode((char)1, values["_remove"]); t->omap_setkeys(coll, pgmeta_oid, values); return 0; } @@ -1698,7 +1698,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb, // mark this coll for removal until we're done map values; - ::encode((char)1, values["_remove"]); + encode((char)1, values["_remove"]); t.omap_setkeys(coll, pgid.make_pgmeta_oid(), values); store->apply_transaction(&osr, std::move(t)); @@ -2276,7 +2276,7 @@ struct do_fix_lost : public action_on_object_t { return 0; oi.clear_flag(object_info_t::FLAG_LOST); bufferlist bl; - ::encode(oi, bl, -1); /* fixme: using full features */ + encode(oi, bl, -1); /* fixme: using full features */ ObjectStore::Transaction t; t.setattr(coll, ghobj, OI_ATTR, bl); int r = store->apply_transaction(osr, std::move(t)); @@ -2303,7 +2303,7 @@ int get_snapset(ObjectStore *store, coll_t coll, ghobject_t &ghobj, SnapSet &ss, } bufferlist::iterator bp = attr.begin(); try { - ::decode(ss, bp); + decode(ss, bp); } catch (...) { r = -EINVAL; cerr << "Error decoding snapset on : " << make_pair(coll, ghobj) << ", " @@ -2331,7 +2331,7 @@ int print_obj_info(ObjectStore *store, coll_t coll, ghobject_t &ghobj, Formatter object_info_t oi; bufferlist::iterator bp = attr.begin(); try { - ::decode(oi, bp); + decode(oi, bp); formatter->open_object_section("info"); oi.dump(formatter); formatter->close_section(); @@ -2390,7 +2390,7 @@ int set_size(ObjectStore *store, coll_t coll, ghobject_t &ghobj, uint64_t setsiz object_info_t oi; bufferlist::iterator bp = attr.begin(); try { - ::decode(oi, bp); + decode(oi, bp); } catch (...) { r = -EINVAL; cerr << "Error getting attr on : " << make_pair(coll, ghobj) << ", " @@ -2455,12 +2455,12 @@ int set_size(ObjectStore *store, coll_t coll, ghobject_t &ghobj, uint64_t setsiz // Changing objectstore size will invalidate data_digest, so clear it. oi.clear_data_digest(); } - ::encode(oi, attr, -1); /* fixme: using full features */ + encode(oi, attr, -1); /* fixme: using full features */ t.setattr(coll, ghobj, OI_ATTR, attr); if (is_snap) { bufferlist snapattr; snapattr.clear(); - ::encode(ss, snapattr); + encode(ss, snapattr); t.setattr(coll, head, SS_ATTR, snapattr); } r = store->apply_transaction(&osr, std::move(t)); @@ -2506,7 +2506,7 @@ int clear_snapset(ObjectStore *store, coll_t coll, ghobject_t &ghobj, if (!dry_run) { bufferlist bl; - ::encode(ss, bl); + encode(ss, bl); ObjectStore::Transaction t; t.setattr(coll, ghobj, SS_ATTR, bl); int r = store->apply_transaction(&osr, std::move(t)); @@ -2604,7 +2604,7 @@ int remove_clone(ObjectStore *store, coll_t coll, ghobject_t &ghobj, snapid_t cl return 0; bufferlist bl; - ::encode(snapset, bl); + encode(snapset, bl); ObjectStore::Transaction t; t.setattr(coll, ghobj, SS_ATTR, bl); int r = store->apply_transaction(&osr, std::move(t)); @@ -3306,7 +3306,7 @@ int main(int argc, char **argv) } p = bl.begin(); - ::decode(superblock, p); + decode(superblock, p); if (debug) { cerr << "Cluster fsid=" << superblock.cluster_fsid << std::endl; diff --git a/src/tools/cephfs/DataScan.cc b/src/tools/cephfs/DataScan.cc index 760c8dc643c2d..0d3e3ace724ed 100644 --- a/src/tools/cephfs/DataScan.cc +++ b/src/tools/cephfs/DataScan.cc @@ -367,7 +367,7 @@ int MetadataDriver::inject_unlinked_inode( // Serialize bufferlist inode_bl; - ::encode(std::string(CEPH_FS_ONDISK_MAGIC), inode_bl); + encode(std::string(CEPH_FS_ONDISK_MAGIC), inode_bl); inode.encode(inode_bl, CEPH_FEATURES_SUPPORTED_DEFAULT); // Write @@ -609,7 +609,7 @@ int DataScan::forall_objects( std::string read_tag; bufferlist::iterator q = scrub_tag_bl.begin(); try { - ::decode(read_tag, q); + decode(read_tag, q); if (read_tag == filter_tag) { dout(20) << "skipping " << oid << " because it has the filter_tag" << dendl; @@ -965,9 +965,9 @@ int DataScan::scan_links() try { snapid_t dnfirst; - ::decode(dnfirst, q); + decode(dnfirst, q); char dentry_type; - ::decode(dentry_type, q); + decode(dentry_type, q); if (dentry_type == 'I') { InodeStore inode; inode.decode_bare(q); @@ -1001,8 +1001,8 @@ int DataScan::scan_links() } else if (dentry_type == 'L') { inodeno_t ino; unsigned char d_type; - ::decode(ino, q); - ::decode(d_type, q); + decode(ino, q); + decode(d_type, q); if (step == SCAN_INOS) { remote_links[ino]++; @@ -1183,7 +1183,7 @@ int DataScan::scan_frags() if (layout_r != -ENODATA) { try { bufferlist::iterator q = layout_bl.begin(); - ::decode(loaded_layout, q); + decode(loaded_layout, q); } catch (buffer::error &e) { dout(4) << "Corrupt layout on '" << oid << "': " << e << dendl; if (!force_corrupt) { @@ -1322,9 +1322,9 @@ int MetadataTool::read_dentry(inodeno_t parent_ino, frag_t frag, try { bufferlist::iterator q = vals[key].begin(); snapid_t dnfirst; - ::decode(dnfirst, q); + decode(dnfirst, q); char dentry_type; - ::decode(dentry_type, q); + decode(dentry_type, q); if (dentry_type == 'I') { inode->decode_bare(q); return 0; @@ -1766,8 +1766,8 @@ int MetadataDriver::inject_linkage( dn_key.encode(key); bufferlist dentry_bl; - ::encode(snap, dentry_bl); - ::encode('I', dentry_bl); + encode(snap, dentry_bl); + encode('I', dentry_bl); inode.encode_bare(dentry_bl, CEPH_FEATURES_SUPPORTED_DEFAULT); // Write out diff --git a/src/tools/cephfs/Dumper.cc b/src/tools/cephfs/Dumper.cc index 9c94a7d1442c1..2bc379b94f88a 100644 --- a/src/tools/cephfs/Dumper.cc +++ b/src/tools/cephfs/Dumper.cc @@ -249,7 +249,7 @@ int Dumper::undump(const char *dump_file) h.layout.pool_id = fs->mds_map.get_metadata_pool(); bufferlist hbl; - ::encode(h, hbl); + encode(h, hbl); object_t oid = file_object_t(ino, 0); object_locator_t oloc(fs->mds_map.get_metadata_pool()); diff --git a/src/tools/cephfs/JournalScanner.cc b/src/tools/cephfs/JournalScanner.cc index 19f1234b0c70c..7c359a9c4355a 100644 --- a/src/tools/cephfs/JournalScanner.cc +++ b/src/tools/cephfs/JournalScanner.cc @@ -196,7 +196,7 @@ int JournalScanner::scan_events() do { bufferlist::iterator p = read_buf.begin(); uint64_t candidate_sentinel; - ::decode(candidate_sentinel, p); + decode(candidate_sentinel, p); dout(4) << "Data at 0x" << std::hex << read_offset << " = 0x" << candidate_sentinel << std::dec << dendl; diff --git a/src/tools/cephfs/JournalTool.cc b/src/tools/cephfs/JournalTool.cc index 20c83acecf3d6..b7c6609b94fc4 100644 --- a/src/tools/cephfs/JournalTool.cc +++ b/src/tools/cephfs/JournalTool.cc @@ -287,7 +287,7 @@ int JournalTool::main_header(std::vector &argv) dout(4) << "Writing object..." << dendl; bufferlist header_bl; - ::encode(*(js.header), header_bl); + encode(*(js.header), header_bl); output.write_full(js.obj_name(0), header_bl); dout(4) << "Write complete." << dendl; std::cout << "Successfully updated header." << std::endl; @@ -766,9 +766,9 @@ int JournalTool::recover_dentries( bufferlist::iterator q = old_dentry.begin(); snapid_t dnfirst; - ::decode(dnfirst, q); + decode(dnfirst, q); char dentry_type; - ::decode(dentry_type, q); + decode(dentry_type, q); if (dentry_type == 'L') { // leave write_dentry false, we have no version to @@ -802,8 +802,8 @@ int JournalTool::recover_dentries( // Compose: Dentry format is dnfirst, [I|L], InodeStore(bare=true) bufferlist dentry_bl; - ::encode(fb.dnfirst, dentry_bl); - ::encode('I', dentry_bl); + encode(fb.dnfirst, dentry_bl); + encode('I', dentry_bl); encode_fullbit_as_inode(fb, true, &dentry_bl); // Record for writing to RADOS @@ -835,9 +835,9 @@ int JournalTool::recover_dentries( bufferlist::iterator q = old_dentry.begin(); snapid_t dnfirst; - ::decode(dnfirst, q); + decode(dnfirst, q); char dentry_type; - ::decode(dentry_type, q); + decode(dentry_type, q); if (dentry_type == 'L') { dout(10) << "Existing hardlink inode in slot to be (maybe) written " @@ -864,10 +864,10 @@ int JournalTool::recover_dentries( // Compose: Dentry format is dnfirst, [I|L], InodeStore(bare=true) bufferlist dentry_bl; - ::encode(rb.dnfirst, dentry_bl); - ::encode('L', dentry_bl); - ::encode(rb.ino, dentry_bl); - ::encode(rb.d_type, dentry_bl); + encode(rb.dnfirst, dentry_bl); + encode('L', dentry_bl); + encode(rb.ino, dentry_bl); + encode(rb.d_type, dentry_bl); // Record for writing to RADOS write_vals[key] = dentry_bl; @@ -890,9 +890,9 @@ int JournalTool::recover_dentries( bufferlist::iterator q = it->second.begin(); snapid_t dnfirst; - ::decode(dnfirst, q); + decode(dnfirst, q); char dentry_type; - ::decode(dentry_type, q); + decode(dentry_type, q); bool remove_dentry = false; if (dentry_type == 'L') { @@ -966,7 +966,7 @@ int JournalTool::recover_dentries( << ")" << dendl; bufferlist::iterator inode_bl_iter = old_root_ino_bl.begin(); std::string magic; - ::decode(magic, inode_bl_iter); + decode(magic, inode_bl_iter); if (magic == CEPH_FS_ONDISK_MAGIC) { dout(4) << "magic ok" << dendl; old_inode.decode(inode_bl_iter); @@ -990,7 +990,7 @@ int JournalTool::recover_dentries( // Compose: root ino format is magic,InodeStore(bare=false) bufferlist new_root_ino_bl; - ::encode(std::string(CEPH_FS_ONDISK_MAGIC), new_root_ino_bl); + encode(std::string(CEPH_FS_ONDISK_MAGIC), new_root_ino_bl); encode_fullbit_as_inode(fb, false, &new_root_ino_bl); // Write to RADOS @@ -1158,7 +1158,7 @@ int JournalTool::consume_inos(const std::set &inos) // Deserialize InoTable version_t inotable_ver; bufferlist::iterator q = inotable_bl.begin(); - ::decode(inotable_ver, q); + decode(inotable_ver, q); InoTable ino_table(NULL); ino_table.decode(q); @@ -1180,7 +1180,7 @@ int JournalTool::consume_inos(const std::set &inos) inotable_ver += 1; dout(4) << "writing modified inotable version " << inotable_ver << dendl; bufferlist inotable_new_bl; - ::encode(inotable_ver, inotable_new_bl); + encode(inotable_ver, inotable_new_bl); ino_table.encode_state(inotable_new_bl); int write_r = output.write_full(inotable_oid.name, inotable_new_bl); if (write_r != 0) { diff --git a/src/tools/cephfs/TableTool.cc b/src/tools/cephfs/TableTool.cc index 42aa7d29034c4..e4cfa8eb71d16 100644 --- a/src/tools/cephfs/TableTool.cc +++ b/src/tools/cephfs/TableTool.cc @@ -118,7 +118,7 @@ public: try { if (mds_table) { version_t version; - ::decode(version, q); + decode(version, q); f->dump_int("version", version); } A table_inst; @@ -155,7 +155,7 @@ protected: bufferlist new_bl; if (mds_table) { version_t version = 1; - ::encode(version, new_bl); + encode(version, new_bl); } table_inst.encode_state(new_bl); diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 9c6baeb75dd02..274f514f29d66 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -1373,7 +1373,7 @@ static void dump_shard(const shard_info_t& shard, map::iterator k = (const_cast(shard)).attrs.find(OI_ATTR); assert(k != shard.attrs.end()); // Can't be missing bufferlist::iterator bliter = k->second.begin(); - ::decode(oi, bliter); // Can't be corrupted + decode(oi, bliter); // Can't be corrupted f.dump_stream("object_info") << oi; } if (inc.has_attr_name_mismatch() || inc.has_attr_value_mismatch() @@ -1449,7 +1449,7 @@ static void dump_inconsistent(const inconsistent_obj_t& inc, auto k = shard.attrs.find(OI_ATTR); assert(k != shard.attrs.end()); // Can't be missing bufferlist::iterator bliter = k->second.begin(); - ::decode(oi, bliter); // Can't be corrupted + decode(oi, bliter); // Can't be corrupted f.dump_stream("selected_object_info") << oi; break; } @@ -2726,8 +2726,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, bufferlist header; map kv; try { - ::decode(header, p); - ::decode(kv, p); + decode(header, p); + decode(kv, p); } catch (buffer::error& e) { cerr << "error decoding tmap " << pool_name << "/" << oid << std::endl; @@ -2753,9 +2753,9 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, string v(nargs[4]); bufferlist bl; char c = (strcmp(nargs[1], "set") == 0) ? CEPH_OSD_TMAP_SET : CEPH_OSD_TMAP_CREATE; - ::encode(c, bl); - ::encode(k, bl); - ::encode(v, bl); + encode(c, bl); + encode(k, bl); + encode(v, bl); ret = io_ctx.tmap_update(oid, bl); } } @@ -2777,8 +2777,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, map kv; bufferlist::iterator p = bl.begin(); try { - ::decode(hdr, p); - ::decode(kv, p); + decode(hdr, p); + decode(kv, p); } catch (buffer::error& e) { cerr << "error decoding tmap " << pool_name << "/" << oid << std::endl; @@ -3099,7 +3099,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, string oid(nargs[1]); string msg(nargs[2]); bufferlist bl, replybl; - ::encode(msg, bl); + encode(msg, bl); ret = io_ctx.notify2(oid, bl, 10000, &replybl); if (ret != 0) cerr << "error calling notify: " << cpp_strerror(ret) << std::endl; @@ -3107,8 +3107,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, map,bufferlist> rm; set > missed; bufferlist::iterator p = replybl.begin(); - ::decode(rm, p); - ::decode(missed, p); + decode(rm, p); + decode(missed, p); for (map,bufferlist>::iterator p = rm.begin(); p != rm.end(); ++p) { diff --git a/src/tools/radosacl.cc b/src/tools/radosacl.cc index 882af2cae7e44..9e608a0812c26 100644 --- a/src/tools/radosacl.cc +++ b/src/tools/radosacl.cc @@ -66,10 +66,12 @@ class ObjectACLs { public: void encode(bufferlist& bl) const { - ::encode(acls_map, bl); + using ceph::encode; + encode(acls_map, bl); } void decode(bufferlist::iterator& bl) { - ::decode(acls_map, bl); + using ceph::decode; + decode(acls_map, bl); } int read_acl(ACLID& id, ACLFlags *flags); diff --git a/src/tools/rebuild_mondb.cc b/src/tools/rebuild_mondb.cc index e9d96cfe0d494..d3c48a072b894 100644 --- a/src/tools/rebuild_mondb.cc +++ b/src/tools/rebuild_mondb.cc @@ -46,12 +46,12 @@ static void add_auth(KeyServerData::Incremental& auth_inc, { AuthMonitor::Incremental inc; inc.inc_type = AuthMonitor::AUTH_DATA; - ::encode(auth_inc, inc.auth_data); + encode(auth_inc, inc.auth_data); inc.auth_type = CEPH_AUTH_CEPHX; bufferlist bl; __u8 v = 1; - ::encode(v, bl); + encode(v, bl); inc.encode(bl, CEPH_FEATURES_ALL); const string prefix("auth"); @@ -100,7 +100,7 @@ static int get_auth_inc(const string& keyring_path, } auto bp = bl.begin(); try { - ::decode(keyring, bp); + decode(keyring, bp); } catch (const buffer::error& e) { cerr << "error decoding keyring: " << keyring_path << std::endl; return -EINVAL; @@ -122,8 +122,8 @@ static int get_auth_inc(const string& keyring_path, // fallback to default caps for an OSD // osd 'allow *' mon 'allow rwx' // as suggested by document. - ::encode(string("allow *"), caps["osd"]); - ::encode(string("allow rwx"), caps["mon"]); + encode(string("allow *"), caps["osd"]); + encode(string("allow rwx"), caps["mon"]); } else { caps = new_inc.caps; } @@ -380,12 +380,12 @@ int update_pgmap_pg(ObjectStore& fs, MonitorDBStore& ms) if (r >= 0) { pg_stat_t pg_stat; auto bp = bl.begin(); - ::decode(pg_stat, bp); + decode(pg_stat, bp); latest_epoch = pg_stat.reported_epoch; } if (info.stats.reported_epoch > latest_epoch) { bufferlist bl; - ::encode(info.stats, bl); + encode(info.stats, bl); t->put(prefix, stringify(pgid.pgid), bl); npg++; } -- 2.39.5