ldout(cct, 5) << "insert_item item " << item << " weight " << weight
<< " name " << name << " loc " << loc << dendl;
+ if (!is_valid_crush_name(name))
+ return -EINVAL;
+
if (name_exists(name)) {
if (get_item_id(name) != item) {
ldout(cct, 10) << "device name '" << name << "' already exists as id "
{
int ret = 0;
int old_iweight;
+
+ if (!is_valid_crush_name(name))
+ return -EINVAL;
+
if (check_item_loc(cct, item, loc, &old_iweight)) {
ldout(cct, 5) << "create_or_move_item " << item << " already at " << loc << dendl;
} else {
<< " name " << name << " loc " << loc << dendl;
int ret = 0;
+ if (!is_valid_crush_name(name))
+ return -EINVAL;
+
// compare quantized (fixed-point integer) weights!
int iweight = (int)(weight * (float)0x10000);
int old_iweight;
return p->second.c_str();
return 0;
}
- void set_item_name(int i, const string& name) {
+ int set_item_name(int i, const string& name) {
+ if (!is_valid_crush_name(name))
+ return -EINVAL;
name_map[i] = name;
if (have_rmaps)
name_rmap[name] = i;
+ return 0;
}
// rule names