Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librbd: eliminate compiler warnings #13729

Merged
merged 1 commit into from Mar 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/test/librbd/test_librbd.cc
Expand Up @@ -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");

Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/test/rbd_mirror/test_mock_InstanceWatcher.cc
Expand Up @@ -56,7 +56,6 @@ ManagedLock<MockTestImageCtx> *ManagedLock<MockTestImageCtx>::s_instance = nullp

// template definitions
#include "tools/rbd_mirror/InstanceWatcher.cc"
template class rbd::mirror::InstanceWatcher<librbd::MockTestImageCtx>;

namespace rbd {
namespace mirror {
Expand Down
10 changes: 10 additions & 0 deletions src/tools/rbd/ArgumentTypes.cc
Expand Up @@ -511,5 +511,15 @@ void validate(boost::any& v, const std::vector<std::string>& values,
v = boost::any(format);
}

void validate(boost::any& v, const std::vector<std::string>& 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
8 changes: 6 additions & 2 deletions src/tools/rbd/ArgumentTypes.h
Expand Up @@ -116,8 +116,7 @@ struct JournalObjectSize {};

struct ExportFormat {};

void validate(boost::any& v, const std::vector<std::string>& values,
ExportFormat *target_type, int);
struct Secret {};

void add_export_format_option(boost::program_options::options_description *opt);

Expand Down Expand Up @@ -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<std::string>& values,
ExportFormat *target_type, int);
void validate(boost::any& v, const std::vector<std::string>& values,
ImageSize *target_type, int);
void validate(boost::any& v, const std::vector<std::string>& values,
Expand All @@ -213,6 +214,9 @@ void validate(boost::any& v, const std::vector<std::string>& values,
Format *target_type, int);
void validate(boost::any& v, const std::vector<std::string>& values,
JournalObjectSize *target_type, int);
void validate(boost::any& v, const std::vector<std::string>& values,
Secret *target_type, int);


std::ostream &operator<<(std::ostream &os, const ImageFeatures &features);

Expand Down
14 changes: 1 addition & 13 deletions src/tools/rbd/Shell.cc
Expand Up @@ -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<std::string>& 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<std::string>(spec.begin(), spec.end(), " ");
}
Expand Down Expand Up @@ -252,7 +240,7 @@ void Shell::get_global_options(po::options_description *opts) {
("user", po::value<std::string>(), "client id (without 'client.' prefix)")
("name,n", po::value<std::string>(), "client name")
("mon_host,m", po::value<std::string>(), "monitor host")
("secret", po::value<Secret>(), "path to secret key (deprecated)")
("secret", po::value<at::Secret>(), "path to secret key (deprecated)")
("keyfile,K", po::value<std::string>(), "path to secret key")
("keyring,k", po::value<std::string>(), "path to keyring");
}
Expand Down