From: liuchang0812 Date: Wed, 15 Feb 2017 13:42:02 +0000 (+0800) Subject: librados: add override for librados X-Git-Tag: v12.0.1~393^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87c4aaef1c783d93678dc3ab860dbab0a0763fd5;p=ceph.git librados: add override for librados Fixes: http://tracker.ceph.com/issues/18922 Signed-off-by: liuchang0812 --- diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 238e3c67069db..504408b852fe6 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -51,7 +51,7 @@ struct C_notify_Finish : public Context { linger_op->notify_result_bl = &reply_bl; } - virtual void finish(int r) + void finish(int r) override { ldout(cct, 10) << __func__ << " completed notify (linger op " << linger_op << "), r = " << r << dendl; @@ -84,7 +84,7 @@ struct C_aio_linger_cancel : public Context { { } - virtual void finish(int r) + void finish(int r) override { objecter->linger_cancel(linger_op); } @@ -101,7 +101,7 @@ struct C_aio_linger_Complete : public Context { c->get(); } - virtual void finish(int r) { + void finish(int r) override { if (cancel || r < 0) c->io->client->finisher.queue(new C_aio_linger_cancel(c->io->objecter, linger_op)); @@ -137,7 +137,7 @@ struct C_aio_notify_Complete : public C_aio_linger_Complete { complete_unlock(r); } - virtual void complete(int r) override { + void complete(int r) override { // invoked by C_notify_Finish (or C_aio_notify_Ack on failure) lock.Lock(); finished = true; @@ -170,7 +170,7 @@ struct C_aio_notify_Ack : public Context { { } - virtual void finish(int r) + void finish(int r) override { ldout(cct, 10) << __func__ << " linger op " << oncomplete->linger_op << " " << "acked (" << r << ")" << dendl; @@ -192,7 +192,7 @@ struct C_aio_selfmanaged_snap_op_Complete : public Context { c->get(); } - virtual void finish(int r) { + void finish(int r) override { c->lock.Lock(); c->rval = r; c->complete = true; @@ -216,7 +216,7 @@ struct C_aio_selfmanaged_snap_create_Complete : public C_aio_selfmanaged_snap_op dest_snapid(dest_snapid) { } - virtual void finish(int r) { + void finish(int r) override { if (r >= 0) { *dest_snapid = snapid; } @@ -888,7 +888,7 @@ class C_ObjectOperation : public Context { public: ::ObjectOperation m_ops; explicit C_ObjectOperation(Context *c) : m_ctx(c) {} - virtual void finish(int r) { + void finish(int r) override { m_ctx->complete(r); } private: @@ -1566,7 +1566,7 @@ struct WatchInfo : public Objecter::WatchContext { void handle_notify(uint64_t notify_id, uint64_t cookie, uint64_t notifier_id, - bufferlist& bl) { + bufferlist& bl) override { ldout(ioctx->client->cct, 10) << __func__ << " " << notify_id << " cookie " << cookie << " notifier_id " << notifier_id @@ -1583,7 +1583,7 @@ struct WatchInfo : public Objecter::WatchContext { ioctx->notify_ack(oid, notify_id, cookie, empty); } } - void handle_error(uint64_t cookie, int err) { + void handle_error(uint64_t cookie, int err) override { ldout(ioctx->client->cct, 10) << __func__ << " cookie " << cookie << " err " << err << dendl; diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc index 2045516eafe6d..f626ba87d2628 100644 --- a/src/librados/RadosClient.cc +++ b/src/librados/RadosClient.cc @@ -396,7 +396,7 @@ struct C_aio_watch_flush_Complete : public Context { c->get(); } - virtual void finish(int r) { + void finish(int r) override { c->lock.Lock(); c->rval = r; c->complete = true; diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 7b9816b4efa49..9b86f8f2b055b 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -183,7 +183,7 @@ class ObjectOpCompletionCtx : public Context { bufferlist bl; public: explicit ObjectOpCompletionCtx(librados::ObjectOperationCompletion *c) : completion(c) {} - void finish(int r) { + void finish(int r) override { completion->handle_completion(r, bl); delete completion; } @@ -1732,7 +1732,7 @@ struct AioUnlockCompletion : public librados::ObjectOperationCompletion { AioUnlockCompletion(librados::AioCompletion *c) : completion(c->pc) { completion->get(); }; - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { rados_callback_t cb = completion->callback_complete; void *cb_arg = completion->callback_complete_arg; cb(completion, cb_arg); @@ -4852,7 +4852,7 @@ struct C_WatchCB : public librados::WatchCtx { rados_watchcb_t wcb; void *arg; C_WatchCB(rados_watchcb_t _wcb, void *_arg) : wcb(_wcb), arg(_arg) {} - void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) { + void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override { wcb(opcode, ver, arg); } }; @@ -4881,10 +4881,10 @@ struct C_WatchCB2 : public librados::WatchCtx2 { void handle_notify(uint64_t notify_id, uint64_t cookie, uint64_t notifier_gid, - bufferlist& bl) { + bufferlist& bl) override { wcb(arg, notify_id, cookie, notifier_gid, bl.c_str(), bl.length()); } - void handle_error(uint64_t cookie, int err) { + void handle_error(uint64_t cookie, int err) override { if (errcb) errcb(arg, cookie, err); } @@ -5655,7 +5655,7 @@ public: size_t *bytes_read, int *prval) : out_buf(out_buf), out_len(out_len), bytes_read(bytes_read), prval(prval) {} - void finish(int r) { + void finish(int r) override { if (out_bl.length() > out_len) { if (prval) *prval = -ERANGE; @@ -5691,7 +5691,7 @@ public: bufferlist out_bl; C_out_buffer(char **out_buf, size_t *out_len) : out_buf(out_buf), out_len(out_len) {} - void finish(int r) { + void finish(int r) override { // ignore r since we don't know the meaning of return values // from custom class methods do_out_buffer(out_bl, out_buf, out_len); @@ -5744,7 +5744,7 @@ class C_OmapIter : public Context { RadosOmapIter *iter; public: explicit C_OmapIter(RadosOmapIter *iter) : iter(iter) {} - void finish(int r) { + void finish(int r) override { iter->i = iter->values.begin(); } }; @@ -5753,7 +5753,7 @@ class C_XattrsIter : public Context { librados::RadosXattrsIter *iter; public: explicit C_XattrsIter(librados::RadosXattrsIter *iter) : iter(iter) {} - void finish(int r) { + void finish(int r) override { iter->i = iter->attrset.begin(); } }; @@ -5821,7 +5821,7 @@ struct C_OmapKeysIter : public Context { RadosOmapIter *iter; std::set keys; explicit C_OmapKeysIter(RadosOmapIter *iter) : iter(iter) {} - void finish(int r) { + void finish(int r) override { // map each key to an empty bl for (std::set::const_iterator i = keys.begin(); i != keys.end(); ++i) { diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc index 70a11ec766fe3..202c1c3af5365 100644 --- a/src/test/librados/misc.cc +++ b/src/test/librados/misc.cc @@ -827,7 +827,7 @@ class LibRadosTwoPoolsECPP : public RadosTestECPP { public: LibRadosTwoPoolsECPP() {}; - virtual ~LibRadosTwoPoolsECPP() {}; + ~LibRadosTwoPoolsECPP() {}; protected: static void SetUpTestCase() { pool_name = get_temp_pool_name(); @@ -841,12 +841,12 @@ protected: } static std::string src_pool_name; - virtual void SetUp() { + void SetUp() override { RadosTestECPP::SetUp(); ASSERT_EQ(0, cluster.ioctx_create(src_pool_name.c_str(), src_ioctx)); src_ioctx.set_namespace(nspace); } - virtual void TearDown() { + void TearDown() override { // wait for maps to settle before next test cluster.wait_for_latest_osdmap(); diff --git a/src/test/librados/tier.cc b/src/test/librados/tier.cc index 3b85de64fa137..0b0c78385c7c9 100755 --- a/src/test/librados/tier.cc +++ b/src/test/librados/tier.cc @@ -67,7 +67,7 @@ class LibRadosTwoPoolsPP : public RadosTestPP { public: LibRadosTwoPoolsPP() {}; - virtual ~LibRadosTwoPoolsPP() {}; + ~LibRadosTwoPoolsPP() {}; protected: static void SetUpTestCase() { pool_name = get_temp_pool_name(); @@ -78,14 +78,14 @@ protected: } static std::string cache_pool_name; - virtual void SetUp() { + void SetUp() override { cache_pool_name = get_temp_pool_name(); ASSERT_EQ(0, s_cluster.pool_create(cache_pool_name.c_str())); RadosTestPP::SetUp(); ASSERT_EQ(0, cluster.ioctx_create(cache_pool_name.c_str(), cache_ioctx)); cache_ioctx.set_namespace(nspace); } - virtual void TearDown() { + void TearDown() override { // flush + evict cache flush_evict_all(cluster, cache_ioctx); @@ -2742,7 +2742,7 @@ class LibRadosTwoPoolsECPP : public RadosTestECPP { public: LibRadosTwoPoolsECPP() {}; - virtual ~LibRadosTwoPoolsECPP() {}; + ~LibRadosTwoPoolsECPP() {}; protected: static void SetUpTestCase() { pool_name = get_temp_pool_name(); @@ -2753,14 +2753,14 @@ protected: } static std::string cache_pool_name; - virtual void SetUp() { + void SetUp() override { cache_pool_name = get_temp_pool_name(); ASSERT_EQ(0, s_cluster.pool_create(cache_pool_name.c_str())); RadosTestECPP::SetUp(); ASSERT_EQ(0, cluster.ioctx_create(cache_pool_name.c_str(), cache_ioctx)); cache_ioctx.set_namespace(nspace); } - virtual void TearDown() { + void TearDown() override { // flush + evict cache flush_evict_all(cluster, cache_ioctx); diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 1458c304e3793..87bb579215656 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -31,7 +31,7 @@ static void watch_notify_test_cb(uint8_t opcode, uint64_t ver, void *arg) class WatchNotifyTestCtx : public WatchCtx { public: - void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) + void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override { std::cout << __func__ << std::endl; sem_post(sem); @@ -115,7 +115,7 @@ public: {} void handle_notify(uint64_t notify_id, uint64_t cookie, uint64_t notifier_gid, - bufferlist& bl) { + bufferlist& bl) override { std::cout << __func__ << " cookie " << cookie << " notify_id " << notify_id << " notifier_gid " << notifier_gid << std::endl; notify->notify_bl = bl; @@ -127,7 +127,7 @@ public: notify_ioctx->notify_ack(notify->notify_oid, notify_id, cookie, reply); } - void handle_error(uint64_t cookie, int err) { + void handle_error(uint64_t cookie, int err) override { std::cout << __func__ << " cookie " << cookie << " err " << err << std::endl; assert(cookie > 1000); diff --git a/src/test/librados_test_stub/TestRadosClient.cc b/src/test/librados_test_stub/TestRadosClient.cc index 3de726bd78b14..48a47f84dd29a 100644 --- a/src/test/librados_test_stub/TestRadosClient.cc +++ b/src/test/librados_test_stub/TestRadosClient.cc @@ -64,7 +64,7 @@ public: } } - virtual void finish(int r) { + void finish(int r) override { int ret = m_callback(); if (m_comp != NULL) { if (m_finisher != NULL) {