From: Jason Dillaman Date: Thu, 30 Jul 2015 18:34:57 +0000 (-0400) Subject: librbd: rename librbd::WatchNotify namespace to librbd::watch_notify X-Git-Tag: v10.0.2~193^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f02e4464bdd20a34a7a5f76ad58aa55ebfe6d7bc;p=ceph.git librbd: rename librbd::WatchNotify namespace to librbd::watch_notify The new namespace follows the expected naming conventions. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index d884617bb43..0065cac9348 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -22,7 +22,7 @@ namespace librbd { -using namespace WatchNotify; +using namespace watch_notify; static const std::string WATCHER_LOCK_TAG = "internal"; static const std::string WATCHER_LOCK_COOKIE_PREFIX = "auto"; @@ -625,7 +625,7 @@ void ImageWatcher::cancel_async_requests() { m_async_requests.clear(); } -void ImageWatcher::set_owner_client_id(const WatchNotify::ClientId& client_id) { +void ImageWatcher::set_owner_client_id(const ClientId& client_id) { assert(m_owner_client_id_lock.is_locked()); m_owner_client_id = client_id; ldout(m_image_ctx.cct, 10) << this << " current lock owner: " diff --git a/src/librbd/ImageWatcher.h b/src/librbd/ImageWatcher.h index 2b3da278e79..2611b552177 100644 --- a/src/librbd/ImageWatcher.h +++ b/src/librbd/ImageWatcher.h @@ -107,7 +107,7 @@ private: class Task { public: Task(TaskCode task_code) : m_task_code(task_code) {} - Task(TaskCode task_code, const WatchNotify::AsyncRequestId &id) + Task(TaskCode task_code, const watch_notify::AsyncRequestId &id) : m_task_code(task_code), m_async_request_id(id) {} inline bool operator<(const Task& rhs) const { @@ -122,7 +122,7 @@ private: } private: TaskCode m_task_code; - WatchNotify::AsyncRequestId m_async_request_id; + watch_notify::AsyncRequestId m_async_request_id; }; struct WatchCtx : public librados::WatchCtx2 { @@ -140,7 +140,7 @@ private: class RemoteProgressContext : public ProgressContext { public: RemoteProgressContext(ImageWatcher &image_watcher, - const WatchNotify::AsyncRequestId &id) + const watch_notify::AsyncRequestId &id) : m_image_watcher(image_watcher), m_async_request_id(id) { } @@ -153,14 +153,14 @@ private: private: ImageWatcher &m_image_watcher; - WatchNotify::AsyncRequestId m_async_request_id; + watch_notify::AsyncRequestId m_async_request_id; }; class RemoteContext : public Context { public: RemoteContext(ImageWatcher &image_watcher, - const WatchNotify::AsyncRequestId &id, - ProgressContext *prog_ctx) + const watch_notify::AsyncRequestId &id, + ProgressContext *prog_ctx) : m_image_watcher(image_watcher), m_async_request_id(id), m_prog_ctx(prog_ctx) { @@ -174,7 +174,7 @@ private: private: ImageWatcher &m_image_watcher; - WatchNotify::AsyncRequestId m_async_request_id; + watch_notify::AsyncRequestId m_async_request_id; ProgressContext *m_prog_ctx; }; @@ -189,7 +189,7 @@ private: { } - inline void operator()(const WatchNotify::HeaderUpdatePayload &payload) const { + inline void operator()(const watch_notify::HeaderUpdatePayload &payload) const { bufferlist out; image_watcher->handle_payload(payload, &out); image_watcher->acknowledge_notify(notify_id, handle, out); @@ -222,11 +222,11 @@ private: TaskFinisher *m_task_finisher; RWLock m_async_request_lock; - std::map m_async_requests; - std::set m_async_pending; + std::map m_async_requests; + std::set m_async_pending; Mutex m_owner_client_id_lock; - WatchNotify::ClientId m_owner_client_id; + watch_notify::ClientId m_owner_client_id; std::string encode_lock_cookie() const; static bool decode_lock_cookie(const std::string &cookie, uint64_t *handle); @@ -240,8 +240,8 @@ private: void schedule_cancel_async_requests(); void cancel_async_requests(); - void set_owner_client_id(const WatchNotify::ClientId &client_id); - WatchNotify::ClientId get_client_id(); + void set_owner_client_id(const watch_notify::ClientId &client_id); + watch_notify::ClientId get_client_id(); void notify_acquired_lock(); void notify_release_lock(); @@ -252,50 +252,50 @@ private: int notify_lock_owner(bufferlist &bl); - void schedule_async_request_timed_out(const WatchNotify::AsyncRequestId &id); - void async_request_timed_out(const WatchNotify::AsyncRequestId &id); - int notify_async_request(const WatchNotify::AsyncRequestId &id, + void schedule_async_request_timed_out(const watch_notify::AsyncRequestId &id); + void async_request_timed_out(const watch_notify::AsyncRequestId &id); + int notify_async_request(const watch_notify::AsyncRequestId &id, bufferlist &in, ProgressContext& prog_ctx); void notify_request_leadership(); - void schedule_async_progress(const WatchNotify::AsyncRequestId &id, + void schedule_async_progress(const watch_notify::AsyncRequestId &id, uint64_t offset, uint64_t total); - int notify_async_progress(const WatchNotify::AsyncRequestId &id, + int notify_async_progress(const watch_notify::AsyncRequestId &id, uint64_t offset, uint64_t total); - void schedule_async_complete(const WatchNotify::AsyncRequestId &id, int r); - int notify_async_complete(const WatchNotify::AsyncRequestId &id, int r); + void schedule_async_complete(const watch_notify::AsyncRequestId &id, int r); + int notify_async_complete(const watch_notify::AsyncRequestId &id, int r); - int prepare_async_request(const WatchNotify::AsyncRequestId& id, + int prepare_async_request(const watch_notify::AsyncRequestId& id, bool* new_request, Context** ctx, ProgressContext** prog_ctx); - void cleanup_async_request(const WatchNotify::AsyncRequestId& id, + void cleanup_async_request(const watch_notify::AsyncRequestId& id, Context *ctx); - void handle_payload(const WatchNotify::HeaderUpdatePayload& payload, + void handle_payload(const watch_notify::HeaderUpdatePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::AcquiredLockPayload& payload, + void handle_payload(const watch_notify::AcquiredLockPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::ReleasedLockPayload& payload, + void handle_payload(const watch_notify::ReleasedLockPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::RequestLockPayload& payload, + void handle_payload(const watch_notify::RequestLockPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::AsyncProgressPayload& payload, + void handle_payload(const watch_notify::AsyncProgressPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::AsyncCompletePayload& payload, + void handle_payload(const watch_notify::AsyncCompletePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::FlattenPayload& payload, + void handle_payload(const watch_notify::FlattenPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::ResizePayload& payload, + void handle_payload(const watch_notify::ResizePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::SnapCreatePayload& payload, + void handle_payload(const watch_notify::SnapCreatePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::SnapRenamePayload& payload, + void handle_payload(const watch_notify::SnapRenamePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::SnapRemovePayload& payload, + void handle_payload(const watch_notify::SnapRemovePayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::RebuildObjectMapPayload& payload, + void handle_payload(const watch_notify::RebuildObjectMapPayload& payload, bufferlist *out); - void handle_payload(const WatchNotify::UnknownPayload& payload, + void handle_payload(const watch_notify::UnknownPayload& payload, bufferlist *out); void handle_notify(uint64_t notify_id, uint64_t handle, bufferlist &bl); diff --git a/src/librbd/WatchNotifyTypes.cc b/src/librbd/WatchNotifyTypes.cc index af2e434d3af..a21b233937d 100644 --- a/src/librbd/WatchNotifyTypes.cc +++ b/src/librbd/WatchNotifyTypes.cc @@ -7,7 +7,7 @@ #include "common/Formatter.h" namespace librbd { -namespace WatchNotify { +namespace watch_notify { namespace { @@ -373,12 +373,12 @@ void ResponseMessage::generate_test_instances(std::list &o) { o.push_back(new ResponseMessage(1)); } -} // namespace WatchNotify +} // namespace watch_notify } // namespace librbd std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::NotifyOp &op) { - using namespace librbd::WatchNotify; + const librbd::watch_notify::NotifyOp &op) { + using namespace librbd::watch_notify; switch (op) { case NOTIFY_OP_ACQUIRED_LOCK: @@ -425,13 +425,13 @@ std::ostream &operator<<(std::ostream &out, } std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::ClientId &client_id) { + const librbd::watch_notify::ClientId &client_id) { out << "[" << client_id.gid << "," << client_id.handle << "]"; return out; } std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::AsyncRequestId &request) { + const librbd::watch_notify::AsyncRequestId &request) { out << "[" << request.client_id.gid << "," << request.client_id.handle << "," << request.request_id << "]"; return out; diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h index eaa3305e021..e7ba50d32e3 100644 --- a/src/librbd/WatchNotifyTypes.h +++ b/src/librbd/WatchNotifyTypes.h @@ -16,7 +16,7 @@ class Formatter; } namespace librbd { -namespace WatchNotify { +namespace watch_notify { struct ClientId { uint64_t gid; @@ -295,19 +295,19 @@ struct ResponseMessage { static void generate_test_instances(std::list &o); }; -} // namespace WatchNotify +} // namespace watch_notify } // namespace librbd std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::NotifyOp &op); + const librbd::watch_notify::NotifyOp &op); std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::ClientId &client); + const librbd::watch_notify::ClientId &client); std::ostream &operator<<(std::ostream &out, - const librbd::WatchNotify::AsyncRequestId &request); + const librbd::watch_notify::AsyncRequestId &request); -WRITE_CLASS_ENCODER(librbd::WatchNotify::ClientId); -WRITE_CLASS_ENCODER(librbd::WatchNotify::AsyncRequestId); -WRITE_CLASS_ENCODER(librbd::WatchNotify::NotifyMessage); -WRITE_CLASS_ENCODER(librbd::WatchNotify::ResponseMessage); +WRITE_CLASS_ENCODER(librbd::watch_notify::ClientId); +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 diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index a9dbc9bf7b7..35b7e16b977 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -229,8 +229,8 @@ TYPE(EUpdate) #include "librbd/JournalTypes.h" TYPE(librbd::journal::EventEntry) #include "librbd/WatchNotifyTypes.h" -TYPE(librbd::WatchNotify::NotifyMessage) -TYPE(librbd::WatchNotify::ResponseMessage) +TYPE(librbd::watch_notify::NotifyMessage) +TYPE(librbd::watch_notify::ResponseMessage) #include "rbd_replay/ActionTypes.h" TYPE(rbd_replay::action::Dependency) diff --git a/src/test/librbd/test_ImageWatcher.cc b/src/test/librbd/test_ImageWatcher.cc index 0f137fe6cbc..e8ad76ed37c 100644 --- a/src/test/librbd/test_ImageWatcher.cc +++ b/src/test/librbd/test_ImageWatcher.cc @@ -33,7 +33,7 @@ using namespace ceph; using namespace boost::assign; -using namespace librbd::WatchNotify; +using namespace librbd::watch_notify; void register_test_image_watcher() { }