]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: Use unqualified encode/decode
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 26 Dec 2017 21:44:14 +0000 (16:44 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 10 Jan 2018 19:03:35 +0000 (14:03 -0500)
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 <aemerson@redhat.com>
13 files changed:
src/tools/RadosDump.h
src/tools/ceph_authtool.cc
src/tools/ceph_kvstore_tool.cc
src/tools/ceph_monstore_tool.cc
src/tools/ceph_objectstore_tool.cc
src/tools/cephfs/DataScan.cc
src/tools/cephfs/Dumper.cc
src/tools/cephfs/JournalScanner.cc
src/tools/cephfs/JournalTool.cc
src/tools/cephfs/TableTool.cc
src/tools/rados/rados.cc
src/tools/radosacl.cc
src/tools/rebuild_mondb.cc

index 450ad7a7d90f5b60c71ed7d8e5a17cf34f0d9549..e27922d5a9e11d56111c7451da1fb507150cccd4 100644 (file)
@@ -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);
   }
index 5172391832e58ea733dd41acc71ccc836e0fd73b..294594d4c6b88ea32a233333b69244ab9d30afaf 100644 (file)
@@ -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;
       }
index 728b93f1e2efdce754eb0391aecb8afcc5ad2c0a..dc1188253dfbd67a0fa47692c69dd0d0a6c6eeea 100644 (file)
@@ -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()) {
index 7fbfb6c17bbcf84992e883bad64a81eab198e47c..672e4a564e8346becbf3ae77476b4cac42ce5dc8 100644 (file)
@@ -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<pg_t, pg_stat_t>::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);
index ee339cd82c796941e4fbc23a88a8b4412210e4e8..c7ef44f20dc31562f530fc36018ce26758bde686 100644 (file)
@@ -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<string,bufferlist> 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<string,bufferlist> 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;
index 760c8dc643c2dbd05f873f506bb2288b93c42c1c..0d3e3ace724ed262738b60916f3484ead586bc86 100644 (file)
@@ -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
index 9c94a7d1442c169b96e2645ff53108e994075131..2bc379b94f88a10e59fda743e62bdd28ff607fec 100644 (file)
@@ -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());
index 19f1234b0c70c162f55e189acb863e65f5c6810f..7c359a9c4355a36cb10a10324608ed0f631e6785 100644 (file)
@@ -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;
 
index 20c83acecf3d6226ab53afcd58fb32a632f520dc..b7c6609b94fc42dc502c35d6b58720dfca72fe8c 100644 (file)
@@ -287,7 +287,7 @@ int JournalTool::main_header(std::vector<const char*> &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<inodeno_t> &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<inodeno_t> &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) {
index 42aa7d29034c440e768e98505da548a875cbaf99..e4cfa8eb71d167b23051ec1141517469cdd8b5a5 100644 (file)
@@ -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);
 
index 9c6baeb75dd02881c8c1a6676e7897470920ce5f..274f514f29d66f55075deee93b59ae706b615854 100644 (file)
@@ -1373,7 +1373,7 @@ static void dump_shard(const shard_info_t& shard,
     map<std::string, ceph::bufferlist>::iterator k = (const_cast<shard_info_t&>(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<string, bufferlist> 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<string, bufferlist> 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<pair<uint64_t,uint64_t>,bufferlist> rm;
       set<pair<uint64_t,uint64_t> > missed;
       bufferlist::iterator p = replybl.begin();
-      ::decode(rm, p);
-      ::decode(missed, p);
+      decode(rm, p);
+      decode(missed, p);
       for (map<pair<uint64_t,uint64_t>,bufferlist>::iterator p = rm.begin();
           p != rm.end();
           ++p) {
index 882af2cae7e44d9da2e7309955fe869259a7a580..9e608a0812c2605535d2995d626ac111a39eae7a 100644 (file)
@@ -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);
index e9d96cfe0d494a346e94a8602aadd403db1839d0..d3c48a072b894840593683b8edda84e9b49e01dd 100644 (file)
@@ -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++;
     }