From: Kefu Chai Date: Wed, 11 Aug 2021 03:41:42 +0000 (+0800) Subject: tools/rbd_mirror: build without "using namespace std" X-Git-Tag: v17.1.0~1121^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7bc3e11ff9b4e2fc30e4447c057b411ddd49d2ab;p=ceph.git tools/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 --- diff --git a/src/tools/rbd_mirror/ClusterWatcher.cc b/src/tools/rbd_mirror/ClusterWatcher.cc index 2ae1306be5a3..8bafb336e8e6 100644 --- a/src/tools/rbd_mirror/ClusterWatcher.cc +++ b/src/tools/rbd_mirror/ClusterWatcher.cc @@ -20,6 +20,7 @@ using std::list; using std::map; +using std::pair; using std::set; using std::string; using std::unique_ptr; diff --git a/src/tools/rbd_mirror/ImageMap.cc b/src/tools/rbd_mirror/ImageMap.cc index 4493e073b98b..b73e090afada 100644 --- a/src/tools/rbd_mirror/ImageMap.cc +++ b/src/tools/rbd_mirror/ImageMap.cc @@ -20,6 +20,8 @@ #define dout_prefix *_dout << "rbd::mirror::ImageMap: " << this << " " \ << __func__ << ": " +using namespace std; + namespace rbd { namespace mirror { diff --git a/src/tools/rbd_mirror/Mirror.cc b/src/tools/rbd_mirror/Mirror.cc index f02cfe65df56..38f35edcd440 100644 --- a/src/tools/rbd_mirror/Mirror.cc +++ b/src/tools/rbd_mirror/Mirror.cc @@ -553,6 +553,7 @@ void Mirror::run() { dout(20) << "enter" << dendl; + using namespace std::chrono_literals; utime_t next_refresh_pools = ceph_clock_now(); while (!m_stopping) { diff --git a/src/tools/rbd_mirror/Throttler.cc b/src/tools/rbd_mirror/Throttler.cc index b2029896390c..07d6e397ec66 100644 --- a/src/tools/rbd_mirror/Throttler.cc +++ b/src/tools/rbd_mirror/Throttler.cc @@ -228,7 +228,7 @@ const char** Throttler::get_tracked_conf_keys() const { template void Throttler::handle_conf_change(const ConfigProxy& conf, - const set &changed) { + const std::set &changed) { if (changed.count(m_config_key)) { set_max_concurrent_ops(conf.get_val(m_config_key)); } diff --git a/src/tools/rbd_mirror/main.cc b/src/tools/rbd_mirror/main.cc index ab350a014cf8..78f3a5c2eb6c 100644 --- a/src/tools/rbd_mirror/main.cc +++ b/src/tools/rbd_mirror/main.cc @@ -37,7 +37,7 @@ int main(int argc, const char **argv) std::vector 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)) {