From: Kefu Chai Date: Wed, 22 Jul 2020 08:15:51 +0000 (+0800) Subject: test/librados_test_stub: use std::bind X-Git-Tag: wip-pdonnell-testing-20200918.022351~565^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5c1a5bcf18b79e9deb70143f40ae01bbad74444b;p=ceph-ci.git test/librados_test_stub: use std::bind replace boost::bind() with std::bind(), the use of the Boost placeholders in the default namespace is deprecated. let's take this opportunity to use its counterpart in standard library Signed-off-by: Kefu Chai --- diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index c1f1f72db3d..a90b0966d24 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -20,9 +20,9 @@ #include "objclass/objclass.h" #include "osd/osd_types.h" #include -#include #include #include +#include #include #include #include "include/ceph_assert.h" @@ -343,6 +343,8 @@ extern "C" int rados_wait_for_latest_osdmap(rados_t cluster) { return client->wait_for_latest_osdmap(); } +using namespace std::placeholders; + namespace librados { AioCompletion::~AioCompletion() @@ -511,7 +513,7 @@ void IoCtx::close() { int IoCtx::create(const std::string& oid, bool exclusive) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, + oid, std::bind(&TestIoCtxImpl::create, _1, _2, exclusive, ctx->get_snap_context())); } @@ -525,7 +527,7 @@ int IoCtx::exec(const std::string& oid, const char *cls, const char *method, bufferlist& inbl, bufferlist& outbl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::exec, _1, _2, + oid, std::bind(&TestIoCtxImpl::exec, _1, _2, librados_test_stub::get_class_handler(), cls, method, inbl, &outbl, ctx->get_snap_read(), ctx->get_snap_context())); @@ -562,14 +564,14 @@ std::string IoCtx::get_pool_name() { int IoCtx::list_snaps(const std::string& o, snap_set_t *out_snaps) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - o, boost::bind(&TestIoCtxImpl::list_snaps, _1, _2, out_snaps)); + o, std::bind(&TestIoCtxImpl::list_snaps, _1, _2, out_snaps)); } int IoCtx::list_watchers(const std::string& o, std::list *out_watchers) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - o, boost::bind(&TestIoCtxImpl::list_watchers, _1, _2, out_watchers)); + o, std::bind(&TestIoCtxImpl::list_watchers, _1, _2, out_watchers)); } int IoCtx::notify(const std::string& o, uint64_t ver, bufferlist& bl) { @@ -595,7 +597,7 @@ int IoCtx::omap_get_vals(const std::string& oid, std::map *out_vals) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::omap_get_vals, _1, _2, start_after, "", + oid, std::bind(&TestIoCtxImpl::omap_get_vals, _1, _2, start_after, "", max_return, out_vals)); } @@ -616,14 +618,14 @@ int IoCtx::read(const std::string& oid, bufferlist& bl, size_t len, uint64_t off) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl, + oid, std::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl, ctx->get_snap_read())); } int IoCtx::remove(const std::string& oid) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::remove, _1, _2, ctx->get_snap_context())); + oid, std::bind(&TestIoCtxImpl::remove, _1, _2, ctx->get_snap_context())); } int IoCtx::selfmanaged_snap_create(uint64_t *snapid) { @@ -667,26 +669,26 @@ int IoCtx::sparse_read(const std::string& oid, std::map& m, bufferlist& bl, size_t len, uint64_t off) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl, + oid, std::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl, ctx->get_snap_read())); } int IoCtx::stat(const std::string& oid, uint64_t *psize, time_t *pmtime) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::stat, _1, _2, psize, pmtime)); + oid, std::bind(&TestIoCtxImpl::stat, _1, _2, psize, pmtime)); } int IoCtx::tmap_update(const std::string& oid, bufferlist& cmdbl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::tmap_update, _1, _2, cmdbl)); + oid, std::bind(&TestIoCtxImpl::tmap_update, _1, _2, cmdbl)); } int IoCtx::trunc(const std::string& oid, uint64_t off) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, + oid, std::bind(&TestIoCtxImpl::truncate, _1, _2, off, ctx->get_snap_context())); } @@ -716,14 +718,14 @@ int IoCtx::write(const std::string& oid, bufferlist& bl, size_t len, uint64_t off) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::write, _1, _2, bl, len, off, + oid, std::bind(&TestIoCtxImpl::write, _1, _2, bl, len, off, ctx->get_snap_context())); } int IoCtx::write_full(const std::string& oid, bufferlist& bl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, + oid, std::bind(&TestIoCtxImpl::write_full, _1, _2, bl, ctx->get_snap_context())); } @@ -731,14 +733,14 @@ int IoCtx::writesame(const std::string& oid, bufferlist& bl, size_t len, uint64_t off) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len, off, + oid, std::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len, off, ctx->get_snap_context())); } int IoCtx::cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) { TestIoCtxImpl *ctx = reinterpret_cast(io_ctx_impl); return ctx->execute_operation( - oid, boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, + oid, std::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, ctx->get_snap_read())); } @@ -810,13 +812,13 @@ ObjectOperation::~ObjectOperation() { void ObjectOperation::assert_exists() { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::assert_exists, _1, _2, _4)); + o->ops.push_back(std::bind(&TestIoCtxImpl::assert_exists, _1, _2, _4)); } void ObjectOperation::exec(const char *cls, const char *method, bufferlist& inbl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::exec, _1, _2, + o->ops.push_back(std::bind(&TestIoCtxImpl::exec, _1, _2, librados_test_stub::get_class_handler(), cls, method, inbl, _3, _4, _5)); } @@ -832,11 +834,11 @@ size_t ObjectOperation::size() { void ObjectOperation::cmpext(uint64_t off, const bufferlist& cmp_bl, int *prval) { TestObjectOperationImpl *o = reinterpret_cast(impl); - ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, + ObjectOperationTestImpl op = std::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, _4); if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } @@ -844,11 +846,11 @@ void ObjectOperation::cmpext(uint64_t off, const bufferlist& cmp_bl, void ObjectReadOperation::list_snaps(snap_set_t *out_snaps, int *prval) { TestObjectOperationImpl *o = reinterpret_cast(impl); - ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::list_snaps, _1, _2, + ObjectOperationTestImpl op = std::bind(&TestIoCtxImpl::list_snaps, _1, _2, out_snaps); if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } @@ -857,11 +859,11 @@ void ObjectReadOperation::list_watchers(std::list *out_watchers, int *prval) { TestObjectOperationImpl *o = reinterpret_cast(impl); - ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::list_watchers, _1, + ObjectOperationTestImpl op = std::bind(&TestIoCtxImpl::list_watchers, _1, _2, out_watchers); if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } @@ -872,14 +874,14 @@ void ObjectReadOperation::read(size_t off, uint64_t len, bufferlist *pbl, ObjectOperationTestImpl op; if (pbl != NULL) { - op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl, _4); + op = std::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl, _4); } else { - op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3, _4); + op = std::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3, _4); } if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } @@ -891,14 +893,14 @@ void ObjectReadOperation::sparse_read(uint64_t off, uint64_t len, ObjectOperationTestImpl op; if (pbl != NULL) { - op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl, _4); + op = std::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl, _4); } else { - op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3, _4); + op = std::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3, _4); } if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } @@ -906,46 +908,46 @@ void ObjectReadOperation::sparse_read(uint64_t off, uint64_t len, void ObjectReadOperation::stat(uint64_t *psize, time_t *pmtime, int *prval) { TestObjectOperationImpl *o = reinterpret_cast(impl); - ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::stat, _1, _2, + ObjectOperationTestImpl op = std::bind(&TestIoCtxImpl::stat, _1, _2, psize, pmtime); if (prval != NULL) { - op = boost::bind(save_operation_result, - boost::bind(op, _1, _2, _3, _4, _5), prval); + op = std::bind(save_operation_result, + std::bind(op, _1, _2, _3, _4, _5), prval); } o->ops.push_back(op); } void ObjectWriteOperation::append(const bufferlist &bl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::append, _1, _2, bl, _5)); } void ObjectWriteOperation::create(bool exclusive) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _5)); } void ObjectWriteOperation::omap_set(const std::map &map) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::omap_set, _1, _2, boost::ref(map))); + o->ops.push_back(std::bind(&TestIoCtxImpl::omap_set, _1, _2, boost::ref(map))); } void ObjectWriteOperation::remove() { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::remove, _1, _2, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::remove, _1, _2, _5)); } void ObjectWriteOperation::selfmanaged_snap_rollback(uint64_t snapid) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::selfmanaged_snap_rollback, + o->ops.push_back(std::bind(&TestIoCtxImpl::selfmanaged_snap_rollback, _1, _2, snapid)); } void ObjectWriteOperation::set_alloc_hint(uint64_t expected_object_size, uint64_t expected_write_size) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2, + o->ops.push_back(std::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2, expected_object_size, expected_write_size, 0, _5)); } @@ -954,43 +956,43 @@ void ObjectWriteOperation::set_alloc_hint2(uint64_t expected_object_size, uint64_t expected_write_size, uint32_t flags) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2, + o->ops.push_back(std::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2, expected_object_size, expected_write_size, flags, _5)); } void ObjectWriteOperation::tmap_update(const bufferlist& cmdbl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::tmap_update, _1, _2, + o->ops.push_back(std::bind(&TestIoCtxImpl::tmap_update, _1, _2, cmdbl)); } void ObjectWriteOperation::truncate(uint64_t off) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::truncate, _1, _2, off, _5)); } void ObjectWriteOperation::write(uint64_t off, const bufferlist& bl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::write, _1, _2, bl, bl.length(), + o->ops.push_back(std::bind(&TestIoCtxImpl::write, _1, _2, bl, bl.length(), off, _5)); } void ObjectWriteOperation::write_full(const bufferlist& bl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _5)); } void ObjectWriteOperation::writesame(uint64_t off, uint64_t len, const bufferlist& bl) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len, + o->ops.push_back(std::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len, off, _5)); } void ObjectWriteOperation::zero(uint64_t off, uint64_t len) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _5)); + o->ops.push_back(std::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _5)); } Rados::Rados() : client(NULL) { diff --git a/src/test/librados_test_stub/NeoradosTestStub.cc b/src/test/librados_test_stub/NeoradosTestStub.cc index 2121a6fb8eb..533b959701e 100644 --- a/src/test/librados_test_stub/NeoradosTestStub.cc +++ b/src/test/librados_test_stub/NeoradosTestStub.cc @@ -17,10 +17,11 @@ #include #include #include -#include +#include #include namespace bs = boost::system; +using namespace std::placeholders; namespace neorados { namespace detail { @@ -237,17 +238,17 @@ Op::~Op() { void Op::assert_exists() { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::assert_exists, _1, _2, _4)); } void Op::cmpext(uint64_t off, ceph::buffer::list&& cmp_bl, std::size_t* s) { auto o = *reinterpret_cast(&impl); - librados::ObjectOperationTestImpl op = boost::bind( + librados::ObjectOperationTestImpl op = std::bind( &librados::TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, _4); if (s != nullptr) { - op = boost::bind( - save_operation_size, boost::bind(op, _1, _2, _3, _4, _5), s); + op = std::bind( + save_operation_size, std::bind(op, _1, _2, _3, _4, _5), s); } o->ops.push_back(op); } @@ -302,8 +303,8 @@ void Op::exec(std::string_view cls, std::string_view method, (out != nullptr ? out : outbl), snap_id, snapc); }; if (ec != nullptr) { - op = boost::bind( - save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec); + op = std::bind( + save_operation_ec, std::bind(op, _1, _2, _3, _4, _5), ec); } o->ops.push_back(op); } @@ -323,8 +324,8 @@ void Op::exec(std::string_view cls, std::string_view method, std::string(method).c_str(), inbl, outbl, snap_id, snapc); }; if (ec != NULL) { - op = boost::bind( - save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec); + op = std::bind( + save_operation_ec, std::bind(op, _1, _2, _3, _4, _5), ec); } o->ops.push_back(op); } @@ -334,14 +335,14 @@ void ReadOp::read(size_t off, uint64_t len, ceph::buffer::list* out, auto o = *reinterpret_cast(&impl); librados::ObjectOperationTestImpl op; if (out != nullptr) { - op = boost::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, out, _4); + op = std::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, out, _4); } else { - op = boost::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, _3, _4); + op = std::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, _3, _4); } if (ec != NULL) { - op = boost::bind( - save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec); + op = std::bind( + save_operation_ec, std::bind(op, _1, _2, _3, _4, _5), ec); } o->ops.push_back(op); } @@ -366,52 +367,52 @@ void ReadOp::sparse_read(uint64_t off, uint64_t len, return r; }; if (ec != NULL) { - op = boost::bind(save_operation_ec, - boost::bind(op, _1, _2, _3, _4, _5), ec); + op = std::bind(save_operation_ec, + std::bind(op, _1, _2, _3, _4, _5), ec); } o->ops.push_back(op); } void WriteOp::create(bool exclusive) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::create, _1, _2, exclusive, _5)); } void WriteOp::write(uint64_t off, ceph::buffer::list&& bl) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::write, _1, _2, bl, bl.length(), off, _5)); } void WriteOp::write_full(ceph::buffer::list&& bl) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::write_full, _1, _2, bl, _5)); } void WriteOp::remove() { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::remove, _1, _2, _5)); } void WriteOp::truncate(uint64_t off) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::truncate, _1, _2, off, _5)); } void WriteOp::zero(uint64_t off, uint64_t len) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::zero, _1, _2, off, len, _5)); } void WriteOp::writesame(std::uint64_t off, std::uint64_t write_len, ceph::buffer::list&& bl) { auto o = *reinterpret_cast(&impl); - o->ops.push_back(boost::bind( + o->ops.push_back(std::bind( &librados::TestIoCtxImpl::writesame, _1, _2, bl, write_len, off, _5)); } diff --git a/src/test/librados_test_stub/TestIoCtxImpl.cc b/src/test/librados_test_stub/TestIoCtxImpl.cc index 2aaf29d578b..0afc13de29c 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestIoCtxImpl.cc @@ -10,7 +10,7 @@ #include "common/Finisher.h" #include "common/valgrind.h" #include "objclass/objclass.h" -#include +#include #include namespace librados { @@ -109,7 +109,7 @@ int TestIoCtxImpl::aio_operate(const std::string& oid, TestObjectOperationImpl & // TODO flags for now ops.get(); m_pending_ops++; - m_client->add_aio_operation(oid, true, boost::bind( + m_client->add_aio_operation(oid, true, std::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, reinterpret_cast(0), m_snap_seq, snap_context != NULL ? *snap_context : m_snapc), c); @@ -123,7 +123,7 @@ int TestIoCtxImpl::aio_operate_read(const std::string& oid, // TODO ignoring flags for now ops.get(); m_pending_ops++; - m_client->add_aio_operation(oid, true, boost::bind( + m_client->add_aio_operation(oid, true, std::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, snap_id, m_snapc), c); return 0; @@ -209,7 +209,7 @@ int TestIoCtxImpl::operate(const std::string& oid, ops.get(); m_pending_ops++; - m_client->add_aio_operation(oid, false, boost::bind( + m_client->add_aio_operation(oid, false, std::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, reinterpret_cast(0), m_snap_seq, m_snapc), comp); @@ -226,7 +226,7 @@ int TestIoCtxImpl::operate_read(const std::string& oid, ops.get(); m_pending_ops++; - m_client->add_aio_operation(oid, false, boost::bind( + m_client->add_aio_operation(oid, false, std::bind( &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snap_seq, m_snapc), comp); @@ -240,14 +240,14 @@ void TestIoCtxImpl::aio_selfmanaged_snap_create(uint64_t *snapid, AioCompletionImpl *c) { m_client->add_aio_operation( "", true, - boost::bind(&TestIoCtxImpl::selfmanaged_snap_create, this, snapid), c); + std::bind(&TestIoCtxImpl::selfmanaged_snap_create, this, snapid), c); } void TestIoCtxImpl::aio_selfmanaged_snap_remove(uint64_t snapid, AioCompletionImpl *c) { m_client->add_aio_operation( "", true, - boost::bind(&TestIoCtxImpl::selfmanaged_snap_remove, this, snapid), c); + std::bind(&TestIoCtxImpl::selfmanaged_snap_remove, this, snapid), c); } int TestIoCtxImpl::selfmanaged_snap_set_write_ctx(snap_t seq, diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc index d1f2f8cda51..192e17fac07 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc @@ -6,8 +6,8 @@ #include "common/Clock.h" #include "common/RWLock.h" #include "include/err.h" +#include #include -#include #include #include @@ -59,8 +59,8 @@ TestIoCtxImpl *TestMemIoCtxImpl::clone() { int TestMemIoCtxImpl::aio_remove(const std::string& oid, AioCompletionImpl *c, int flags) { m_client->add_aio_operation(oid, true, - boost::bind(&TestMemIoCtxImpl::remove, this, oid, - get_snap_context()), + std::bind(&TestMemIoCtxImpl::remove, this, oid, + get_snap_context()), c); return 0; } diff --git a/src/test/librados_test_stub/TestRadosClient.cc b/src/test/librados_test_stub/TestRadosClient.cc index aa002af4766..c426f2fcf4d 100644 --- a/src/test/librados_test_stub/TestRadosClient.cc +++ b/src/test/librados_test_stub/TestRadosClient.cc @@ -8,12 +8,12 @@ #include "common/ceph_json.h" #include "common/Finisher.h" #include "common/async/context_pool.h" -#include #include #include #include #include +#include #include static int get_concurrency() { @@ -31,6 +31,8 @@ static int get_concurrency() { return concurrency; } +using namespace std::placeholders; + namespace librados { namespace { @@ -82,7 +84,7 @@ public: int ret = m_callback(); if (m_comp != NULL) { if (m_finisher != NULL) { - m_finisher->queue(new LambdaContext(boost::bind( + m_finisher->queue(new LambdaContext(std::bind( &finish_aio_completion, m_comp, ret))); } else { finish_aio_completion(m_comp, ret); @@ -252,7 +254,7 @@ void TestRadosClient::add_aio_operation(const std::string& oid, struct WaitForFlush { int flushed() { if (--count == 0) { - aio_finisher->queue(new LambdaContext(boost::bind( + aio_finisher->queue(new LambdaContext(std::bind( &finish_aio_completion, c, 0))); delete this; } @@ -281,7 +283,7 @@ void TestRadosClient::flush_aio_operations(AioCompletionImpl *c) { for (size_t i = 0; i < m_finishers.size(); ++i) { AioFunctionContext *ctx = new AioFunctionContext( - boost::bind(&WaitForFlush::flushed, wait_for_flush), + std::bind(&WaitForFlush::flushed, wait_for_flush), nullptr, nullptr); m_finishers[i]->queue(ctx); } @@ -289,7 +291,7 @@ void TestRadosClient::flush_aio_operations(AioCompletionImpl *c) { int TestRadosClient::aio_watch_flush(AioCompletionImpl *c) { c->get(); - Context *ctx = new LambdaContext(boost::bind( + Context *ctx = new LambdaContext(std::bind( &TestRadosClient::finish_aio_completion, this, c, _1)); get_watch_notify()->aio_flush(this, ctx); return 0;