return -ENOSYS;
}
- bool show_config = false;
- bool show_config_value = false;
- string show_config_value_arg;
-
// In this function, don't change any parts of the configuration directly.
// Instead, use set_val to set them. This will allow us to send the proper
// observer notifications later.
_exit(0);
}
else if (ceph_argparse_flag(args, i, "--show_config", (char*)NULL)) {
- show_config = true;
+ do_show_config = true;
}
else if (ceph_argparse_witharg(args, i, &val, "--show_config_value", (char*)NULL)) {
- show_config_value = true;
- show_config_value_arg = val;
+ do_show_config_value = val;
}
else if (ceph_argparse_flag(args, i, "--foreground", "-f", (char*)NULL)) {
set_val_or_die("daemonize", "false");
}
}
}
+ return 0;
+}
+
+void md_config_t::do_argv_commands()
+{
+ Mutex::Locker l(lock);
- if (show_config) {
+ if (do_show_config) {
_show_config(&cout, NULL);
_exit(0);
}
- if (show_config_value) {
+ if (do_show_config_value.size()) {
string val;
- int r = conf_stringify(_get_val(show_config_value_arg), &val);
+ int r = conf_stringify(_get_val(do_show_config_value), &val);
if (r < 0) {
if (r == -ENOENT)
std::cerr << "failed to get config option '"
- << show_config_value_arg << "': option not found" << std::endl;
+ << do_show_config_value << "': option not found" << std::endl;
else
std::cerr << "failed to get config option '"
- << show_config_value_arg << "': " << cpp_strerror(r)
+ << do_show_config_value << "': " << cpp_strerror(r)
<< std::endl;
_exit(1);
}
std::cout << val << std::endl;
_exit(0);
}
-
- return 0;
}
int md_config_t::parse_option(std::vector<const char*>& args,
// Absorb config settings from argv
int parse_argv(std::vector<const char*>& args);
+ // do any commands we got from argv (--show-config, --show-config-val)
+ void do_argv_commands();
+
// Expand all metavariables. Make any pending observer callbacks.
void apply_changes(std::ostream *oss);
void _apply_changes(std::ostream *oss);
// Once it is true, it will never change.
bool safe_to_start_threads = false;
+ bool do_show_config = false;
+ string do_show_config_value;
+
obs_map_t observers;
changed_set_t changed;