Skip to content

Commit 9c12e2d

Browse files
Merge pull request ceph#61025 from MaxKellermann/config_legacy_values__static
common/config: make `legacy_values` static
2 parents 83224cc + 895691e commit 9c12e2d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/common/config.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config,/etc/ceph/$cluster.conf,$
7070
#define _STR(x) #x
7171
#define STRINGIFY(x) _STR(x)
7272

73+
// Populate list of legacy_values according to the OPTION() definitions
74+
// Note that this is just setting up our map of name->member ptr. The
75+
// default values etc will get loaded in along with new-style data,
76+
// as all loads write to both the values map, and the legacy
77+
// members if present.
78+
const std::map<std::string_view, md_config_t::member_ptr_t> md_config_t::legacy_values = {
79+
#define OPTION(name, type) \
80+
{STRINGIFY(name), &ConfigValues::name},
81+
#define SAFE_OPTION(name, type) OPTION(name, type)
82+
#include "options/legacy_config_opts.h"
83+
#undef OPTION
84+
#undef SAFE_OPTION
85+
};
86+
7387
const char *ceph_conf_level_name(int level)
7488
{
7589
switch (level) {
@@ -172,20 +186,6 @@ md_config_t::md_config_t(ConfigValues& values,
172186
schema.emplace(opt.name, opt);
173187
}
174188

175-
// Populate list of legacy_values according to the OPTION() definitions
176-
// Note that this is just setting up our map of name->member ptr. The
177-
// default values etc will get loaded in along with new-style data,
178-
// as all loads write to both the values map, and the legacy
179-
// members if present.
180-
legacy_values = {
181-
#define OPTION(name, type) \
182-
{STRINGIFY(name), &ConfigValues::name},
183-
#define SAFE_OPTION(name, type) OPTION(name, type)
184-
#include "options/legacy_config_opts.h"
185-
#undef OPTION
186-
#undef SAFE_OPTION
187-
};
188-
189189
validate_schema();
190190

191191
// Validate default values from the schema

src/common/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct md_config_t {
9292
/*
9393
* Mapping from legacy config option names to class members
9494
*/
95-
std::map<std::string_view, member_ptr_t> legacy_values;
95+
static const std::map<std::string_view, member_ptr_t> legacy_values;
9696

9797
/**
9898
* The configuration schema, in the form of Option objects describing

0 commit comments

Comments
 (0)