]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd: Use unqualified encode/decode
authorAdam C. Emerson <aemerson@redhat.com>
Sat, 23 Dec 2017 12:28:09 +0000 (07:28 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 10 Jan 2018 19:02:09 +0000 (14:02 -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>
71 files changed:
src/librbd/ImageWatcher.cc
src/librbd/Journal.cc
src/librbd/MirroringWatcher.cc
src/librbd/TrashWatcher.cc
src/librbd/WatchNotifyTypes.cc
src/librbd/WatchNotifyTypes.h
src/librbd/image_watcher/NotifyLockOwner.cc
src/librbd/internal.cc
src/librbd/journal/CreateRequest.cc
src/librbd/journal/DemoteRequest.cc
src/librbd/journal/OpenRequest.cc
src/librbd/journal/PromoteRequest.cc
src/librbd/journal/Replay.cc
src/librbd/journal/Types.cc
src/librbd/journal/Types.h
src/librbd/journal/Utils.cc
src/librbd/mirror/DisableRequest.cc
src/librbd/mirroring_watcher/Types.cc
src/librbd/operation/RenameRequest.cc
src/librbd/trash_watcher/Types.cc
src/librbd/watcher/Notifier.cc
src/librbd/watcher/Types.cc
src/librbd/watcher/Types.h
src/librbd/watcher/Utils.h
src/test/cls_rbd/test_cls_rbd.cc
src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc
src/test/librbd/journal/test_Entries.cc
src/test/librbd/journal/test_mock_OpenRequest.cc
src/test/librbd/journal/test_mock_PromoteRequest.cc
src/test/librbd/journal/test_mock_Replay.cc
src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc
src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc
src/test/librbd/mirror/test_mock_DisableRequest.cc
src/test/librbd/object_map/test_mock_LockRequest.cc
src/test/librbd/object_map/test_mock_UpdateRequest.cc
src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc
src/test/librbd/test_ImageWatcher.cc
src/test/librbd/test_mirroring.cc
src/test/librbd/test_mock_Journal.cc
src/test/rbd_mirror/image_deleter/test_mock_RemoveRequest.cc
src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_BootstrapRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc
src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
src/test/rbd_mirror/test_ImageSync.cc
src/test/rbd_mirror/test_mock_ImageReplayer.cc
src/test/rbd_mirror/test_mock_InstanceWatcher.cc
src/test/rbd_mirror/test_mock_PoolWatcher.cc
src/tools/rbd/Utils.cc
src/tools/rbd/action/Export.cc
src/tools/rbd/action/Import.cc
src/tools/rbd/action/Journal.cc
src/tools/rbd/action/MergeDiff.cc
src/tools/rbd_mirror/ImageMap.cc
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/ImageSync.cc
src/tools/rbd_mirror/InstanceWatcher.cc
src/tools/rbd_mirror/LeaderWatcher.cc
src/tools/rbd_mirror/image_map/Types.cc
src/tools/rbd_mirror/image_map/Types.h
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc
src/tools/rbd_mirror/image_replayer/EventPreprocessor.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.cc
src/tools/rbd_mirror/image_sync/SyncPointCreateRequest.cc
src/tools/rbd_mirror/image_sync/SyncPointPruneRequest.cc
src/tools/rbd_mirror/instance_watcher/Types.cc
src/tools/rbd_mirror/leader_watcher/Types.cc

index f8ffda4a75c624719b8c78997754411df33b90ab..939eb8f73464ad4bbfc73c13b514254485ad85bc 100644 (file)
@@ -32,6 +32,9 @@ using util::create_context_callback;
 using util::create_rados_callback;
 using librbd::watcher::util::HandlePayloadVisitor;
 
+using ceph::encode;
+using ceph::decode;
+
 static const double    RETRY_DELAY_SECONDS = 1.0;
 
 template <typename I>
@@ -291,7 +294,7 @@ void ImageWatcher<I>::notify_header_update(librados::IoCtx &io_ctx,
                                           const std::string &oid) {
   // supports legacy (empty buffer) clients
   bufferlist bl;
-  ::encode(NotifyMessage(HeaderUpdatePayload()), bl);
+  encode(NotifyMessage(HeaderUpdatePayload()), bl);
   io_ctx.notify2(oid, bl, watcher::Notifier::NOTIFY_TIMEOUT, nullptr);
 }
 
@@ -441,7 +444,7 @@ void ImageWatcher<I>::notify_lock_owner(const Payload& payload,
   assert(m_image_ctx.owner_lock.is_locked());
 
   bufferlist bl;
-  ::encode(NotifyMessage(payload), bl);
+  encode(NotifyMessage(payload), bl);
 
   NotifyLockOwner *notify_lock_owner = NotifyLockOwner::create(
     m_image_ctx, this->m_notifier, std::move(bl), on_finish);
@@ -643,7 +646,7 @@ bool ImageWatcher<I>::handle_payload(const RequestLockPayload &payload,
       r = m_image_ctx.get_exclusive_lock_policy()->lock_requested(
         payload.force);
     }
-    ::encode(ResponseMessage(r), ack_ctx->out);
+    encode(ResponseMessage(r), ack_ctx->out);
   }
   return true;
 }
@@ -697,9 +700,9 @@ bool ImageWatcher<I>::handle_payload(const FlattenPayload &payload,
         m_image_ctx.operations->execute_flatten(*prog_ctx, ctx);
       }
 
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -725,9 +728,9 @@ bool ImageWatcher<I>::handle_payload(const ResizePayload &payload,
         m_image_ctx.operations->execute_resize(payload.size, payload.allow_shrink, *prog_ctx, ctx, 0);
       }
 
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -749,7 +752,7 @@ bool ImageWatcher<I>::handle_payload(const SnapCreatePayload &payload,
                                                   0, false);
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -771,7 +774,7 @@ bool ImageWatcher<I>::handle_payload(const SnapRenamePayload &payload,
                                                   new C_ResponseMessage(ack_ctx));
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -792,7 +795,7 @@ bool ImageWatcher<I>::handle_payload(const SnapRemovePayload &payload,
                                                   new C_ResponseMessage(ack_ctx));
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -813,7 +816,7 @@ bool ImageWatcher<I>::handle_payload(const SnapProtectPayload& payload,
                                                    new C_ResponseMessage(ack_ctx));
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -834,7 +837,7 @@ bool ImageWatcher<I>::handle_payload(const SnapUnprotectPayload& payload,
                                                      new C_ResponseMessage(ack_ctx));
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -859,9 +862,9 @@ bool ImageWatcher<I>::handle_payload(const RebuildObjectMapPayload& payload,
         m_image_ctx.operations->execute_rebuild_object_map(*prog_ctx, ctx);
       }
 
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -881,7 +884,7 @@ bool ImageWatcher<I>::handle_payload(const RenamePayload& payload,
                                              new C_ResponseMessage(ack_ctx));
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -903,7 +906,7 @@ bool ImageWatcher<I>::handle_payload(const UpdateFeaturesPayload& payload,
         payload.features, payload.enabled, new C_ResponseMessage(ack_ctx), 0);
       return false;
     } else if (r < 0) {
-      ::encode(ResponseMessage(r), ack_ctx->out);
+      encode(ResponseMessage(r), ack_ctx->out);
     }
   }
   return true;
@@ -916,7 +919,7 @@ bool ImageWatcher<I>::handle_payload(const UnknownPayload &payload,
   if (m_image_ctx.exclusive_lock != nullptr) {
     int r;
     if (m_image_ctx.exclusive_lock->accept_requests(&r) || r < 0) {
-      ::encode(ResponseMessage(-EOPNOTSUPP), ack_ctx->out);
+      encode(ResponseMessage(-EOPNOTSUPP), ack_ctx->out);
     }
   }
   return true;
@@ -939,7 +942,7 @@ void ImageWatcher<I>::handle_notify(uint64_t notify_id, uint64_t handle,
   } else {
     try {
       bufferlist::iterator iter = bl.begin();
-      ::decode(notify_message, iter);
+      decode(notify_message, iter);
     } catch (const buffer::error &err) {
       lderr(m_image_ctx.cct) << this << " error decoding image notification: "
                             << err.what() << dendl;
@@ -991,7 +994,7 @@ template <typename I>
 void ImageWatcher<I>::send_notify(const Payload &payload, Context *ctx) {
   bufferlist bl;
 
-  ::encode(NotifyMessage(payload), bl);
+  encode(NotifyMessage(payload), bl);
   Watcher::send_notify(bl, nullptr, ctx);
 }
 
@@ -1005,7 +1008,7 @@ void ImageWatcher<I>::C_ResponseMessage::finish(int r) {
   CephContext *cct = notify_ack->cct;
   ldout(cct, 10) << this << " C_ResponseMessage: r=" << r << dendl;
 
-  ::encode(ResponseMessage(r), notify_ack->out);
+  encode(ResponseMessage(r), notify_ack->out);
   notify_ack->complete(0);
 }
 
index aa058350448bc85383071dd99866e7fc2875c447..90cd5e08f8111d612a6224bc93bc2e8305ed6846 100644 (file)
@@ -183,7 +183,7 @@ struct GetTagsRequest {
     librbd::journal::ClientData client_data;
     bufferlist::iterator bl_it = client->data.begin();
     try {
-      ::decode(client_data, bl_it);
+      decode(client_data, bl_it);
     } catch (const buffer::error &err) {
       lderr(cct) << this << " OpenJournalerRequest::" << __func__ << ": "
                  << "failed to decode client data" << dendl;
@@ -253,7 +253,7 @@ int allocate_journaler_tag(CephContext *cct, J *journaler,
   tag_data.predecessor = predecessor;
 
   bufferlist tag_bl;
-  ::encode(tag_data, tag_bl);
+  encode(tag_data, tag_bl);
 
   C_SaferCond allocate_tag_ctx;
   journaler->allocate_tag(tag_class, tag_bl, new_tag, &allocate_tag_ctx);
@@ -483,7 +483,7 @@ int Journal<I>::request_resync(I *image_ctx) {
 
   journal::ClientData client_data(client_meta);
   bufferlist client_data_bl;
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   C_SaferCond update_client_ctx;
   journaler.update_client(client_data_bl, &update_client_ctx);
@@ -681,7 +681,7 @@ void Journal<I>::allocate_tag(const std::string &mirror_uuid,
   tag_data.predecessor = predecessor;
 
   bufferlist tag_bl;
-  ::encode(tag_data, tag_bl);
+  encode(tag_data, tag_bl);
 
   C_DecodeTag *decode_tag_ctx = new C_DecodeTag(cct, &m_lock, &m_tag_tid,
                                                 &m_tag_data, on_finish);
@@ -723,7 +723,7 @@ uint64_t Journal<I>::append_write_event(uint64_t offset, size_t length,
                                     ceph_clock_now());
 
     bufferlists.emplace_back();
-    ::encode(event_entry, bufferlists.back());
+    encode(event_entry, bufferlists.back());
 
     event_offset += event_length;
     bytes_remaining -= event_length;
@@ -740,7 +740,7 @@ uint64_t Journal<I>::append_io_event(journal::EventEntry &&event_entry,
                                      bool flush_entry, int filter_ret_val) {
   bufferlist bl;
   event_entry.timestamp = ceph_clock_now();
-  ::encode(event_entry, bl);
+  encode(event_entry, bl);
   return append_io_events(event_entry.get_event_type(), {bl}, requests, offset,
                           length, flush_entry, filter_ret_val);
 }
@@ -851,7 +851,7 @@ void Journal<I>::append_op_event(uint64_t op_tid,
 
   bufferlist bl;
   event_entry.timestamp = ceph_clock_now();
-  ::encode(event_entry, bl);
+  encode(event_entry, bl);
 
   Future future;
   {
@@ -888,7 +888,7 @@ void Journal<I>::commit_op_event(uint64_t op_tid, int r, Context *on_safe) {
                                   ceph_clock_now());
 
   bufferlist bl;
-  ::encode(event_entry, bl);
+  encode(event_entry, bl);
 
   Future op_start_future;
   Future op_finish_future;
@@ -1585,7 +1585,7 @@ int Journal<I>::check_resync_requested(bool *do_resync) {
   librbd::journal::ClientData client_data;
   bufferlist::iterator bl_it = client.data.begin();
   try {
-    ::decode(client_data, bl_it);
+    decode(client_data, bl_it);
   } catch (const buffer::error &err) {
     lderr(cct) << this << " " << __func__ << ": "
                << "failed to decode client data: " << err << dendl;
index df287506f096b725f9f7bbd5aa1a7aa933db4843..200b405f1bd985bb6ba1e2b804aa15ea12dfaa9d 100644 (file)
@@ -47,7 +47,7 @@ void MirroringWatcher<I>::notify_mode_updated(librados::IoCtx &io_ctx,
   ldout(cct, 20) << dendl;
 
   bufferlist bl;
-  ::encode(NotifyMessage{ModeUpdatedPayload{mirror_mode}}, bl);
+  encode(NotifyMessage{ModeUpdatedPayload{mirror_mode}}, bl);
 
   librados::AioCompletion *comp = create_rados_callback(on_finish);
   int r = io_ctx.aio_notify(RBD_MIRRORING, comp, bl, NOTIFY_TIMEOUT_MS,
@@ -76,7 +76,7 @@ void MirroringWatcher<I>::notify_image_updated(
   ldout(cct, 20) << dendl;
 
   bufferlist bl;
-  ::encode(NotifyMessage{ImageUpdatedPayload{
+  encode(NotifyMessage{ImageUpdatedPayload{
       mirror_image_state, image_id, global_image_id}}, bl);
 
   librados::AioCompletion *comp = create_rados_callback(on_finish);
@@ -98,7 +98,7 @@ void MirroringWatcher<I>::handle_notify(uint64_t notify_id, uint64_t handle,
   NotifyMessage notify_message;
   try {
     bufferlist::iterator iter = bl.begin();
-    ::decode(notify_message, iter);
+    decode(notify_message, iter);
   } catch (const buffer::error &err) {
     lderr(cct) << ": error decoding image notification: " << err.what()
                << dendl;
index bed93c67bcad2e99d40ead716a97617c7001c746..1d91ea4ed6a1ca8bb8b22b4a4bd661626666733f 100644 (file)
@@ -38,7 +38,7 @@ void TrashWatcher<I>::notify_image_added(
   ldout(cct, 20) << dendl;
 
   bufferlist bl;
-  ::encode(NotifyMessage{ImageAddedPayload{image_id, trash_image_spec}}, bl);
+  encode(NotifyMessage{ImageAddedPayload{image_id, trash_image_spec}}, bl);
 
   librados::AioCompletion *comp = create_rados_callback(on_finish);
   int r = io_ctx.aio_notify(RBD_TRASH, comp, bl, NOTIFY_TIMEOUT_MS, nullptr);
@@ -54,7 +54,7 @@ void TrashWatcher<I>::notify_image_removed(librados::IoCtx &io_ctx,
   ldout(cct, 20) << dendl;
 
   bufferlist bl;
-  ::encode(NotifyMessage{ImageRemovedPayload{image_id}}, bl);
+  encode(NotifyMessage{ImageRemovedPayload{image_id}}, bl);
 
   librados::AioCompletion *comp = create_rados_callback(on_finish);
   int r = io_ctx.aio_notify(RBD_TRASH, comp, bl, NOTIFY_TIMEOUT_MS, nullptr);
@@ -73,7 +73,7 @@ void TrashWatcher<I>::handle_notify(uint64_t notify_id, uint64_t handle,
   NotifyMessage notify_message;
   try {
     bufferlist::iterator iter = bl.begin();
-    ::decode(notify_message, iter);
+    decode(notify_message, iter);
   } catch (const buffer::error &err) {
     lderr(cct) << "error decoding image notification: " << err.what()
                << dendl;
index 82d2dba44dfb3bb4d462e440408b0e5f18bedaaf..915c5ac89a2d5d7cb5c157d6aabe10293c5e58aa 100644 (file)
@@ -39,13 +39,15 @@ private:
 } // anonymous namespace
 
 void AsyncRequestId::encode(bufferlist &bl) const {
-  ::encode(client_id, bl);
-  ::encode(request_id, bl);
+  using ceph::encode;
+  encode(client_id, bl);
+  encode(request_id, bl);
 }
 
 void AsyncRequestId::decode(bufferlist::iterator &iter) {
-  ::decode(client_id, iter);
-  ::decode(request_id, iter);
+  using ceph::decode;
+  decode(client_id, iter);
+  decode(request_id, iter);
 }
 
 void AsyncRequestId::dump(Formatter *f) const {
@@ -56,12 +58,14 @@ void AsyncRequestId::dump(Formatter *f) const {
 }
 
 void AcquiredLockPayload::encode(bufferlist &bl) const {
-  ::encode(client_id, bl);
+  using ceph::encode;
+  encode(client_id, bl);
 }
 
 void AcquiredLockPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   if (version >= 2) {
-    ::decode(client_id, iter);
+    decode(client_id, iter);
   }
 }
 
@@ -72,12 +76,14 @@ void AcquiredLockPayload::dump(Formatter *f) const {
 }
 
 void ReleasedLockPayload::encode(bufferlist &bl) const {
-  ::encode(client_id, bl);
+  using ceph::encode;
+  encode(client_id, bl);
 }
 
 void ReleasedLockPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   if (version >= 2) {
-    ::decode(client_id, iter);
+    decode(client_id, iter);
   }
 }
 
@@ -88,16 +94,18 @@ void ReleasedLockPayload::dump(Formatter *f) const {
 }
 
 void RequestLockPayload::encode(bufferlist &bl) const {
-  ::encode(client_id, bl);
-  ::encode(force, bl);
+  using ceph::encode;
+  encode(client_id, bl);
+  encode(force, bl);
 }
 
 void RequestLockPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   if (version >= 2) {
-    ::decode(client_id, iter);
+    decode(client_id, iter);
   }
   if (version >= 3) {
-    ::decode(force, iter);
+    decode(force, iter);
   }
 }
 
@@ -118,11 +126,13 @@ void HeaderUpdatePayload::dump(Formatter *f) const {
 }
 
 void AsyncRequestPayloadBase::encode(bufferlist &bl) const {
-  ::encode(async_request_id, bl);
+  using ceph::encode;
+  encode(async_request_id, bl);
 }
 
 void AsyncRequestPayloadBase::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(async_request_id, iter);
+  using ceph::decode;
+  decode(async_request_id, iter);
 }
 
 void AsyncRequestPayloadBase::dump(Formatter *f) const {
@@ -132,15 +142,17 @@ void AsyncRequestPayloadBase::dump(Formatter *f) const {
 }
 
 void AsyncProgressPayload::encode(bufferlist &bl) const {
+  using ceph::encode;
   AsyncRequestPayloadBase::encode(bl);
-  ::encode(offset, bl);
-  ::encode(total, bl);
+  encode(offset, bl);
+  encode(total, bl);
 }
 
 void AsyncProgressPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   AsyncRequestPayloadBase::decode(version, iter);
-  ::decode(offset, iter);
-  ::decode(total, iter);
+  decode(offset, iter);
+  decode(total, iter);
 }
 
 void AsyncProgressPayload::dump(Formatter *f) const {
@@ -150,13 +162,15 @@ void AsyncProgressPayload::dump(Formatter *f) const {
 }
 
 void AsyncCompletePayload::encode(bufferlist &bl) const {
+  using ceph::encode;
   AsyncRequestPayloadBase::encode(bl);
-  ::encode(result, bl);
+  encode(result, bl);
 }
 
 void AsyncCompletePayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   AsyncRequestPayloadBase::decode(version, iter);
-  ::decode(result, iter);
+  decode(result, iter);
 }
 
 void AsyncCompletePayload::dump(Formatter *f) const {
@@ -165,17 +179,19 @@ void AsyncCompletePayload::dump(Formatter *f) const {
 }
 
 void ResizePayload::encode(bufferlist &bl) const {
-  ::encode(size, bl);
+  using ceph::encode;
+  encode(size, bl);
   AsyncRequestPayloadBase::encode(bl);
-  ::encode(allow_shrink, bl);
+  encode(allow_shrink, bl);
 }
 
 void ResizePayload::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(size, iter);
+  using ceph::decode;
+  decode(size, iter);
   AsyncRequestPayloadBase::decode(version, iter);
 
   if (version >= 4) {
-    ::decode(allow_shrink, iter);
+    decode(allow_shrink, iter);
   }
 }
 
@@ -187,13 +203,13 @@ void ResizePayload::dump(Formatter *f) const {
 
 void SnapPayloadBase::encode(bufferlist &bl) const {
   using ceph::encode;
-  ::encode(snap_name, bl);
+  encode(snap_name, bl);
   encode(cls::rbd::SnapshotNamespaceOnDisk(snap_namespace), bl);
 }
 
 void SnapPayloadBase::decode(__u8 version, bufferlist::iterator &iter) {
   using ceph::decode;
-  ::decode(snap_name, iter);
+  decode(snap_name, iter);
   if (version >= 6) {
     cls::rbd::SnapshotNamespaceOnDisk sn;
     decode(sn, iter);
@@ -226,12 +242,14 @@ void SnapCreatePayload::dump(Formatter *f) const {
 }
 
 void SnapRenamePayload::encode(bufferlist &bl) const {
-  ::encode(snap_id, bl);
+  using ceph::encode;
+  encode(snap_id, bl);
   SnapPayloadBase::encode(bl);
 }
 
 void SnapRenamePayload::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(snap_id, iter);
+  using ceph::decode;
+  decode(snap_id, iter);
   SnapPayloadBase::decode(version, iter);
 }
 
@@ -241,11 +259,13 @@ void SnapRenamePayload::dump(Formatter *f) const {
 }
 
 void RenamePayload::encode(bufferlist &bl) const {
-  ::encode(image_name, bl);
+  using ceph::encode;
+  encode(image_name, bl);
 }
 
 void RenamePayload::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(image_name, iter);
+  using ceph::decode;
+  decode(image_name, iter);
 }
 
 void RenamePayload::dump(Formatter *f) const {
@@ -253,13 +273,15 @@ void RenamePayload::dump(Formatter *f) const {
 }
 
 void UpdateFeaturesPayload::encode(bufferlist &bl) const {
-  ::encode(features, bl);
-  ::encode(enabled, bl);
+  using ceph::encode;
+  encode(features, bl);
+  encode(enabled, bl);
 }
 
 void UpdateFeaturesPayload::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(features, iter);
-  ::decode(enabled, iter);
+  using ceph::decode;
+  decode(features, iter);
+  decode(enabled, iter);
 }
 
 void UpdateFeaturesPayload::dump(Formatter *f) const {
@@ -291,7 +313,7 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(1, iter);
 
   uint32_t notify_op;
-  ::decode(notify_op, iter);
+  decode(notify_op, iter);
 
   // select the correct payload variant based upon the encoded op
   switch (notify_op) {
@@ -377,13 +399,13 @@ void NotifyMessage::generate_test_instances(std::list<NotifyMessage *> &o) {
 
 void ResponseMessage::encode(bufferlist& bl) const {
   ENCODE_START(1, 1, bl);
-  ::encode(result, bl);
+  encode(result, bl);
   ENCODE_FINISH(bl);
 }
 
 void ResponseMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(1, iter);
-  ::decode(result, iter);
+  decode(result, iter);
   DECODE_FINISH(iter);
 }
 
@@ -395,9 +417,6 @@ void ResponseMessage::generate_test_instances(std::list<ResponseMessage *> &o) {
   o.push_back(new ResponseMessage(1));
 }
 
-} // namespace watch_notify
-} // namespace librbd
-
 std::ostream &operator<<(std::ostream &out,
                          const librbd::watch_notify::NotifyOp &op) {
   using namespace librbd::watch_notify;
@@ -464,3 +483,5 @@ std::ostream &operator<<(std::ostream &out,
       << request.request_id << "]";
   return out;
 }
+} // namespace watch_notify
+} // namespace librbd
index 7c3255f07d5a01721e6491af0cba96edfad91f4a..295b5e72ab769633303f47e711b8d0c1bfc97eae 100644 (file)
@@ -356,16 +356,17 @@ struct ResponseMessage {
   static void generate_test_instances(std::list<ResponseMessage *> &o);
 };
 
-} // namespace watch_notify
-} // namespace librbd
-
 std::ostream &operator<<(std::ostream &out,
-                         const librbd::watch_notify::NotifyOp &op);
+                         const NotifyOp &op);
 std::ostream &operator<<(std::ostream &out,
-                         const librbd::watch_notify::AsyncRequestId &request);
+                         const AsyncRequestId &request);
+
+WRITE_CLASS_ENCODER(AsyncRequestId);
+WRITE_CLASS_ENCODER(NotifyMessage);
+WRITE_CLASS_ENCODER(ResponseMessage);
+
+} // namespace watch_notify
+} // namespace librbd
 
-WRITE_CLASS_ENCODER(librbd::watch_notify::AsyncRequestId);
-WRITE_CLASS_ENCODER(librbd::watch_notify::NotifyMessage);
-WRITE_CLASS_ENCODER(librbd::watch_notify::ResponseMessage);
 
 #endif // LIBRBD_WATCH_NOTIFY_TYPES_H
index f534291200906d6b7b15cec3494813b52612eb74..5e03650bb4976d33b07a4a8b525549cbe38f016f 100644 (file)
@@ -76,7 +76,8 @@ void NotifyLockOwner::handle_notify(int r) {
     bufferlist::iterator iter = response.begin();
 
     ResponseMessage response_message;
-    ::decode(response_message, iter);
+    using ceph::decode;
+    decode(response_message, iter);
 
     r = response_message.result;
   } catch (const buffer::error &err) {
index 78aeff794387aaef1944d11cc8224d1a558b05b2..8357f58728a9ae7fc3255457d56f0e1f4ba4381f 100644 (file)
@@ -271,9 +271,9 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
   {
     bufferlist cmdbl, emptybl;
     __u8 c = CEPH_OSD_TMAP_SET;
-    ::encode(c, cmdbl);
-    ::encode(imgname, cmdbl);
-    ::encode(emptybl, cmdbl);
+    encode(c, cmdbl);
+    encode(imgname, cmdbl);
+    encode(emptybl, cmdbl);
     return io_ctx.tmap_update(RBD_DIRECTORY, cmdbl);
   }
 
@@ -281,8 +281,8 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
   {
     bufferlist cmdbl;
     __u8 c = CEPH_OSD_TMAP_RM;
-    ::encode(c, cmdbl);
-    ::encode(imgname, cmdbl);
+    encode(c, cmdbl);
+    encode(imgname, cmdbl);
     return io_ctx.tmap_update(RBD_DIRECTORY, cmdbl);
   }
 
@@ -528,8 +528,8 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
       bufferlist::iterator p = bl.begin();
       bufferlist header;
       map<string,bufferlist> m;
-      ::decode(header, p);
-      ::decode(m, p);
+      decode(header, p);
+      decode(m, p);
       for (map<string,bufferlist>::iterator q = m.begin(); q != m.end(); ++q) {
        names.push_back(q->first);
       }
index 033d992c848250b5b8c251aca6c4c19ff87c85a0..f29f0da249fde74b763aec91d88051a265ee0083 100644 (file)
@@ -112,7 +112,7 @@ void CreateRequest<I>::allocate_journal_tag() {
   using klass = CreateRequest<I>;
   Context *ctx = create_context_callback<klass, &klass::handle_journal_tag>(this);
 
-  ::encode(m_tag_data, m_bl);
+  encode(m_tag_data, m_bl);
   m_journaler->allocate_tag(m_tag_class, m_bl, &m_tag, ctx);
 }
 
@@ -135,7 +135,7 @@ void CreateRequest<I>::register_client() {
   ldout(m_cct, 20) << this << " " << __func__ << dendl;
 
   m_bl.clear();
-  ::encode(ClientData{ImageClientMeta{m_tag.tag_class}}, m_bl);
+  encode(ClientData{ImageClientMeta{m_tag.tag_class}}, m_bl);
 
   using klass = CreateRequest<I>;
   Context *ctx = create_context_callback<klass, &klass::handle_register_client>(this);
index d51f777efe94524561d7baa7f9dfd6eb1bb80f63..bef477d5645696df6de173bce4453ba63fc846d1 100644 (file)
@@ -103,7 +103,7 @@ void DemoteRequest<I>::allocate_tag() {
   tag_data.predecessor = std::move(predecessor);
 
   bufferlist tag_bl;
-  ::encode(tag_data, tag_bl);
+  encode(tag_data, tag_bl);
 
   auto ctx = create_context_callback<
     DemoteRequest<I>, &DemoteRequest<I>::handle_allocate_tag>(this);
@@ -133,7 +133,7 @@ void DemoteRequest<I>::append_event() {
 
   EventEntry event_entry{DemotePromoteEvent{}, {}};
   bufferlist event_entry_bl;
-  ::encode(event_entry, event_entry_bl);
+  encode(event_entry, event_entry_bl);
 
   m_journaler->start_append(0, 0, 0);
   m_future = m_journaler->append(m_tag_tid, event_entry_bl);
index 6dbaf6ecf8090d8e518e843cb76f7e8cff3500d6..aa6cc43a09c0d3f41894bbd2e9e0a287ed0375b2 100644 (file)
@@ -74,7 +74,7 @@ void OpenRequest<I>::handle_init(int r) {
   librbd::journal::ClientData client_data;
   bufferlist::iterator bl = client.data.begin();
   try {
-    ::decode(client_data, bl);
+    decode(client_data, bl);
   } catch (const buffer::error &err) {
     lderr(cct) << "failed to decode client meta data: " << err.what()
                << dendl;
index fb85bcb86618cd7acdc7da0384c20d191f63cd0e..17651c2fd0b5a752dc9c4a90054e1e15f33bd08b 100644 (file)
@@ -87,7 +87,7 @@ void PromoteRequest<I>::allocate_tag() {
   tag_data.predecessor = predecessor;
 
   bufferlist tag_bl;
-  ::encode(tag_data, tag_bl);
+  encode(tag_data, tag_bl);
 
   Context *ctx = create_context_callback<
     PromoteRequest<I>, &PromoteRequest<I>::handle_allocate_tag>(this);
@@ -117,7 +117,7 @@ void PromoteRequest<I>::append_event() {
 
   EventEntry event_entry{DemotePromoteEvent{}, {}};
   bufferlist event_entry_bl;
-  ::encode(event_entry, event_entry_bl);
+  encode(event_entry, event_entry_bl);
 
   m_journaler->start_append(0, 0, 0);
   m_future = m_journaler->append(m_tag_tid, event_entry_bl);
index e2e4f0e8e162bde25abdc847a30165ad6bd5352a..e71b37c58b45b2a0b650fc1fd409d5faba40ef3b 100644 (file)
@@ -189,7 +189,8 @@ Replay<I>::~Replay() {
 template <typename I>
 int Replay<I>::decode(bufferlist::iterator *it, EventEntry *event_entry) {
   try {
-    ::decode(*event_entry, *it);
+    using ceph::decode;
+    decode(*event_entry, *it);
   } catch (const buffer::error &err) {
     return -EBADMSG;
   }
index 2509780ac26e47ce11d1bb29dfb2a4437d9262f7..597c4cd4e7a53351ec98897e6d1d417ffa196216 100644 (file)
@@ -10,6 +10,9 @@
 namespace librbd {
 namespace journal {
 
+using ceph::encode;
+using ceph::decode;
+
 namespace {
 
 template <typename E>
@@ -28,7 +31,7 @@ public:
 
   template <typename T>
   inline void operator()(const T& t) const {
-    ::encode(static_cast<uint32_t>(T::TYPE), m_bl);
+    encode(static_cast<uint32_t>(T::TYPE), m_bl);
     t.encode(m_bl);
   }
 private:
@@ -69,16 +72,18 @@ private:
 } // anonymous namespace
 
 void AioDiscardEvent::encode(bufferlist& bl) const {
-  ::encode(offset, bl);
-  ::encode(length, bl);
-  ::encode(skip_partial_discard, bl);
+  using ceph::encode;
+  encode(offset, bl);
+  encode(length, bl);
+  encode(skip_partial_discard, bl);
 }
 
 void AioDiscardEvent::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(offset, it);
-  ::decode(length, it);
+  using ceph::decode;
+  decode(offset, it);
+  decode(length, it);
   if (version >= 4) {
-    ::decode(skip_partial_discard, it);
+    decode(skip_partial_discard, it);
   }
 }
 
@@ -93,15 +98,17 @@ uint32_t AioWriteEvent::get_fixed_size() {
 }
 
 void AioWriteEvent::encode(bufferlist& bl) const {
-  ::encode(offset, bl);
-  ::encode(length, bl);
-  ::encode(data, bl);
+  using ceph::encode;
+  encode(offset, bl);
+  encode(length, bl);
+  encode(data, bl);
 }
 
 void AioWriteEvent::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(offset, it);
-  ::decode(length, it);
-  ::decode(data, it);
+  using ceph::decode;
+  decode(offset, it);
+  decode(length, it);
+  decode(data, it);
 }
 
 void AioWriteEvent::dump(Formatter *f) const {
@@ -110,15 +117,17 @@ void AioWriteEvent::dump(Formatter *f) const {
 }
 
 void AioWriteSameEvent::encode(bufferlist& bl) const {
-  ::encode(offset, bl);
-  ::encode(length, bl);
-  ::encode(data, bl);
+  using ceph::encode;
+  encode(offset, bl);
+  encode(length, bl);
+  encode(data, bl);
 }
 
 void AioWriteSameEvent::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(offset, it);
-  ::decode(length, it);
-  ::decode(data, it);
+  using ceph::decode;
+  decode(offset, it);
+  decode(length, it);
+  decode(data, it);
 }
 
 void AioWriteSameEvent::dump(Formatter *f) const {
@@ -131,17 +140,19 @@ uint32_t AioCompareAndWriteEvent::get_fixed_size() {
 }
 
 void AioCompareAndWriteEvent::encode(bufferlist& bl) const {
-  ::encode(offset, bl);
-  ::encode(length, bl);
-  ::encode(cmp_data, bl);
-  ::encode(write_data, bl);
+  using ceph::encode;
+  encode(offset, bl);
+  encode(length, bl);
+  encode(cmp_data, bl);
+  encode(write_data, bl);
 }
 
 void AioCompareAndWriteEvent::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(offset, it);
-  ::decode(length, it);
-  ::decode(cmp_data, it);
-  ::decode(write_data, it);
+  using ceph::decode;
+  decode(offset, it);
+  decode(length, it);
+  decode(cmp_data, it);
+  decode(write_data, it);
 }
 
 void AioCompareAndWriteEvent::dump(Formatter *f) const {
@@ -159,11 +170,13 @@ void AioFlushEvent::dump(Formatter *f) const {
 }
 
 void OpEventBase::encode(bufferlist& bl) const {
-  ::encode(op_tid, bl);
+  using ceph::encode;
+  encode(op_tid, bl);
 }
 
 void OpEventBase::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(op_tid, it);
+  using ceph::decode;
+  decode(op_tid, it);
 }
 
 void OpEventBase::dump(Formatter *f) const {
@@ -172,14 +185,16 @@ void OpEventBase::dump(Formatter *f) const {
 
 void OpFinishEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(op_tid, bl);
-  ::encode(r, bl);
+  using ceph::encode;
+  encode(op_tid, bl);
+  encode(r, bl);
 }
 
 void OpFinishEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(op_tid, it);
-  ::decode(r, it);
+  using ceph::decode;
+  decode(op_tid, it);
+  decode(r, it);
 }
 
 void OpFinishEvent::dump(Formatter *f) const {
@@ -191,14 +206,15 @@ void OpFinishEvent::dump(Formatter *f) const {
 void SnapEventBase::encode(bufferlist& bl) const {
   using ceph::encode;
   OpEventBase::encode(bl);
-  ::encode(snap_name, bl);
+  encode(snap_name, bl);
   encode(cls::rbd::SnapshotNamespaceOnDisk(snap_namespace), bl);
 }
 
 void SnapEventBase::decode(__u8 version, bufferlist::iterator& it) {
   using ceph::decode;
   OpEventBase::decode(version, it);
-  ::decode(snap_name, it);
+  using ceph::decode;
+  decode(snap_name, it);
   if (version >= 4) {
     cls::rbd::SnapshotNamespaceOnDisk sn;
     decode(sn, it);
@@ -232,12 +248,14 @@ void SnapCreateEvent::dump(Formatter *f) const {
 
 void SnapLimitEvent::encode(bufferlist &bl) const {
   OpEventBase::encode(bl);
-  ::encode(limit, bl);
+  using ceph::encode;
+  encode(limit, bl);
 }
 
 void SnapLimitEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(limit, it);
+  using ceph::decode;
+  decode(limit, it);
 }
 
 void SnapLimitEvent::dump(Formatter *f) const {
@@ -247,17 +265,19 @@ void SnapLimitEvent::dump(Formatter *f) const {
 
 void SnapRenameEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(dst_snap_name, bl);
-  ::encode(snap_id, bl);
-  ::encode(src_snap_name, bl);
+  using ceph::encode;
+  encode(dst_snap_name, bl);
+  encode(snap_id, bl);
+  encode(src_snap_name, bl);
 }
 
 void SnapRenameEvent::decode(__u8 version, bufferlist::iterator& it) {
+  using ceph::decode;
   OpEventBase::decode(version, it);
-  ::decode(dst_snap_name, it);
-  ::decode(snap_id, it);
+  decode(dst_snap_name, it);
+  decode(snap_id, it);
   if (version >= 2) {
-    ::decode(src_snap_name, it);
+    decode(src_snap_name, it);
   }
 }
 
@@ -270,12 +290,14 @@ void SnapRenameEvent::dump(Formatter *f) const {
 
 void RenameEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(image_name, bl);
+  using ceph::encode;
+  encode(image_name, bl);
 }
 
 void RenameEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(image_name, it);
+  using ceph::decode;
+  decode(image_name, it);
 }
 
 void RenameEvent::dump(Formatter *f) const {
@@ -285,12 +307,14 @@ void RenameEvent::dump(Formatter *f) const {
 
 void ResizeEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(size, bl);
+  using ceph::encode;
+  encode(size, bl);
 }
 
 void ResizeEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(size, it);
+  using ceph::decode;
+  decode(size, it);
 }
 
 void ResizeEvent::dump(Formatter *f) const {
@@ -309,14 +333,16 @@ void DemotePromoteEvent::dump(Formatter *f) const {
 
 void UpdateFeaturesEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(features, bl);
-  ::encode(enabled, bl);
+  using ceph::encode;
+  encode(features, bl);
+  encode(enabled, bl);
 }
 
 void UpdateFeaturesEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(features, it);
-  ::decode(enabled, it);
+  using ceph::decode;
+  decode(features, it);
+  decode(enabled, it);
 }
 
 void UpdateFeaturesEvent::dump(Formatter *f) const {
@@ -327,14 +353,16 @@ void UpdateFeaturesEvent::dump(Formatter *f) const {
 
 void MetadataSetEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(key, bl);
-  ::encode(value, bl);
+  using ceph::encode;
+  encode(key, bl);
+  encode(value, bl);
 }
 
 void MetadataSetEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(key, it);
-  ::decode(value, it);
+  using ceph::decode;
+  decode(key, it);
+  decode(value, it);
 }
 
 void MetadataSetEvent::dump(Formatter *f) const {
@@ -345,12 +373,14 @@ void MetadataSetEvent::dump(Formatter *f) const {
 
 void MetadataRemoveEvent::encode(bufferlist& bl) const {
   OpEventBase::encode(bl);
-  ::encode(key, bl);
+  using ceph::encode;
+  encode(key, bl);
 }
 
 void MetadataRemoveEvent::decode(__u8 version, bufferlist::iterator& it) {
   OpEventBase::decode(version, it);
-  ::decode(key, it);
+  using ceph::decode;
+  decode(key, it);
 }
 
 void MetadataRemoveEvent::dump(Formatter *f) const {
@@ -383,7 +413,7 @@ void EventEntry::decode(bufferlist::iterator& it) {
   DECODE_START(1, it);
 
   uint32_t event_type;
-  ::decode(event_type, it);
+  decode(event_type, it);
 
   // select the correct payload variant based upon the encoded op
   switch (event_type) {
@@ -463,13 +493,13 @@ void EventEntry::dump(Formatter *f) const {
 
 void EventEntry::encode_metadata(bufferlist& bl) const {
   ENCODE_START(1, 1, bl);
-  ::encode(timestamp, bl);
+  encode(timestamp, bl);
   ENCODE_FINISH(bl);
 }
 
 void EventEntry::decode_metadata(bufferlist::iterator& it) {
   DECODE_START(1, it);
-  ::decode(timestamp, it);
+  decode(timestamp, it);
   DECODE_FINISH(it);
 }
 
@@ -528,13 +558,15 @@ void EventEntry::generate_test_instances(std::list<EventEntry *> &o) {
 // Journal Client
 
 void ImageClientMeta::encode(bufferlist& bl) const {
-  ::encode(tag_class, bl);
-  ::encode(resync_requested, bl);
+  using ceph::encode;
+  encode(tag_class, bl);
+  encode(resync_requested, bl);
 }
 
 void ImageClientMeta::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(tag_class, it);
-  ::decode(resync_requested, it);
+  using ceph::decode;
+  decode(tag_class, it);
+  decode(resync_requested, it);
 }
 
 void ImageClientMeta::dump(Formatter *f) const {
@@ -544,17 +576,17 @@ void ImageClientMeta::dump(Formatter *f) const {
 
 void MirrorPeerSyncPoint::encode(bufferlist& bl) const {
   using ceph::encode;
-  ::encode(snap_name, bl);
-  ::encode(from_snap_name, bl);
-  ::encode(object_number, bl);
+  encode(snap_name, bl);
+  encode(from_snap_name, bl);
+  encode(object_number, bl);
   encode(cls::rbd::SnapshotNamespaceOnDisk(snap_namespace), bl);
 }
 
 void MirrorPeerSyncPoint::decode(__u8 version, bufferlist::iterator& it) {
   using ceph::decode;
-  ::decode(snap_name, it);
-  ::decode(from_snap_name, it);
-  ::decode(object_number, it);
+  decode(snap_name, it);
+  decode(from_snap_name, it);
+  decode(object_number, it);
   if (version >= 2) {
     cls::rbd::SnapshotNamespaceOnDisk sn;
     decode(sn, it);
@@ -572,33 +604,35 @@ void MirrorPeerSyncPoint::dump(Formatter *f) const {
 }
 
 void MirrorPeerClientMeta::encode(bufferlist& bl) const {
-  ::encode(image_id, bl);
-  ::encode(static_cast<uint32_t>(state), bl);
-  ::encode(sync_object_count, bl);
-  ::encode(static_cast<uint32_t>(sync_points.size()), bl);
+  using ceph::encode;
+  encode(image_id, bl);
+  encode(static_cast<uint32_t>(state), bl);
+  encode(sync_object_count, bl);
+  encode(static_cast<uint32_t>(sync_points.size()), bl);
   for (auto &sync_point : sync_points) {
     sync_point.encode(bl);
   }
-  ::encode(snap_seqs, bl);
+  encode(snap_seqs, bl);
 }
 
 void MirrorPeerClientMeta::decode(__u8 version, bufferlist::iterator& it) {
-  ::decode(image_id, it);
+  using ceph::decode;
+  decode(image_id, it);
 
   uint32_t decode_state;
-  ::decode(decode_state, it);
+  decode(decode_state, it);
   state = static_cast<MirrorPeerState>(decode_state);
 
-  ::decode(sync_object_count, it);
+  decode(sync_object_count, it);
 
   uint32_t sync_point_count;
-  ::decode(sync_point_count, it);
+  decode(sync_point_count, it);
   sync_points.resize(sync_point_count);
   for (auto &sync_point : sync_points) {
     sync_point.decode(version, it);
   }
 
-  ::decode(snap_seqs, it);
+  decode(snap_seqs, it);
 }
 
 void MirrorPeerClientMeta::dump(Formatter *f) const {
@@ -655,7 +689,7 @@ void ClientData::decode(bufferlist::iterator& it) {
   DECODE_START(1, it);
 
   uint32_t client_meta_type;
-  ::decode(client_meta_type, it);
+  decode(client_meta_type, it);
 
   // select the correct payload variant based upon the encoded op
   switch (client_meta_type) {
@@ -694,17 +728,19 @@ void ClientData::generate_test_instances(std::list<ClientData *> &o) {
 // Journal Tag
 
 void TagPredecessor::encode(bufferlist& bl) const {
-  ::encode(mirror_uuid, bl);
-  ::encode(commit_valid, bl);
-  ::encode(tag_tid, bl);
-  ::encode(entry_tid, bl);
+  using ceph::encode;
+  encode(mirror_uuid, bl);
+  encode(commit_valid, bl);
+  encode(tag_tid, bl);
+  encode(entry_tid, bl);
 }
 
 void TagPredecessor::decode(bufferlist::iterator& it) {
-  ::decode(mirror_uuid, it);
-  ::decode(commit_valid, it);
-  ::decode(tag_tid, it);
-  ::decode(entry_tid, it);
+  using ceph::decode;
+  decode(mirror_uuid, it);
+  decode(commit_valid, it);
+  decode(tag_tid, it);
+  decode(entry_tid, it);
 }
 
 void TagPredecessor::dump(Formatter *f) const {
@@ -715,12 +751,14 @@ void TagPredecessor::dump(Formatter *f) const {
 }
 
 void TagData::encode(bufferlist& bl) const {
-  ::encode(mirror_uuid, bl);
+  using ceph::encode;
+  encode(mirror_uuid, bl);
   predecessor.encode(bl);
 }
 
 void TagData::decode(bufferlist::iterator& it) {
-  ::decode(mirror_uuid, it);
+  using ceph::decode;
+  decode(mirror_uuid, it);
   predecessor.decode(it);
 }
 
index 00fc2333ef591fe06472d6dff14d5940869b6665..b42c8d54ebc1baa1102f14f1e0f1cdba9a040ab7 100644 (file)
@@ -673,11 +673,11 @@ struct Listener {
   virtual void handle_resync() = 0;
 };
 
+WRITE_CLASS_ENCODER(EventEntry);
+WRITE_CLASS_ENCODER(ClientData);
+WRITE_CLASS_ENCODER(TagData);
+
 } // namespace journal
 } // namespace librbd
 
-WRITE_CLASS_ENCODER(librbd::journal::EventEntry);
-WRITE_CLASS_ENCODER(librbd::journal::ClientData);
-WRITE_CLASS_ENCODER(librbd::journal::TagData);
-
 #endif // CEPH_LIBRBD_JOURNAL_TYPES_H
index e1888f0f74f7e52e2a59fb23a5142635a6395b68..efdb17ef88b49e2b9446e1e8925af00313775ffb 100644 (file)
@@ -16,7 +16,8 @@ namespace util {
 
 int C_DecodeTag::decode(bufferlist::iterator *it, TagData *tag_data) {
   try {
-    ::decode(*tag_data, *it);
+    using ceph::decode;
+    decode(*tag_data, *it);
   } catch (const buffer::error &err) {
     return -EBADMSG;
   }
index bcbff06a452f23c0b63bf8347aa5d83769ec8c54..2d9bb371eb58a48676d977f2c9942110deffb4f7 100644 (file)
@@ -247,7 +247,8 @@ Context *DisableRequest<I>::handle_get_clients(int *result) {
     journal::ClientData client_data;
     bufferlist::iterator bl_it = client.data.begin();
     try {
-      ::decode(client_data, bl_it);
+      using ceph::decode;
+      decode(client_data, bl_it);
     } catch (const buffer::error &err) {
       lderr(cct) << "failed to decode client data" << dendl;
       m_error_result = -EBADMSG;
index 42484a6ea5282657cb54efd76d6e2c9f043cb685..ccfb4d036c1aa91d2076da66d0d37cf1d9ae4b36 100644 (file)
@@ -30,12 +30,14 @@ private:
 } // anonymous namespace
 
 void ModeUpdatedPayload::encode(bufferlist &bl) const {
-  ::encode(static_cast<uint32_t>(mirror_mode), bl);
+  using ceph::encode;
+  encode(static_cast<uint32_t>(mirror_mode), bl);
 }
 
 void ModeUpdatedPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   uint32_t mirror_mode_decode;
-  ::decode(mirror_mode_decode, iter);
+  decode(mirror_mode_decode, iter);
   mirror_mode = static_cast<cls::rbd::MirrorMode>(mirror_mode_decode);
 }
 
@@ -44,18 +46,20 @@ void ModeUpdatedPayload::dump(Formatter *f) const {
 }
 
 void ImageUpdatedPayload::encode(bufferlist &bl) const {
-  ::encode(static_cast<uint32_t>(mirror_image_state), bl);
-  ::encode(image_id, bl);
-  ::encode(global_image_id, bl);
+  using ceph::encode;
+  encode(static_cast<uint32_t>(mirror_image_state), bl);
+  encode(image_id, bl);
+  encode(global_image_id, bl);
 }
 
 void ImageUpdatedPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   uint32_t mirror_image_state_decode;
-  ::decode(mirror_image_state_decode, iter);
+  decode(mirror_image_state_decode, iter);
   mirror_image_state = static_cast<cls::rbd::MirrorImageState>(
     mirror_image_state_decode);
-  ::decode(image_id, iter);
-  ::decode(global_image_id, iter);
+  decode(image_id, iter);
+  decode(global_image_id, iter);
 }
 
 void ImageUpdatedPayload::dump(Formatter *f) const {
@@ -84,7 +88,7 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(1, iter);
 
   uint32_t notify_op;
-  ::decode(notify_op, iter);
+  decode(notify_op, iter);
 
   // select the correct payload variant based upon the encoded op
   switch (notify_op) {
index c6e6c6422d39b0b96801abb489994ba56de2c6a6..a4dbf1e52358b9ca590704a1d7b04e9143154949 100644 (file)
@@ -167,11 +167,11 @@ void RenameRequest<I>::send_update_directory() {
   if (image_ctx.old_format) {
     bufferlist cmd_bl;
     bufferlist empty_bl;
-    ::encode(static_cast<__u8>(CEPH_OSD_TMAP_SET), cmd_bl);
-    ::encode(m_dest_name, cmd_bl);
-    ::encode(empty_bl, cmd_bl);
-    ::encode(static_cast<__u8>(CEPH_OSD_TMAP_RM), cmd_bl);
-    ::encode(image_ctx.name, cmd_bl);
+    encode(static_cast<__u8>(CEPH_OSD_TMAP_SET), cmd_bl);
+    encode(m_dest_name, cmd_bl);
+    encode(empty_bl, cmd_bl);
+    encode(static_cast<__u8>(CEPH_OSD_TMAP_RM), cmd_bl);
+    encode(image_ctx.name, cmd_bl);
     op.tmap_update(cmd_bl);
   } else {
     cls_client::dir_rename_image(&op, image_ctx.name, m_dest_name,
index d03bebaee1a062a88aae63668dda74d104d48f01..3063a666ff4877c26b7a067fb548be18eb6329aa 100644 (file)
@@ -31,13 +31,13 @@ private:
 
 void ImageAddedPayload::encode(bufferlist &bl) const {
   using ceph::encode;
-  ::encode(image_id, bl);
+  encode(image_id, bl);
   encode(trash_image_spec, bl);
 }
 
 void ImageAddedPayload::decode(__u8 version, bufferlist::iterator &iter) {
   using ceph::decode;
-  ::decode(image_id, iter);
+  decode(image_id, iter);
   decode(trash_image_spec, iter);
 }
 
@@ -49,11 +49,13 @@ void ImageAddedPayload::dump(Formatter *f) const {
 }
 
 void ImageRemovedPayload::encode(bufferlist &bl) const {
-  ::encode(image_id, bl);
+  using ceph::encode;
+  encode(image_id, bl);
 }
 
 void ImageRemovedPayload::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(image_id, iter);
+  using ceph::decode;
+  decode(image_id, iter);
 }
 
 void ImageRemovedPayload::dump(Formatter *f) const {
@@ -80,7 +82,7 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(1, iter);
 
   uint32_t notify_op;
-  ::decode(notify_op, iter);
+  decode(notify_op, iter);
 
   // select the correct payload variant based upon the encoded op
   switch (notify_op) {
index 8575ec68244b86280cbf660aaa84e5a529a92eeb..fb0f07fdfa70caa0291a3dce2fbde97860c5a2d9 100644 (file)
@@ -27,7 +27,7 @@ void Notifier::C_AioNotify::finish(int r) {
     if (r == 0 || r == -ETIMEDOUT) {
       try {
         bufferlist::iterator it = out_bl.begin();
-        ::decode(*response, it);
+        decode(*response, it);
       } catch (const buffer::error &err) {
         r = -EBADMSG;
       }
index b0250f026d74f7b51a4093839845be5e57edecd8..8fca7e20dfd1680237fc02eeaf94f835a97a58fa 100644 (file)
@@ -8,13 +8,15 @@ namespace librbd {
 namespace watcher {
 
 void ClientId::encode(bufferlist &bl) const {
-  ::encode(gid, bl);
-  ::encode(handle, bl);
+  using ceph::encode;
+  encode(gid, bl);
+  encode(handle, bl);
 }
 
 void ClientId::decode(bufferlist::iterator &iter) {
-  ::decode(gid, iter);
-  ::decode(handle, iter);
+  using ceph::decode;
+  decode(gid, iter);
+  decode(handle, iter);
 }
 
 void ClientId::dump(Formatter *f) const {
@@ -22,23 +24,22 @@ void ClientId::dump(Formatter *f) const {
   f->dump_unsigned("handle", handle);
 }
 
-WRITE_CLASS_ENCODER(ClientId);
-
 void NotifyResponse::encode(bufferlist& bl) const {
-  ::encode(acks, bl);
-  ::encode(timeouts, bl);
+  using ceph::encode;
+  encode(acks, bl);
+  encode(timeouts, bl);
 }
 
 void NotifyResponse::decode(bufferlist::iterator& iter) {
-  ::decode(acks, iter);
-  ::decode(timeouts, iter);
+  using ceph::decode;
+  decode(acks, iter);
+  decode(timeouts, iter);
 }
-
-} // namespace watcher
-} // namespace librbd
-
 std::ostream &operator<<(std::ostream &out,
-                         const librbd::watcher::ClientId &client_id) {
+                         const ClientId &client_id) {
   out << "[" << client_id.gid << "," << client_id.handle << "]";
   return out;
 }
+
+} // namespace watcher
+} // namespace librbd
index e7886f6cad5e77869939528ec7b4a49c8e91cbd6..1b2c90bb56abeb2c5cc6ae60eb038f4ab908c6a6 100644 (file)
@@ -59,13 +59,13 @@ struct Traits {
   typedef librbd::Watcher Watcher;
 };
 
-} // namespace watcher
-} // namespace librbd
-
 std::ostream &operator<<(std::ostream &out,
-                         const librbd::watcher::ClientId &client);
+                         const ClientId &client);
 
-WRITE_CLASS_ENCODER(librbd::watcher::ClientId);
-WRITE_CLASS_ENCODER(librbd::watcher::NotifyResponse);
+WRITE_CLASS_ENCODER(ClientId);
+WRITE_CLASS_ENCODER(NotifyResponse);
+
+} // namespace watcher
+} // namespace librbd
 
 #endif // CEPH_LIBRBD_WATCHER_TYPES_H
index 78966d6a58a1be25fe6ddfc0c5c9df339468dcf0..92a16e6b65e7e4f450d6b45be3e92147f8f8dc42 100644 (file)
@@ -43,7 +43,8 @@ public:
 
   template <typename P>
   inline void operator()(const P &payload) const {
-    ::encode(static_cast<uint32_t>(P::NOTIFY_OP), m_bl);
+    using ceph::encode;
+    encode(static_cast<uint32_t>(P::NOTIFY_OP), m_bl);
     payload.encode(m_bl);
   }
 
index ce01a516ee34c16bcbfcef9f1cad04e19146a339..e5626412f906dec6dd9e34bc10de17afdb3fbb87 100644 (file)
@@ -26,6 +26,8 @@ using namespace std;
 using namespace librbd::cls_client;
 using ::librbd::ParentInfo;
 using ::librbd::ParentSpec;
+using ceph::encode;
+using ceph::decode;
 
 static int snapshot_add(librados::IoCtx *ioctx, const std::string &oid,
                         uint64_t snap_id, const std::string &snap_name) {
index 09c266c0e5c9fd4553bcd6d1d33e04973a7a482b..8717f684a8ed2fe21efc46e8376673207e98913d 100644 (file)
@@ -63,7 +63,7 @@ public:
   void expect_metadata_list(librbd::MockTestImageCtx &mock_image_ctx,
                             const Metadata& 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"),
@@ -75,7 +75,7 @@ public:
   void expect_metadata_set(librbd::MockTestImageCtx &mock_image_ctx,
                            const Metadata& metadata, int r) {
     bufferlist in_bl;
-    ::encode(metadata, in_bl);
+    encode(metadata, in_bl);
 
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
                 exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
index 54be1487faed851a2472e30aa7566ab1b57e7e88..936aad44dd0fa66c84148c69e35bc075c2f6c96e 100644 (file)
@@ -107,7 +107,7 @@ public:
     try {
       bufferlist data_bl = replay_entry.get_data();
       bufferlist::iterator it = data_bl.begin();
-      ::decode(*event_entry, it);
+      decode(*event_entry, it);
     } catch (const buffer::error &err) {
       return false;
     }
index 422c907874f530e312a272b7a199d37d89737d72..155c5fd5d805601efeece8f2bab8bac0763d6bbb 100644 (file)
@@ -66,7 +66,7 @@ public:
     client_data.client_meta = image_client_meta;
 
     cls::journal::Client client;
-    ::encode(client_data, client.data);
+    encode(client_data, client.data);
 
     EXPECT_CALL(mock_journaler, get_cached_client("", _))
                   .WillOnce(DoAll(SetArgPointee<1>(client),
@@ -80,7 +80,7 @@ public:
     tag_data.mirror_uuid = "remote mirror";
 
     bufferlist tag_data_bl;
-    ::encode(tag_data, tag_data_bl);
+    encode(tag_data, tag_data_bl);
 
     ::journal::Journaler::Tags tags = {{0, 345, {}}, {1, 345, tag_data_bl}};
     EXPECT_CALL(mock_journaler, get_tags(345, _, _))
index 209249955b155a9ff18aa8be3c63b60afb22de75..775a1463655aeed2cec3bdc4964dff021f37431b 100644 (file)
@@ -91,7 +91,8 @@ public:
     tag_data.predecessor = predecessor;
 
     bufferlist tag_data_bl;
-    ::encode(tag_data, tag_data_bl);
+    using ceph::encode;
+    encode(tag_data, tag_data_bl);
 
     EXPECT_CALL(mock_journaler, allocate_tag(456, ContentsEqual(tag_data_bl),
                                              _, _))
index e318cc3916b596f4abfdc36e2d605eda7c11d181..914f4552a0f8a4b0a38db1995175f1adeee287dd 100644 (file)
@@ -292,7 +292,7 @@ public:
                     EventEntry &&event_entry, Context *on_ready,
                     Context *on_safe) {
     bufferlist bl;
-    ::encode(event_entry, bl);
+    encode(event_entry, bl);
 
     bufferlist::iterator it = bl.begin();
     when_process(mock_journal_replay, &it, on_ready, on_safe);
@@ -1812,7 +1812,7 @@ TEST_F(TestMockJournalReplay, UnknownEvent) {
 
   bufferlist bl;
   ENCODE_START(1, 1, bl);
-  ::encode(static_cast<uint32_t>(-1), bl);
+  encode(static_cast<uint32_t>(-1), bl);
   ENCODE_FINISH(bl);
 
   bufferlist::iterator it = bl.begin();
index 32ecc747ad1e0a933ed3120e8f587db6c8010429..bb83a1de711716a0f0e7ebc4da058e7c32056976 100644 (file)
@@ -89,7 +89,7 @@ MATCHER_P(IsLockType, exclusive, "") {
   bufferlist bl;
   bl.share(arg);
   bufferlist::iterator iter = bl.begin();
-  ::decode(op, iter);
+  decode(op, iter);
   return op.type == (exclusive ? LOCK_EXCLUSIVE : LOCK_SHARED);
 }
 
index c339427106fb4f246dc67da6960279652a674303..627de21cd8feef9a96472328e344c622e03980f3 100644 (file)
@@ -70,7 +70,7 @@ public:
       }
 
       bufferlist bl;
-      ::encode(reply, bl, CEPH_FEATURES_SUPPORTED_DEFAULT);
+      encode(reply, bl, CEPH_FEATURES_SUPPORTED_DEFAULT);
 
       std::string str(bl.c_str(), bl.length());
       expect.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(str)), Return(0)));
index 76bac7d1474f86f4dbc3997a676565595a84ca25..abb4a977057e3d070cb61869a1071858e51ae40e 100644 (file)
@@ -23,7 +23,7 @@ MATCHER_P(IsLockType, exclusive, "") {
   bufferlist bl;
   bl.share(arg);
   bufferlist::iterator iter = bl.begin();
-  ::decode(op, iter);
+  decode(op, iter);
   return op.type == (exclusive ? LOCK_EXCLUSIVE : LOCK_SHARED);
 }
 
index 65f7620d110801e23873f4b228290bb7d456db34..df5a9c3e76c6fbe2be973d821c2fb5af0afddf0a 100644 (file)
@@ -163,7 +163,8 @@ public:
                                   const std::set<cls::journal::Client> &clients,
                                   int r) {
     bufferlist bl;
-    ::encode(clients, bl);
+    using ceph::encode;
+    encode(clients, bl);
 
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
                 exec(::journal::Journaler::header_oid(mock_image_ctx.id),
@@ -176,7 +177,8 @@ public:
                                         const std::string &client_id,
                                         int r) {
     bufferlist bl;
-    ::encode(client_id, bl);
+    using ceph::encode;
+    encode(client_id, bl);
 
     EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
                 exec(::journal::Journaler::header_oid(mock_image_ctx.id),
@@ -199,8 +201,9 @@ public:
 
   template <typename T>
   bufferlist encode(const T &t) {
+    using ceph::encode;
     bufferlist bl;
-    ::encode(t, bl);
+    encode(t, bl);
     return bl;
   }
 
index 413fd71b186a12d8a5a9a1d10b11f695193753ba..5f95429acd2ed9dfa01521e41bc017535ac1d904 100644 (file)
@@ -53,7 +53,7 @@ public:
          rados::cls::lock::locker_info_t()}};
 
       bufferlist bl;
-      ::encode(reply, bl, CEPH_FEATURES_SUPPORTED_DEFAULT);
+      encode(reply, bl, CEPH_FEATURES_SUPPORTED_DEFAULT);
 
       std::string str(bl.c_str(), bl.length());
       expect.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(str)), Return(r)));
index 453e49cd6367e8bba7b3caa93dda2fa68e65fb0a..297df7854a4da7e992b89753827814448879db69 100644 (file)
@@ -29,10 +29,10 @@ public:
                      uint8_t new_state,
                      const boost::optional<uint8_t>& current_state, int r) {
     bufferlist bl;
-    ::encode(start_object_no, bl);
-    ::encode(end_object_no, bl);
-    ::encode(new_state, bl);
-    ::encode(current_state, bl);
+    encode(start_object_no, bl);
+    encode(end_object_no, bl);
+    encode(new_state, bl);
+    encode(current_state, bl);
 
     std::string oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
     if (snap_id == CEPH_NOSNAP) {
index e1b4d69f93d74ce8824ea086502e72e531b3593d..da344dcb9646150ce53e98cc85e3ab06fddc88ca 100644 (file)
@@ -51,8 +51,8 @@ public:
   void expect_set_protection_status(MockImageCtx &mock_image_ctx,
                                     uint64_t snap_id, uint8_t status, int r) {
     bufferlist bl;
-    ::encode(snap_id, bl);
-    ::encode(status, bl);
+    encode(snap_id, bl);
+    encode(status, bl);
 
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
                                exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
@@ -87,7 +87,7 @@ public:
   void expect_get_children(MockImageCtx &mock_image_ctx, size_t pools, int r) {
     bufferlist bl;
     std::set<std::string> children;
-    ::encode(children, bl);
+    encode(children, bl);
 
     auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
                                exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("get_children"), _,
index 6232154fa37d8063ca3af8f0f1b556a9eac1614a..9b85d5d6ef2b9e77c3572237685368d667c30435 100644 (file)
@@ -67,7 +67,7 @@ public:
        bufferlist payload;
        bufferlist::iterator iter = bl.begin();
        DECODE_START(1, iter);
-       ::decode(op, iter);
+       decode(op, iter);
        iter.copy_all(payload);
        DECODE_FINISH(iter);
 
@@ -146,7 +146,7 @@ public:
 
   bufferlist create_response_message(int r) {
     bufferlist bl;
-    ::encode(ResponseMessage(r), bl);
+    encode(ResponseMessage(r), bl);
     return bl;
   }
 
@@ -189,14 +189,14 @@ public:
   int notify_async_progress(librbd::ImageCtx *ictx, const AsyncRequestId &id,
                             uint64_t offset, uint64_t total) {
     bufferlist bl;
-    ::encode(NotifyMessage(AsyncProgressPayload(id, offset, total)), bl);
+    encode(NotifyMessage(AsyncProgressPayload(id, offset, total)), bl);
     return m_ioctx.notify2(ictx->header_oid, bl, 5000, NULL);
   }
 
   int notify_async_complete(librbd::ImageCtx *ictx, const AsyncRequestId &id,
                             int r) {
     bufferlist bl;
-    ::encode(NotifyMessage(AsyncCompletePayload(id, r)), bl);
+    encode(NotifyMessage(AsyncCompletePayload(id, r)), bl);
     return m_ioctx.notify2(ictx->header_oid, bl, 5000, NULL);
   }
 
index 837ef2b88fae31133fb469f5d65d379d0d3714f3..ce21e3f87567c45142bd07707456ce5c0bb7e191 100644 (file)
@@ -279,7 +279,7 @@ public:
     ASSERT_EQ(-ENOENT, init_ctx.wait());
 
     bufferlist client_data_bl;
-    ::encode(client_data, client_data_bl);
+    encode(client_data, client_data_bl);
     ASSERT_EQ(0, journaler.register_client(client_data_bl));
 
     C_SaferCond shut_down_ctx;
index d154284d98c60be4cc6c2e8b8eb7926b5810405c..5b2da9837877ce804a191f3411d5fbe875eb8c8c 100644 (file)
@@ -296,7 +296,7 @@ public:
     client_data.client_meta = client_meta;
 
     cls::journal::Client client;
-    ::encode(client_data, client.data);
+    encode(client_data, client.data);
 
     EXPECT_CALL(mock_journaler, get_cached_client("", _))
                   .WillOnce(DoAll(SetArgPointee<1>(client),
@@ -1331,7 +1331,7 @@ TEST_F(TestMockJournal, ResyncRequested) {
   tag_data.mirror_uuid = Journal<>::LOCAL_MIRROR_UUID;
 
   bufferlist tag_data_bl;
-  ::encode(tag_data, tag_data_bl);
+  encode(tag_data, tag_data_bl);
   expect_get_journaler_tags(mock_image_ctx, mock_journaler, 0,
                             {{0, 0, tag_data_bl}}, 0);
 
@@ -1383,7 +1383,7 @@ TEST_F(TestMockJournal, ForcePromoted) {
   tag_data.mirror_uuid = Journal<>::LOCAL_MIRROR_UUID;
 
   bufferlist tag_data_bl;
-  ::encode(tag_data, tag_data_bl);
+  encode(tag_data, tag_data_bl);
   expect_get_journaler_tags(mock_image_ctx, mock_journaler, 0,
                             {{100, 0, tag_data_bl}}, 0);
 
index 2392baeb41c666e68a773c205760dfc9ef67de0c..efd8e13a651b963a24ff4c6c47eb3077516e0ab6 100644 (file)
@@ -116,7 +116,7 @@ public:
   void expect_get_snapcontext(const std::string& image_id,
                               const ::SnapContext &snapc, int r) {
     bufferlist bl;
-    ::encode(snapc, bl);
+    encode(snapc, bl);
 
     EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
                 exec(librbd::util::header_name(image_id), _, StrEq("rbd"),
@@ -249,4 +249,3 @@ TEST_F(TestMockImageDeleterRemoveRequest, RemoveError) {
 } // namespace image_deleter
 } // namespace mirror
 } // namespace rbd
-
index 19103b8f5bfd4e67888ad821c36ad64d6bb64601..e96bec640a134df2cab874c96cc1394e740463ff 100644 (file)
@@ -178,7 +178,7 @@ public:
 
   void expect_mirror_image_get_image_id(const std::string& image_id, int r) {
     bufferlist bl;
-    ::encode(image_id, bl);
+    encode(image_id, bl);
 
     EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
@@ -243,7 +243,7 @@ public:
     mirror_image.state = mirror_image_state;
 
     bufferlist bl;
-    ::encode(image_id, bl);
+    encode(image_id, bl);
     encode(mirror_image, bl);
 
     EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
index ee5e49811e31e9b033bd79bf1b4c27b9713a05b4..bd8fb6893c4e7d998883ba49764487ae2b0b25be 100644 (file)
@@ -329,7 +329,7 @@ public:
                                         const librbd::journal::ClientData &client_data,
                                         int r) {
     bufferlist bl;
-    ::encode(client_data, bl);
+    encode(client_data, bl);
 
     EXPECT_CALL(mock_journaler, register_client(ContentsEqual(bl), _))
       .WillOnce(WithArg<1>(Invoke([this, r](Context *on_finish) {
@@ -349,7 +349,7 @@ public:
                                       const librbd::journal::ClientData &client_data,
                                       int r) {
     bufferlist bl;
-    ::encode(client_data, bl);
+    encode(client_data, bl);
 
     EXPECT_CALL(mock_journaler, update_client(ContentsEqual(bl), _))
       .WillOnce(WithArg<1>(Invoke([this, r](Context *on_finish) {
@@ -437,7 +437,7 @@ public:
 
   bufferlist encode_tag_data(const librbd::journal::TagData &tag_data) {
     bufferlist bl;
-    ::encode(tag_data, bl);
+    encode(tag_data, bl);
     return bl;
   }
 
@@ -483,7 +483,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, NonPrimaryRemoteSyncingState) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -532,7 +532,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, RemoteDemotePromote) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -602,7 +602,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, MultipleRemoteDemotePromotes) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -682,7 +682,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, LocalDemoteRemotePromote) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -750,7 +750,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, SplitBrainForcePromote) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -818,7 +818,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, ResyncRequested) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -874,7 +874,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, PrimaryRemote) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -901,7 +901,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, PrimaryRemote) {
   mirror_peer_client_meta.state = librbd::journal::MIRROR_PEER_STATE_SYNCING;
   client_data.client_meta = mirror_peer_client_meta;
   client.data.clear();
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   expect_journaler_update_client(mock_journaler, client_data, 0);
 
   // create the local image
@@ -943,7 +943,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, PrimaryRemoteLocalDeleted) {
   cls::journal::Client client;
   librbd::journal::ClientData client_data{
     librbd::journal::ImageClientMeta{123}};
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   ::journal::MockJournaler mock_journaler;
   expect_journaler_get_client(mock_journaler,
                               librbd::Journal<>::IMAGE_CLIENT_ID,
@@ -985,7 +985,7 @@ TEST_F(TestMockImageReplayerBootstrapRequest, PrimaryRemoteLocalDeleted) {
   mirror_peer_client_meta.state = librbd::journal::MIRROR_PEER_STATE_SYNCING;
   client_data.client_meta = mirror_peer_client_meta;
   client.data.clear();
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   expect_journaler_update_client(mock_journaler, client_data, 0);
 
   // create the missing local image
index 9c60e0689e71db81ade0af4fea3a4ca4fed0c005..f067feb8c7c102bf881f48beca5c7f424872bdce 100644 (file)
@@ -264,7 +264,7 @@ public:
   void expect_mirror_image_get_image_id(librados::IoCtx &io_ctx,
                                         const std::string &image_id, int r) {
     bufferlist bl;
-    ::encode(image_id, bl);
+    encode(image_id, bl);
 
     EXPECT_CALL(get_mock_io_ctx(io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
index eaa9882de843896e98462ba267896311d5720db7..40007dfda987d217539152e4ff7270979dd1d547 100644 (file)
@@ -46,7 +46,7 @@ public:
   void expect_mirror_image_get_image_id(librados::IoCtx &io_ctx,
                                         const std::string &image_id, int r) {
     bufferlist bl;
-    ::encode(image_id, bl);
+    encode(image_id, bl);
 
     EXPECT_CALL(get_mock_io_ctx(io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
index 2f0e6492bbd9d07c2f0910b2c414d1a6e83b9629..dba33364dcd47c35f34df8738f3f187a56663d14 100644 (file)
@@ -112,7 +112,7 @@ public:
   void expect_mirror_uuid_get(librados::IoCtx &io_ctx,
                               const std::string &mirror_uuid, int r) {
     bufferlist bl;
-    ::encode(mirror_uuid, bl);
+    encode(mirror_uuid, bl);
 
     EXPECT_CALL(get_mock_io_ctx(io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_uuid_get"), _, _, _))
@@ -138,7 +138,7 @@ public:
                                         const librbd::journal::ClientData &client_data,
                                         int r) {
     bufferlist bl;
-    ::encode(client_data, bl);
+    encode(client_data, bl);
 
     EXPECT_CALL(mock_journaler, register_client(ContentsEqual(bl), _))
       .WillOnce(WithArg<1>(Invoke([this, r](Context *on_finish) {
@@ -165,7 +165,7 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, Success) {
   librbd::journal::ClientData client_data{mirror_peer_client_meta};
   cls::journal::Client client;
   client.state = cls::journal::CLIENT_STATE_DISCONNECTED;
-  ::encode(client_data, client.data);
+  encode(client_data, client.data);
   expect_journaler_get_client(mock_remote_journaler, "local mirror uuid",
                               client, 0);
 
index 0795fcdd445985037091a797a4f53ffb8f7e38f4..bcaeaab1229ceaa1abcd728ed8667229a9f13a74 100644 (file)
@@ -44,7 +44,7 @@ public:
                                 const std::map<std::string, std::string> &ids,
                                 int r) {
     bufferlist bl;
-    ::encode(ids, bl);
+    encode(ids, bl);
 
     EXPECT_CALL(get_mock_io_ctx(io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_list"), _, _, _))
index 67bc8fd5900482c020484ae895a11c9f62513007..fcf7a8f435912f0549df470772437a676a050879 100644 (file)
@@ -68,7 +68,7 @@ public:
 
     librbd::journal::ClientData client_data(m_client_meta);
     bufferlist client_data_bl;
-    ::encode(client_data, client_data_bl);
+    encode(client_data, client_data_bl);
 
     ASSERT_EQ(0, m_remote_journaler->register_client(client_data_bl));
   }
index b1bf9cf6d452ccef101ff7c30c1293d152d48abe..2b71b6e33bab3e3c9d75028619b75a792cba0ceb 100644 (file)
@@ -404,7 +404,7 @@ public:
 
   bufferlist encode_tag_data(const librbd::journal::TagData &tag_data) {
     bufferlist bl;
-    ::encode(tag_data, bl);
+    encode(tag_data, bl);
     return bl;
   }
 
@@ -479,7 +479,7 @@ public:
     client_data.client_meta = image_client_meta;
 
     cls::journal::Client client;
-    ::encode(client_data, client.data);
+    encode(client_data, client.data);
 
     EXPECT_CALL(mock_journaler, get_cached_client("local_mirror_uuid", _))
       .WillOnce(DoAll(SetArgPointee<1>(client),
index 3cb860e6699ecc9c59a36987534cf9faa9ce07aa..d02cee71ed72c703c4da75c3418cd1b8f7d55b55 100644 (file)
@@ -505,7 +505,7 @@ TEST_F(TestMockInstanceWatcher, ImageAcquireReleaseCancel) {
                     auto ctx = new FunctionContext(
                       [instance_watcher, &mock_io_ctx, c, pbl](int r) {
                         instance_watcher->cancel_notify_requests("other");
-                        ::encode(librbd::watcher::NotifyResponse(), *pbl);
+                        encode(librbd::watcher::NotifyResponse(), *pbl);
                         mock_io_ctx.get_mock_rados_client()->
                             finish_aio_completion(c, -ETIMEDOUT);
                       });
@@ -526,7 +526,7 @@ TEST_F(TestMockInstanceWatcher, ImageAcquireReleaseCancel) {
                     auto ctx = new FunctionContext(
                       [instance_watcher, &mock_io_ctx, c, pbl](int r) {
                         instance_watcher->cancel_notify_requests("other");
-                        ::encode(librbd::watcher::NotifyResponse(), *pbl);
+                        encode(librbd::watcher::NotifyResponse(), *pbl);
                         mock_io_ctx.get_mock_rados_client()->
                             finish_aio_completion(c, -ETIMEDOUT);
                       });
@@ -571,7 +571,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageRemovedCancel) {
                     auto ctx = new FunctionContext(
                       [instance_watcher, &mock_io_ctx, c, pbl](int r) {
                         instance_watcher->cancel_notify_requests("other");
-                        ::encode(librbd::watcher::NotifyResponse(), *pbl);
+                        encode(librbd::watcher::NotifyResponse(), *pbl);
                         mock_io_ctx.get_mock_rados_client()->
                             finish_aio_completion(c, -ETIMEDOUT);
                       });
index 4c7463d660c552df8e20ad29371c031f5035149e..d6545d5fa498b13b2c5d20610b33bfbc85eca8a6 100644 (file)
@@ -226,7 +226,7 @@ public:
   void expect_mirror_uuid_get(librados::IoCtx &io_ctx,
                               const std::string &uuid, int r) {
     bufferlist out_bl;
-    ::encode(uuid, out_bl);
+    encode(uuid, out_bl);
 
     EXPECT_CALL(get_mock_io_ctx(io_ctx),
                 exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_uuid_get"),
index ffae4896f3bed535882251bb3d1a79d320c41219..db8ec5be1a7cc65c35df6e41943dd141dcb217ac 100644 (file)
@@ -69,7 +69,7 @@ int read_string(int fd, unsigned max, std::string *out) {
   bl.append(buf, 4);
   bufferlist::iterator p = bl.begin();
   uint32_t len;
-  ::decode(len, p);
+  decode(len, p);
   if (len > max)
     return -EINVAL;
 
index de7d4c75f57d1e5134d6bf15d112f2e59c0302ae..a33eb1468f3d60f1fafd44cb35f9fec8d372c5e1 100644 (file)
@@ -101,16 +101,16 @@ private:
     bufferlist bl;
     __u8 tag = exists ? RBD_DIFF_WRITE : RBD_DIFF_ZERO;
     uint64_t len = 0;
-    ::encode(tag, bl);
+    encode(tag, bl);
     if (export_format == 2) {
       if (tag == RBD_DIFF_WRITE)
        len = 8 + 8 + length;
       else
        len = 8 + 8;
-      ::encode(len, bl);
+      encode(len, bl);
     }
-    ::encode(offset, bl);
-    ::encode(length, bl);
+    encode(offset, bl);
+    encode(length, bl);
     int r = bl.write_fd(edc->fd);
 
     edc->pc.update_progress(offset, edc->totalsize);
@@ -142,34 +142,34 @@ int do_export_diff_fd(librbd::Image& image, const char *fromsnapname,
     uint64_t len = 0;
     if (fromsnapname) {
       tag = RBD_DIFF_FROM_SNAP;
-      ::encode(tag, bl);
+      encode(tag, bl);
       std::string from(fromsnapname);
       if (export_format == 2) {
        len = from.length() + 4;
-       ::encode(len, bl);
+       encode(len, bl);
       }
-      ::encode(from, bl);
+      encode(from, bl);
     }
 
     if (endsnapname) {
       tag = RBD_DIFF_TO_SNAP;
-      ::encode(tag, bl);
+      encode(tag, bl);
       std::string to(endsnapname);
       if (export_format == 2) {
        len = to.length() + 4;
-       ::encode(len, bl);
+       encode(len, bl);
       }
-      ::encode(to, bl);
+      encode(to, bl);
     }
 
     tag = RBD_DIFF_IMAGE_SIZE;
-    ::encode(tag, bl);
+    encode(tag, bl);
     uint64_t endsize = info.size;
     if (export_format == 2) {
       len = 8;
-      ::encode(len, bl);
+      encode(len, bl);
     }
-    ::encode(endsize, bl);
+    encode(endsize, bl);
 
     r = bl.write_fd(fd);
     if (r < 0) {
@@ -193,7 +193,7 @@ int do_export_diff_fd(librbd::Image& image, const char *fromsnapname,
   {
     __u8 tag = RBD_DIFF_END;
     bufferlist bl;
-    ::encode(tag, bl);
+    encode(tag, bl);
     r = bl.write_fd(fd);
   }
 
@@ -386,35 +386,35 @@ static int do_export_v2(librbd::Image& image, librbd::image_info_t &info, int fd
   // encode order
   tag = RBD_EXPORT_IMAGE_ORDER;
   length = 8;
-  ::encode(tag, bl);
-  ::encode(length, bl);
-  ::encode(uint64_t(info.order), bl);
+  encode(tag, bl);
+  encode(length, bl);
+  encode(uint64_t(info.order), bl);
 
   // encode features
   tag = RBD_EXPORT_IMAGE_FEATURES;
   uint64_t features;
   image.features(&features);
   length = 8;
-  ::encode(tag, bl);
-  ::encode(length, bl);
-  ::encode(features, bl);
+  encode(tag, bl);
+  encode(length, bl);
+  encode(features, bl);
 
   // encode stripe_unit and stripe_count
   tag = RBD_EXPORT_IMAGE_STRIPE_UNIT;
   uint64_t stripe_unit;
   stripe_unit = image.get_stripe_unit();
   length = 8;
-  ::encode(tag, bl);
-  ::encode(length, bl);
-  ::encode(stripe_unit, bl);
+  encode(tag, bl);
+  encode(length, bl);
+  encode(stripe_unit, bl);
 
   tag = RBD_EXPORT_IMAGE_STRIPE_COUNT;
   uint64_t stripe_count;
   stripe_count = image.get_stripe_count();
   length = 8;
-  ::encode(tag, bl);
-  ::encode(length, bl);
-  ::encode(stripe_count, bl);
+  encode(tag, bl);
+  encode(length, bl);
+  encode(stripe_count, bl);
 
   //retrieve metadata of image
   std::map<std::string, string> imagemetas;
@@ -449,15 +449,15 @@ static int do_export_v2(librbd::Image& image, librbd::image_info_t &info, int fd
 
     tag = RBD_EXPORT_IMAGE_META;
     length = key.length() + value.length() + 4 * 2;
-    ::encode(tag, bl);
-    ::encode(length, bl);
-    ::encode(key, bl);
-    ::encode(value, bl);
+    encode(tag, bl);
+    encode(length, bl);
+    encode(key, bl);
+    encode(value, bl);
   }
 
   // encode end tag
   tag = RBD_EXPORT_IMAGE_END;
-  ::encode(tag, bl);
+  encode(tag, bl);
 
   // write bl to fd.
   r = bl.write_fd(fd);
@@ -476,7 +476,7 @@ static int do_export_v2(librbd::Image& image, librbd::image_info_t &info, int fd
   }
 
   uint64_t diff_num = snaps.size() + 1;
-  ::encode(diff_num, bl);
+  encode(diff_num, bl);
 
   r = bl.write_fd(fd);
   if (r < 0) {
index e47eb325f6fda3f265af1906ed06f5e3b2f6f15e..afdc6449382c57bdecf5ed267a60820f40560c95 100644 (file)
@@ -197,7 +197,7 @@ static int do_image_resize(ImportDiffContext *idiffctx)
   bufferlist bl;
   bl.append(buf, sizeof(buf));
   bufferlist::iterator p = bl.begin();
-  ::decode(end_size, p);
+  decode(end_size, p);
 
   uint64_t cur_size;
   idiffctx->image->size(&cur_size);
@@ -224,8 +224,8 @@ static int do_image_io(ImportDiffContext *idiffctx, bool discard, size_t sparse_
   bufferlist::iterator p = bl.begin();
 
   uint64_t image_offset, buffer_length;
-  ::decode(image_offset, p);
-  ::decode(buffer_length, p);
+  decode(image_offset, p);
+  decode(buffer_length, p);
 
   if (!discard) {
     bufferptr bp = buffer::create(buffer_length);
@@ -333,7 +333,7 @@ static int read_tag(int fd, __u8 end_tag, int format, __u8 *tag, uint64_t *readl
     bufferlist bl;
     bl.append(buf, sizeof(buf));
     bufferlist::iterator p = bl.begin();
-    ::decode(*readlen, p);
+    decode(*readlen, p);
   }
 
   return 0;
@@ -546,7 +546,7 @@ static int decode_and_set_image_option(int fd, uint64_t imageopt, librbd::ImageO
   it = bl.begin();
 
   uint64_t val;
-  ::decode(val, it);
+  decode(val, it);
 
   if (opts.get(imageopt, &val) != 0) {
     opts.set(imageopt, val);
@@ -664,8 +664,7 @@ static int do_import_v2(librados::Rados &rados, int fd, librbd::Image &image,
   bl.append(buf, sizeof(buf));
   bufferlist::iterator p = bl.begin();
   uint64_t diff_num;
-  ::decode(diff_num, p);
-
+  decode(diff_num, p);
   for (size_t i = 0; i < diff_num; i++) {
     r = do_import_diff_fd(rados, image, fd, true, 2, sparse_size);
     if (r < 0) {
index 9b047a4cd935b8213f20a405ee86878307b361b6..44df9cc1f9f63ad7a59c92fbaa4dda58f7e17f63 100644 (file)
@@ -364,7 +364,7 @@ static int inspect_entry(bufferlist& data,
                         bool verbose) {
   try {
     bufferlist::iterator it = data.begin();
-    ::decode(event_entry, it);
+    decode(event_entry, it);
   } catch (const buffer::error &err) {
     std::cerr << "failed to decode event entry: " << err.what() << std::endl;
     return -EINVAL;
index 9be899b081993cb314e93588cad9b8653249f4d0..03932802cc20785929d6eaafaa91c6aca5f38074 100644 (file)
@@ -67,7 +67,7 @@ static int parse_diff_header(int fd, __u8 *tag, string *from, string *to, uint64
       bufferlist bl;
       bl.append(buf, 8);
       bufferlist::iterator p = bl.begin();
-      ::decode(*size, p);
+      decode(*size, p);
     } else {
       break;
     }
@@ -103,8 +103,8 @@ static int parse_diff_body(int fd, __u8 *tag, uint64_t *offset, uint64_t *length
   bufferlist bl;
   bl.append(buf, 16);
   bufferlist::iterator p = bl.begin();
-  ::decode(*offset, p);
-  ::decode(*length, p);
+  decode(*offset, p);
+  decode(*length, p);
 
   if (!(*length))
     return -ENOTSUP;
@@ -122,9 +122,9 @@ static int accept_diff_body(int fd, int pd, __u8 tag, uint64_t offset, uint64_t
     return 0;
 
   bufferlist bl;
-  ::encode(tag, bl);
-  ::encode(offset, bl);
-  ::encode(length, bl);
+  encode(tag, bl);
+  encode(offset, bl);
+  encode(length, bl);
   int r;
   r = bl.write_fd(pd);
   if (r < 0)
@@ -228,19 +228,19 @@ static int do_merge_diff(const char *first, const char *second,
     __u8 tag;
     if (f_from.size()) {
       tag = RBD_DIFF_FROM_SNAP;
-      ::encode(tag, bl);
-      ::encode(f_from, bl);
+      encode(tag, bl);
+      encode(f_from, bl);
     }
 
     if (s_to.size()) {
       tag = RBD_DIFF_TO_SNAP;
-      ::encode(tag, bl);
-      ::encode(s_to, bl);
+      encode(tag, bl);
+      encode(s_to, bl);
     }
 
     tag = RBD_DIFF_IMAGE_SIZE;
-    ::encode(tag, bl);
-    ::encode(s_size, bl);
+    encode(tag, bl);
+    encode(s_size, bl);
 
     r = bl.write_fd(pd);
     if (r < 0) {
@@ -382,7 +382,7 @@ static int do_merge_diff(const char *first, const char *second,
   {//tail
     __u8 tag = RBD_DIFF_END;
     bufferlist bl;
-    ::encode(tag, bl);
+    encode(tag, bl);
     r = bl.write_fd(pd);
   }
 
index 48f34cf3dcf47d5f9ddcc0774f0eb5eba8f2eecd..5123412c6c6f591e10244bc82dc3d6874d0a6c15 100644 (file)
@@ -166,7 +166,7 @@ void ImageMap<I>::update_image_mapping() {
   image_map::PolicyMetaNone policy_meta;
 
   bufferlist bl;
-  ::encode(image_map::PolicyData(policy_meta), bl);
+  encode(image_map::PolicyData(policy_meta), bl);
 
   // prepare update map
   std::map<std::string, cls::rbd::MirrorImageMap> update_mapping;
index 6da6639b0be2c1261e382ed798f319bafb566b85..a8ff166b5cb1bcf6c4e64be5eecf546eebce1baa 100644 (file)
@@ -1037,7 +1037,7 @@ void ImageReplayer<I>::handle_get_remote_tag(int r) {
   if (r == 0) {
     try {
       bufferlist::iterator it = m_replay_tag.data.begin();
-      ::decode(m_replay_tag_data, it);
+      decode(m_replay_tag_data, it);
     } catch (const buffer::error &err) {
       r = -EBADMSG;
     }
index 1c3f84e04d885a1690dad3090a5c55808f876fcc..9e703ccbfe8a5cea528391ec2cf140764901bab9 100644 (file)
@@ -324,7 +324,7 @@ void ImageSync<I>::send_update_sync_point() {
 
   bufferlist client_data_bl;
   librbd::journal::ClientData client_data(*m_client_meta);
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_context_callback<
     ImageSync<I>, &ImageSync<I>::handle_update_sync_point>(
@@ -385,7 +385,7 @@ void ImageSync<I>::send_flush_sync_point() {
 
   bufferlist client_data_bl;
   librbd::journal::ClientData client_data(*m_client_meta);
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_context_callback<
     ImageSync<I>, &ImageSync<I>::handle_flush_sync_point>(
index 7f94976ea1c60d8ce7cad511505ab95a316f25af..42d0d7abddcb244bd677b4e19c3e4419b00dc2d6 100644 (file)
@@ -185,7 +185,7 @@ struct InstanceWatcher<I>::C_NotifyInstanceRequest : public Context {
         try {
           auto iter = bl.begin();
           NotifyAckPayload ack;
-          ::decode(ack, iter);
+          decode(ack, iter);
           if (ack.instance_id != instance_watcher->get_instance_id()) {
             derr << "C_NotifyInstanceRequest: " << this << " " << __func__
                  << ": ack instance_id (" << ack.instance_id << ") "
@@ -410,7 +410,7 @@ void InstanceWatcher<I>::notify_image_acquire(
   } else {
     uint64_t request_id = ++m_request_seq;
     bufferlist bl;
-    ::encode(NotifyMessage{ImageAcquirePayload{request_id, global_image_id}},
+    encode(NotifyMessage{ImageAcquirePayload{request_id, global_image_id}},
              bl);
     auto req = new C_NotifyInstanceRequest(this, instance_id, request_id,
                                            std::move(bl), on_notify_ack);
@@ -434,7 +434,7 @@ void InstanceWatcher<I>::notify_image_release(
   } else {
     uint64_t request_id = ++m_request_seq;
     bufferlist bl;
-    ::encode(NotifyMessage{ImageReleasePayload{request_id, global_image_id}},
+    encode(NotifyMessage{ImageReleasePayload{request_id, global_image_id}},
              bl);
     auto req = new C_NotifyInstanceRequest(this, instance_id, request_id,
                                            std::move(bl), on_notify_ack);
@@ -458,7 +458,7 @@ void InstanceWatcher<I>::notify_peer_image_removed(
   } else {
     uint64_t request_id = ++m_request_seq;
     bufferlist bl;
-    ::encode(NotifyMessage{PeerImageRemovedPayload{request_id, global_image_id,
+    encode(NotifyMessage{PeerImageRemovedPayload{request_id, global_image_id,
                                                    peer_mirror_uuid}}, bl);
     auto req = new C_NotifyInstanceRequest(this, instance_id, request_id,
                                            std::move(bl), on_notify_ack);
@@ -478,7 +478,7 @@ void InstanceWatcher<I>::notify_sync_request(const std::string &sync_id,
   uint64_t request_id = ++m_request_seq;
 
   bufferlist bl;
-  ::encode(NotifyMessage{SyncRequestPayload{request_id, sync_id}}, bl);
+  encode(NotifyMessage{SyncRequestPayload{request_id, sync_id}}, bl);
 
   auto sync_ctx = new C_SyncRequest(this, sync_id, on_sync_start);
   sync_ctx->req = new C_NotifyInstanceRequest(this, "", request_id,
@@ -520,7 +520,7 @@ void InstanceWatcher<I>::notify_sync_start(const std::string &instance_id,
   uint64_t request_id = ++m_request_seq;
 
   bufferlist bl;
-  ::encode(NotifyMessage{SyncStartPayload{request_id, sync_id}}, bl);
+  encode(NotifyMessage{SyncStartPayload{request_id, sync_id}}, bl);
 
   auto ctx = new FunctionContext(
     [this, sync_id] (int r) {
@@ -1092,7 +1092,7 @@ void InstanceWatcher<I>::complete_request(const std::string &instance_id,
     m_requests.erase(it);
   }
 
-  ::encode(NotifyAckPayload(instance_id, request_id, r), on_notify_ack->out);
+  encode(NotifyAckPayload(instance_id, request_id, r), on_notify_ack->out);
   on_notify_ack->complete(0);
 }
 
@@ -1107,7 +1107,7 @@ void InstanceWatcher<I>::handle_notify(uint64_t notify_id, uint64_t handle,
   NotifyMessage notify_message;
   try {
     bufferlist::iterator iter = bl.begin();
-    ::decode(notify_message, iter);
+    decode(notify_message, iter);
   } catch (const buffer::error &err) {
     derr << "error decoding image notification: " << err.what() << dendl;
     ctx->complete(0);
index 46f555252f0e48e0c7e6dcdfc61479058fc74066..cbcce6cd206ae4f353b579041d34ba2701a0de96 100644 (file)
@@ -886,7 +886,7 @@ void LeaderWatcher<I>::notify_lock_acquired() {
     LeaderWatcher<I>, &LeaderWatcher<I>::handle_notify_lock_acquired>(this);
 
   bufferlist bl;
-  ::encode(NotifyMessage{LockAcquiredPayload{}}, bl);
+  encode(NotifyMessage{LockAcquiredPayload{}}, bl);
 
   send_notify(bl, nullptr, ctx);
 }
@@ -920,7 +920,7 @@ void LeaderWatcher<I>::notify_lock_released() {
     LeaderWatcher<I>, &LeaderWatcher<I>::handle_notify_lock_released>(this);
 
   bufferlist bl;
-  ::encode(NotifyMessage{LockReleasedPayload{}}, bl);
+  encode(NotifyMessage{LockReleasedPayload{}}, bl);
 
   send_notify(bl, nullptr, ctx);
 }
@@ -961,7 +961,7 @@ void LeaderWatcher<I>::notify_heartbeat() {
     LeaderWatcher<I>, &LeaderWatcher<I>::handle_notify_heartbeat>(this);
 
   bufferlist bl;
-  ::encode(NotifyMessage{HeartbeatPayload{}}, bl);
+  encode(NotifyMessage{HeartbeatPayload{}}, bl);
 
   m_heartbeat_response.acks.clear();
   send_notify(bl, &m_heartbeat_response, ctx);
@@ -1079,7 +1079,7 @@ void LeaderWatcher<I>::handle_notify(uint64_t notify_id, uint64_t handle,
   NotifyMessage notify_message;
   try {
     bufferlist::iterator iter = bl.begin();
-    ::decode(notify_message, iter);
+    decode(notify_message, iter);
   } catch (const buffer::error &err) {
     derr << ": error decoding image notification: " << err.what() << dendl;
     ctx->complete(0);
index 02946a8c7c485654897d92587efa1643fbe2c68d..6592c057c3b14357c2d4779aad64c61388990177 100644 (file)
@@ -28,7 +28,8 @@ public:
 
   template <typename T>
   inline void operator()(const T& t) const {
-    ::encode(static_cast<uint32_t>(T::TYPE), m_bl);
+    using ceph::encode;
+    encode(static_cast<uint32_t>(T::TYPE), m_bl);
     t.encode(m_bl);
   }
 private:
@@ -82,7 +83,7 @@ void PolicyData::decode(bufferlist::iterator& it) {
   DECODE_START(1, it);
 
   uint32_t policy_meta_type;
-  ::decode(policy_meta_type, it);
+  decode(policy_meta_type, it);
 
   switch (policy_meta_type) {
   case POLICY_META_TYPE_NONE:
index ba78c9850646d46d650fc8ba6e53eb000ab280ba..91a592dfeb7ad0d700974f671bdac598f774f247 100644 (file)
@@ -92,10 +92,11 @@ struct PolicyData {
   static void generate_test_instances(std::list<PolicyData *> &o);
 };
 
+WRITE_CLASS_ENCODER(PolicyData);
+
 } // namespace image_map
 } // namespace mirror
 } // namespace rbd
 
-WRITE_CLASS_ENCODER(rbd::mirror::image_map::PolicyData);
 
 #endif // CEPH_RBD_MIRROR_IMAGE_MAP_TYPES_H
index a8ca8ab0b291a8507e8b5aa35f4103e807e1d9c4..a91f7fcffa49f4b53799534369c7d34ae936255e 100644 (file)
@@ -125,7 +125,7 @@ void BootstrapRequest<I>::handle_get_remote_tag_class(int r) {
   librbd::journal::ClientData client_data;
   bufferlist::iterator it = m_client.data.begin();
   try {
-    ::decode(client_data, it);
+    decode(client_data, it);
   } catch (const buffer::error &err) {
     derr << ": failed to decode remote client meta data: " << err.what()
          << dendl;
@@ -240,7 +240,7 @@ void BootstrapRequest<I>::update_client_state() {
 
   librbd::journal::ClientData client_data(client_meta);
   bufferlist data_bl;
-  ::encode(client_data, data_bl);
+  encode(client_data, data_bl);
 
   Context *ctx = create_context_callback<
     BootstrapRequest<I>, &BootstrapRequest<I>::handle_update_client_state>(
@@ -372,7 +372,7 @@ void BootstrapRequest<I>::register_client() {
 
   librbd::journal::ClientData client_data{mirror_peer_client_meta};
   bufferlist client_data_bl;
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_context_callback<
     BootstrapRequest<I>, &BootstrapRequest<I>::handle_register_client>(
@@ -412,7 +412,7 @@ void BootstrapRequest<I>::update_client_image() {
 
   librbd::journal::ClientData client_data(client_meta);
   bufferlist data_bl;
-  ::encode(client_data, data_bl);
+  encode(client_data, data_bl);
 
   Context *ctx = create_context_callback<
     BootstrapRequest<I>, &BootstrapRequest<I>::handle_update_client_image>(
@@ -553,7 +553,7 @@ void BootstrapRequest<I>::handle_get_remote_tags(int r) {
 
     try {
       bufferlist::iterator it = remote_tag.data.begin();
-      ::decode(remote_tag_data, it);
+      decode(remote_tag_data, it);
       remote_tag_data_valid = true;
     } catch (const buffer::error &err) {
       derr << ": failed to decode remote tag " << remote_tag.tid << ": "
index 443c0c209f32e6c6adca050a8a3502917d015a13..6627215e24c739523f5f6b7dd59989cfd8cf8a3c 100644 (file)
@@ -147,7 +147,7 @@ void EventPreprocessor<I>::update_client() {
 
   librbd::journal::ClientData client_data(client_meta);
   bufferlist data_bl;
-  ::encode(client_data, data_bl);
+  encode(client_data, data_bl);
 
   Context *ctx = create_context_callback<
     EventPreprocessor<I>, &EventPreprocessor<I>::handle_update_client>(
index 5fedab88a25386b28ffea335051ddc5525f5c2ba..30688c11edef867c7a29488f731955a016aacc63 100644 (file)
@@ -153,7 +153,7 @@ void PrepareRemoteImageRequest<I>::register_client() {
 
   librbd::journal::ClientData client_data{mirror_peer_client_meta};
   bufferlist client_data_bl;
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_async_context_callback(
     m_threads->work_queue, create_context_callback<
@@ -187,7 +187,7 @@ bool PrepareRemoteImageRequest<I>::decode_client_meta() {
   librbd::journal::ClientData client_data;
   bufferlist::iterator it = m_client.data.begin();
   try {
-    ::decode(client_data, it);
+    decode(client_data, it);
   } catch (const buffer::error &err) {
     derr << "failed to decode client meta data: " << err.what() << dendl;
     return false;
index e86765c2d4f9cede1f642dad978dce8e665351b5..7b01fb5b8382deb13da33ea2f10455c7bd259b2c 100644 (file)
@@ -189,7 +189,7 @@ void ReplayStatusFormatter<I>::handle_update_tag_cache(uint64_t master_tag_tid,
 
     bufferlist::iterator it = m_tag.data.begin();
     try {
-      ::decode(tag_data, it);
+      decode(tag_data, it);
     } catch (const buffer::error &err) {
       derr << "error decoding tag " << master_tag_tid << ": " << err.what()
           << dendl;
index 5323d7d2b8e714bf225cfa729f3ee08661048462..45e1a35ddca9452cd2c41cfd78c6777b3ed9bd31 100644 (file)
@@ -65,7 +65,7 @@ void SyncPointCreateRequest<I>::send_update_client() {
 
   bufferlist client_data_bl;
   librbd::journal::ClientData client_data(m_client_meta_copy);
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_context_callback<
     SyncPointCreateRequest<I>, &SyncPointCreateRequest<I>::handle_update_client>(
index a9d9445a0f4e242015d4b90eb35e5876ee05a139..d4978663aa4cc95feeae848afff08328e9ada180 100644 (file)
@@ -180,7 +180,7 @@ void SyncPointPruneRequest<I>::send_update_client() {
 
   bufferlist client_data_bl;
   librbd::journal::ClientData client_data(m_client_meta_copy);
-  ::encode(client_data, client_data_bl);
+  encode(client_data, client_data_bl);
 
   Context *ctx = create_context_callback<
     SyncPointPruneRequest<I>, &SyncPointPruneRequest<I>::handle_update_client>(
index cdf3e26ad770202a499d96c76f2768233adebfd1..b56ed38918e615a1f6613340e71967df5e9094ab 100644 (file)
@@ -18,7 +18,8 @@ public:
 
   template <typename Payload>
   inline void operator()(const Payload &payload) const {
-    ::encode(static_cast<uint32_t>(Payload::NOTIFY_OP), m_bl);
+    using ceph::encode;
+    encode(static_cast<uint32_t>(Payload::NOTIFY_OP), m_bl);
     payload.encode(m_bl);
   }
 
@@ -59,11 +60,13 @@ private:
 } // anonymous namespace
 
 void PayloadBase::encode(bufferlist &bl) const {
-  ::encode(request_id, bl);
+  using ceph::encode;
+  encode(request_id, bl);
 }
 
 void PayloadBase::decode(__u8 version, bufferlist::iterator &iter) {
-  ::decode(request_id, iter);
+  using ceph::decode;
+  decode(request_id, iter);
 }
 
 void PayloadBase::dump(Formatter *f) const {
@@ -71,13 +74,15 @@ void PayloadBase::dump(Formatter *f) const {
 }
 
 void ImagePayloadBase::encode(bufferlist &bl) const {
+  using ceph::encode;
   PayloadBase::encode(bl);
-  ::encode(global_image_id, bl);
+  encode(global_image_id, bl);
 }
 
 void ImagePayloadBase::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   PayloadBase::decode(version, iter);
-  ::decode(global_image_id, iter);
+  decode(global_image_id, iter);
 }
 
 void ImagePayloadBase::dump(Formatter *f) const {
@@ -86,15 +91,17 @@ void ImagePayloadBase::dump(Formatter *f) const {
 }
 
 void PeerImageRemovedPayload::encode(bufferlist &bl) const {
+  using ceph::encode;
   PayloadBase::encode(bl);
-  ::encode(global_image_id, bl);
-  ::encode(peer_mirror_uuid, bl);
+  encode(global_image_id, bl);
+  encode(peer_mirror_uuid, bl);
 }
 
 void PeerImageRemovedPayload::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   PayloadBase::decode(version, iter);
-  ::decode(global_image_id, iter);
-  ::decode(peer_mirror_uuid, iter);
+  decode(global_image_id, iter);
+  decode(peer_mirror_uuid, iter);
 }
 
 void PeerImageRemovedPayload::dump(Formatter *f) const {
@@ -104,13 +111,15 @@ void PeerImageRemovedPayload::dump(Formatter *f) const {
 }
 
 void SyncPayloadBase::encode(bufferlist &bl) const {
+  using ceph::encode;
   PayloadBase::encode(bl);
-  ::encode(sync_id, bl);
+  encode(sync_id, bl);
 }
 
 void SyncPayloadBase::decode(__u8 version, bufferlist::iterator &iter) {
+  using ceph::decode;
   PayloadBase::decode(version, iter);
-  ::decode(sync_id, iter);
+  decode(sync_id, iter);
 }
 
 void SyncPayloadBase::dump(Formatter *f) const {
@@ -138,7 +147,7 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(2, iter);
 
   uint32_t notify_op;
-  ::decode(notify_op, iter);
+  decode(notify_op, iter);
 
   // select the correct payload variant based upon the encoded op
   switch (notify_op) {
@@ -212,15 +221,17 @@ std::ostream &operator<<(std::ostream &out, const NotifyOp &op) {
 }
 
 void NotifyAckPayload::encode(bufferlist &bl) const {
-  ::encode(instance_id, bl);
-  ::encode(request_id, bl);
-  ::encode(ret_val, bl);
+  using ceph::encode;
+  encode(instance_id, bl);
+  encode(request_id, bl);
+  encode(ret_val, bl);
 }
 
 void NotifyAckPayload::decode(bufferlist::iterator &iter) {
-  ::decode(instance_id, iter);
-  ::decode(request_id, iter);
-  ::decode(ret_val, iter);
+  using ceph::decode;
+  decode(instance_id, iter);
+  decode(request_id, iter);
+  decode(ret_val, iter);
 }
 
 void NotifyAckPayload::dump(Formatter *f) const {
index d2460bc0878e34de6915eebd7d89d7cb45b952fb..0cd86ebad67cf95ffe062c1d7608da5ea0462eba 100644 (file)
@@ -18,7 +18,8 @@ public:
 
   template <typename Payload>
   inline void operator()(const Payload &payload) const {
-    ::encode(static_cast<uint32_t>(Payload::NOTIFY_OP), m_bl);
+    using ceph::encode;
+    encode(static_cast<uint32_t>(Payload::NOTIFY_OP), m_bl);
     payload.encode(m_bl);
   }
 
@@ -105,7 +106,7 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
   DECODE_START(1, iter);
 
   uint32_t notify_op;
-  ::decode(notify_op, iter);
+  decode(notify_op, iter);
 
   // select the correct payload variant based upon the encoded op
   switch (notify_op) {