diff options
author | Kefu Chai <kchai@redhat.com> | 2021-08-11 05:44:59 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2021-08-13 06:21:39 +0200 |
commit | e0649263829d187ea4026767a9eaeda4489aae6f (patch) | |
tree | 303ebc5b9721150066ee78b38112bbd5eb657bc3 | |
parent | test/rgw: build without "using namespace std" (diff) | |
download | ceph-e0649263829d187ea4026767a9eaeda4489aae6f.tar.xz ceph-e0649263829d187ea4026767a9eaeda4489aae6f.zip |
test/rbd_mirror: build without "using namespace std"
* add "std::" prefix in headers
* add "using" declarations in .cc files.
so we don't rely on "using namespace std" in one or more included
headers.
Signed-off-by: Kefu Chai <kchai@redhat.com>
-rw-r--r-- | src/test/rbd_mirror/image_map/test_Policy.cc | 2 | ||||
-rw-r--r-- | src/test/rbd_mirror/image_replayer/journal/test_mock_Replayer.cc | 2 | ||||
-rw-r--r-- | src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc | 2 | ||||
-rw-r--r-- | src/test/rbd_mirror/random_write.cc | 6 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_ClusterWatcher.cc | 4 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_ImageReplayer.cc | 2 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_PoolWatcher.cc | 4 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_fixture.cc | 2 | ||||
-rw-r--r-- | src/test/rbd_mirror/test_mock_PoolWatcher.cc | 2 |
9 files changed, 17 insertions, 9 deletions
diff --git a/src/test/rbd_mirror/image_map/test_Policy.cc b/src/test/rbd_mirror/image_map/test_Policy.cc index 5f8bdd17fbe..e60ffbfd53c 100644 --- a/src/test/rbd_mirror/image_map/test_Policy.cc +++ b/src/test/rbd_mirror/image_map/test_Policy.cc @@ -24,7 +24,7 @@ public: "0")); CephContext *cct = reinterpret_cast<CephContext *>(m_local_io_ctx.cct()); - std::string policy_type = cct->_conf.get_val<string>("rbd_mirror_image_policy_type"); + std::string policy_type = cct->_conf.get_val<std::string>("rbd_mirror_image_policy_type"); if (policy_type == "none" || policy_type == "simple") { m_policy = image_map::SimplePolicy::create(m_local_io_ctx); diff --git a/src/test/rbd_mirror/image_replayer/journal/test_mock_Replayer.cc b/src/test/rbd_mirror/image_replayer/journal/test_mock_Replayer.cc index 211216eeb94..7c8defb3d60 100644 --- a/src/test/rbd_mirror/image_replayer/journal/test_mock_Replayer.cc +++ b/src/test/rbd_mirror/image_replayer/journal/test_mock_Replayer.cc @@ -18,6 +18,8 @@ #include "test/rbd_mirror/mock/MockSafeTimer.h" #include <boost/intrusive_ptr.hpp> +using namespace std::chrono_literals; + namespace librbd { namespace { diff --git a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc index 5567312f2ac..4798e367617 100644 --- a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc +++ b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc @@ -23,6 +23,8 @@ #include "test/rbd_mirror/mock/MockContextWQ.h" #include "test/rbd_mirror/mock/MockSafeTimer.h" +using namespace std::chrono_literals; + namespace librbd { namespace { diff --git a/src/test/rbd_mirror/random_write.cc b/src/test/rbd_mirror/random_write.cc index 6cb544c4508..373d004a71f 100644 --- a/src/test/rbd_mirror/random_write.cc +++ b/src/test/rbd_mirror/random_write.cc @@ -81,7 +81,7 @@ void rbd_bencher_completion(void *vc, void *pc) { //cout << "complete " << c << std::endl; int ret = c->get_return_value(); if (ret != 0) { - cout << "write error: " << cpp_strerror(ret) << std::endl; + std::cout << "write error: " << cpp_strerror(ret) << std::endl; exit(ret < 0 ? -ret : ret); } b->lock.lock(); @@ -104,7 +104,7 @@ void write_image(librbd::Image &image) { image.size(&size); ceph_assert(size != 0); - vector<uint64_t> thread_offset; + std::vector<uint64_t> thread_offset; uint64_t i; uint64_t start_pos; @@ -152,7 +152,7 @@ int main(int argc, const char **argv) std::vector<const char*> args; argv_to_vec(argc, argv, args); if (args.empty()) { - cerr << argv[0] << ": -h or --help for usage" << std::endl; + std::cerr << argv[0] << ": -h or --help for usage" << std::endl; exit(1); } if (ceph_argparse_need_usage(args)) { diff --git a/src/test/rbd_mirror/test_ClusterWatcher.cc b/src/test/rbd_mirror/test_ClusterWatcher.cc index 03fd3b14247..005a83c1d8e 100644 --- a/src/test/rbd_mirror/test_ClusterWatcher.cc +++ b/src/test/rbd_mirror/test_ClusterWatcher.cc @@ -166,8 +166,8 @@ public: RadosRef m_cluster; ceph::mutex m_lock = ceph::make_mutex("TestClusterWatcherLock"); - unique_ptr<rbd::mirror::ServiceDaemon<>> m_service_daemon; - unique_ptr<ClusterWatcher> m_cluster_watcher; + std::unique_ptr<rbd::mirror::ServiceDaemon<>> m_service_daemon; + std::unique_ptr<ClusterWatcher> m_cluster_watcher; set<string> m_pools; ClusterWatcher::PoolPeers m_pool_peers; diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc index cb21fc72396..1f2b4396efe 100644 --- a/src/test/rbd_mirror/test_ImageReplayer.cc +++ b/src/test/rbd_mirror/test_ImageReplayer.cc @@ -272,7 +272,7 @@ public: return "image" + stringify(++_image_number); } - std::string get_image_id(librados::IoCtx &ioctx, const string &image_name) + std::string get_image_id(librados::IoCtx &ioctx, const std::string &image_name) { std::string obj = librbd::util::id_obj_name(image_name); std::string id; diff --git a/src/test/rbd_mirror/test_PoolWatcher.cc b/src/test/rbd_mirror/test_PoolWatcher.cc index c29ed65afb2..351bba2175b 100644 --- a/src/test/rbd_mirror/test_PoolWatcher.cc +++ b/src/test/rbd_mirror/test_PoolWatcher.cc @@ -30,6 +30,8 @@ #include <set> #include <vector> +using namespace std::chrono_literals; + using rbd::mirror::ImageId; using rbd::mirror::ImageIds; using rbd::mirror::PoolWatcher; @@ -218,7 +220,7 @@ public: ceph::mutex m_lock = ceph::make_mutex("TestPoolWatcherLock"); RadosRef m_cluster; PoolWatcherListener m_pool_watcher_listener; - unique_ptr<PoolWatcher<> > m_pool_watcher; + std::unique_ptr<PoolWatcher<> > m_pool_watcher; set<string> m_pools; ImageIds m_mirrored_images; diff --git a/src/test/rbd_mirror/test_fixture.cc b/src/test/rbd_mirror/test_fixture.cc index 7abf0e3e2a5..f2fd3551ff2 100644 --- a/src/test/rbd_mirror/test_fixture.cc +++ b/src/test/rbd_mirror/test_fixture.cc @@ -64,7 +64,7 @@ void TestFixture::SetUp() { if (!seeded) { seeded = true; int seed = getpid(); - cout << "seed " << seed << std::endl; + std::cout << "seed " << seed << std::endl; srand(seed); } diff --git a/src/test/rbd_mirror/test_mock_PoolWatcher.cc b/src/test/rbd_mirror/test_mock_PoolWatcher.cc index 44efc0532d8..958d934590e 100644 --- a/src/test/rbd_mirror/test_mock_PoolWatcher.cc +++ b/src/test/rbd_mirror/test_mock_PoolWatcher.cc @@ -13,6 +13,8 @@ #include "tools/rbd_mirror/pool_watcher/RefreshImagesRequest.h" #include "include/stringify.h" +using namespace std::chrono_literals; + namespace librbd { namespace { |