~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/common/config.cc

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-08-27 08:23:21 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120827082321-2cfej6ddvk63vsqq
Tags: upstream-0.48.1
ImportĀ upstreamĀ versionĀ 0.48.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
int md_config_t::parse_config_files_impl(const std::list<std::string> &conf_files,
199
199
                                         std::deque<std::string> *parse_errors)
200
200
{
201
 
  Mutex::Locker l(lock);
 
201
  assert(lock.is_locked());
 
202
 
202
203
  // open new conf
203
204
  list<string>::const_iterator c;
204
205
  for (c = conf_files.begin(); c != conf_files.end(); ++c) {
215
216
    return -EINVAL;
216
217
 
217
218
  std::vector <std::string> my_sections;
218
 
  get_my_sections(my_sections);
 
219
  _get_my_sections(my_sections);
219
220
  for (int i = 0; i < NUM_CONFIG_OPTIONS; i++) {
220
221
    config_option *opt = &config_optionsp[i];
221
222
    std::string val;
222
 
    int ret = get_val_from_conf_file(my_sections, opt->name, val, false);
 
223
    int ret = _get_val_from_conf_file(my_sections, opt->name, val, false);
223
224
    if (ret == 0) {
224
225
      set_val_impl(val.c_str(), opt);
225
226
    }
230
231
    std::string as_option("debug_");
231
232
    as_option += subsys.get_name(o);
232
233
    std::string val;
233
 
    int ret = get_val_from_conf_file(my_sections, as_option.c_str(), val, false);
 
234
    int ret = _get_val_from_conf_file(my_sections, as_option.c_str(), val, false);
234
235
    if (ret == 0) {
235
236
      int log, gather;
236
237
      int r = sscanf(val.c_str(), "%d/%d", &log, &gather);
433
434
      } else {
434
435
        std::string no("--no-");
435
436
        no += opt->name;
436
 
        if (ceph_argparse_flag(args, i, &res, no.c_str(), (char*)NULL)) {
 
437
        if (ceph_argparse_flag(args, i, no.c_str(), (char*)NULL)) {
437
438
          set_val_impl("false", opt);
438
439
          break;
439
440
        }
736
737
void md_config_t::get_my_sections(std::vector <std::string> &sections) const
737
738
{
738
739
  Mutex::Locker l(lock);
 
740
  _get_my_sections(sections);
 
741
}
 
742
 
 
743
void md_config_t::_get_my_sections(std::vector <std::string> &sections) const
 
744
{
 
745
  assert(lock.is_locked());
739
746
  sections.push_back(name.to_str());
740
747
 
741
748
  sections.push_back(name.get_type_name());
758
765
                    const char *key, std::string &out, bool emeta) const
759
766
{
760
767
  Mutex::Locker l(lock);
 
768
  return _get_val_from_conf_file(sections, key, out, emeta);
 
769
}
 
770
 
 
771
int md_config_t::_get_val_from_conf_file(const std::vector <std::string> &sections,
 
772
                                         const char *key, std::string &out, bool emeta) const
 
773
{
 
774
  assert(lock.is_locked());
761
775
  std::vector <std::string>::const_iterator s = sections.begin();
762
776
  std::vector <std::string>::const_iterator s_end = sections.end();
763
777
  for (; s != s_end; ++s) {