/// cluster name
string cluster;
+// This macro block defines C members of the md_config_t struct
+// corresponding to the definitions in legacy_config_opts.h.
+// These C members are consumed by code that was written before
+// the new options.cc infrastructure: all newer code should
+// be consume options via explicit get() rather than C members.
#define OPTION_OPT_INT(name) const int name;
#define OPTION_OPT_LONGLONG(name) const long long name;
#define OPTION_OPT_STR(name) const std::string name;
value_t min, max;
std::list<std::string> enum_allowed;
+ bool safe;
+
Option(const char* name, type_t t, level_t l)
- : name(name), type(t), level(l)
+ : name(name), type(t), level(l), safe(false)
{}
// bool is an integer, but we don't think so. teach it the hard way.
max = ma;
return *this;
}
+
+ Option &set_safe() {
+ safe = true;
+ return *this;
+ }
+
+ /**
+ * A crude indicator of whether the value may be
+ * modified safely at runtime -- should be replaced
+ * with proper locking!
+ */
+ bool is_safe() const
+ {
+ return type == TYPE_INT || type == TYPE_FLOAT;
+ }
};
extern const std::vector<Option> ceph_options;
<< " .set_description(\"\"),\n\n";
#define OPTION_VALIDATOR(name)
-#define SAFE_OPTION(name, type, def_val) OPTION(name, type, def_val)
+#define SAFE_OPTION(name, type, def_val) \
+ cout << " Option(\"" << STRINGIFY(name) << "\", Option::" << convert_type(STRINGIFY(type)) \
+ << ", Option::LEVEL_ADVANCED)\n" \
+ << " .set_default(" << STRINGIFY(def_val) << ")\n" \
+ << " .set_description(\"\")\n"; \
+ << " .set_safe(),\n\n";
+
#define SUBSYS(name, log, gather)
#define DEFAULT_SUBSYS(log, gather)