From: John Spray Date: Tue, 11 Jul 2017 12:25:26 +0000 (-0400) Subject: common: re-add unsigned config option type X-Git-Tag: v12.1.2~192^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=72d42de9d0678d3bcc6822a900b0432ca798f154;p=ceph.git common: re-add unsigned config option type As long as some options are being consumed via md_config_t:: members, various users of (unsigned) int values will get compile warnings when they e.g. compare them with other unsigned values. Signed-off-by: John Spray --- diff --git a/src/common/config.cc b/src/common/config.cc index 0ab8e192f485..47c93f7d41b5 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -759,8 +759,6 @@ int md_config_t::set_val(const std::string &key, const char *val, bool meta) if (meta) expand_meta(v, &std::cerr); - std::cerr << "set_val: expanded '" << std::string(val) << "' to '" << v << "'" << std::endl; - string k(ConfFile::normalize_key_name(key)); // subsystems? @@ -991,6 +989,12 @@ int md_config_t::set_val_impl(const std::string &raw_val, const Option &opt, return -EINVAL; } new_value = f; + } else if (opt.type == Option::TYPE_UINT) { + uint64_t f = strict_si_cast(val.c_str(), error_message); + if (!error_message->empty()) { + return -EINVAL; + } + new_value = f; } else if (opt.type == Option::TYPE_STR) { new_value = val; } else if (opt.type == Option::TYPE_FLOAT) { @@ -1058,6 +1062,7 @@ class assign_visitor : public boost::static_visitor<> void operator()( T md_config_t::* ptr) const { T *member = const_cast(&(conf->*(boost::get(ptr)))); + *member = boost::get(val); } }; diff --git a/src/common/config.h b/src/common/config.h index c63bc1a65276..f3117cc46eb9 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -67,6 +67,7 @@ extern const char *CEPH_CONF_FILE_DEFAULT; struct md_config_t { public: typedef boost::variant ceph_options = { .set_default(false) .set_description(""), - Option("ms_dispatch_throttle_bytes", Option::TYPE_INT, Option::LEVEL_ADVANCED) + Option("ms_dispatch_throttle_bytes", Option::TYPE_UINT, Option::LEVEL_ADVANCED) .set_default(100 << 20) .set_description(""), @@ -584,23 +584,23 @@ const std::vector