[A-Za-z0-9-_.]+
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
o.push_back(new CrushWrapper);
// fixme
}
+
+
+bool CrushWrapper::is_valid_crush_name(const string& s)
+{
+ if (s.empty())
+ return false;
+ for (string::const_iterator p = s.begin(); p != s.end(); ++p) {
+ if (!(*p == '-') &&
+ !(*p == '_') &&
+ !(*p == '.') &&
+ !(*p >= '0' && *p <= '9') &&
+ !(*p >= 'A' && *p <= 'Z') &&
+ !(*p >= 'a' && *p <= 'z'))
+ return false;
+ }
+ return true;
+}
void dump_rules(Formatter *f) const;
void list_rules(Formatter *f) const;
static void generate_test_instances(list<CrushWrapper*>& o);
+
+
+ static bool is_valid_crush_name(const string& s);
};
WRITE_CLASS_ENCODER(CrushWrapper)