From 445cac55c0195e458c57290a10140989de65c741 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 1 Mar 2017 10:34:58 -0500 Subject: [PATCH] librbd: eliminate compiler warnings Signed-off-by: Jason Dillaman --- src/test/librbd/test_librbd.cc | 13 +++++++------ src/test/rbd_mirror/test_mock_InstanceWatcher.cc | 1 - src/tools/rbd/ArgumentTypes.cc | 10 ++++++++++ src/tools/rbd/ArgumentTypes.h | 8 ++++++-- src/tools/rbd/Shell.cc | 14 +------------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 41711c95f13..3dcf44290e8 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -1489,7 +1489,7 @@ void aio_writesame_test_data(rbd_image_t image, const char *test_data, uint64_t off += data_len; left -= data_len; } - ASSERT_EQ(0, left); + ASSERT_EQ(0U, left); free(result); printf("verified\n"); @@ -1528,7 +1528,7 @@ void writesame_test_data(rbd_image_t image, const char *test_data, uint64_t off, off += data_len; left -= data_len; } - ASSERT_EQ(0, left); + ASSERT_EQ(0U, left); free(result); printf("verified\n"); @@ -2103,14 +2103,15 @@ void aio_writesame_test_data(librbd::Image& image, const char *test_data, off_t off += data_len; left -= data_len; } - ASSERT_EQ(0, left); + ASSERT_EQ(0U, left); printf("verified\n"); *passed = true; } -void writesame_test_data(librbd::Image& image, const char *test_data, off_t off, size_t len, - size_t data_len, uint32_t iohint, bool *passed) +void writesame_test_data(librbd::Image& image, const char *test_data, off_t off, + ssize_t len, size_t data_len, uint32_t iohint, + bool *passed) { ssize_t written; ceph::bufferlist bl; @@ -2144,7 +2145,7 @@ void writesame_test_data(librbd::Image& image, const char *test_data, off_t off, off += data_len; left -= data_len; } - ASSERT_EQ(0, left); + ASSERT_EQ(0U, left); printf("verified\n"); *passed = true; diff --git a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc index f2f451a5298..87aa65f3b3b 100644 --- a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc +++ b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc @@ -56,7 +56,6 @@ ManagedLock *ManagedLock::s_instance = nullp // template definitions #include "tools/rbd_mirror/InstanceWatcher.cc" -template class rbd::mirror::InstanceWatcher; namespace rbd { namespace mirror { diff --git a/src/tools/rbd/ArgumentTypes.cc b/src/tools/rbd/ArgumentTypes.cc index 0bb92f98453..9e11bdc77cf 100644 --- a/src/tools/rbd/ArgumentTypes.cc +++ b/src/tools/rbd/ArgumentTypes.cc @@ -511,5 +511,15 @@ void validate(boost::any& v, const std::vector& values, v = boost::any(format); } +void validate(boost::any& v, const std::vector& values, + Secret *target_type, int) { + std::cerr << "rbd: --secret is deprecated, use --keyfile" << std::endl; + + po::validators::check_first_occurrence(v); + const std::string &s = po::validators::get_single_string(values); + g_conf->set_val_or_die("keyfile", s.c_str()); + v = boost::any(s); +} + } // namespace argument_types } // namespace rbd diff --git a/src/tools/rbd/ArgumentTypes.h b/src/tools/rbd/ArgumentTypes.h index c18ceb2ddb4..b8e555a0b77 100644 --- a/src/tools/rbd/ArgumentTypes.h +++ b/src/tools/rbd/ArgumentTypes.h @@ -116,8 +116,7 @@ struct JournalObjectSize {}; struct ExportFormat {}; -void validate(boost::any& v, const std::vector& values, - ExportFormat *target_type, int); +struct Secret {}; void add_export_format_option(boost::program_options::options_description *opt); @@ -197,6 +196,8 @@ void add_no_error_option(boost::program_options::options_description *opt); std::string get_short_features_help(bool append_suffix); std::string get_long_features_help(); +void validate(boost::any& v, const std::vector& values, + ExportFormat *target_type, int); void validate(boost::any& v, const std::vector& values, ImageSize *target_type, int); void validate(boost::any& v, const std::vector& values, @@ -213,6 +214,9 @@ void validate(boost::any& v, const std::vector& values, Format *target_type, int); void validate(boost::any& v, const std::vector& values, JournalObjectSize *target_type, int); +void validate(boost::any& v, const std::vector& values, + Secret *target_type, int); + std::ostream &operator<<(std::ostream &os, const ImageFeatures &features); diff --git a/src/tools/rbd/Shell.cc b/src/tools/rbd/Shell.cc index a08734d3b39..0ad75dab3c3 100644 --- a/src/tools/rbd/Shell.cc +++ b/src/tools/rbd/Shell.cc @@ -23,18 +23,6 @@ static const std::string APP_NAME("rbd"); static const std::string HELP_SPEC("help"); static const std::string BASH_COMPLETION_SPEC("bash-completion"); -struct Secret {}; - -void validate(boost::any& v, const std::vector& values, - Secret *target_type, int) { - std::cerr << "rbd: --secret is deprecated, use --keyfile" << std::endl; - - po::validators::check_first_occurrence(v); - const std::string &s = po::validators::get_single_string(values); - g_conf->set_val_or_die("keyfile", s.c_str()); - v = boost::any(s); -} - std::string format_command_spec(const Shell::CommandSpec &spec) { return joinify(spec.begin(), spec.end(), " "); } @@ -252,7 +240,7 @@ void Shell::get_global_options(po::options_description *opts) { ("user", po::value(), "client id (without 'client.' prefix)") ("name,n", po::value(), "client name") ("mon_host,m", po::value(), "monitor host") - ("secret", po::value(), "path to secret key (deprecated)") + ("secret", po::value(), "path to secret key (deprecated)") ("keyfile,K", po::value(), "path to secret key") ("keyring,k", po::value(), "path to keyring"); }