return item;
}
-static bool match_prefix(const char *key, u8 *index, u16 *len)
+static bool match_base_prefix(const char *key, u8 *index, u16 *len)
{
struct xattr_prefix *p;
- struct ea_type_node *tnode;
- list_for_each_entry(tnode, &ea_name_prefixes, list) {
- p = &tnode->type;
+ for (p = xattr_types; p < xattr_types + ARRAY_SIZE(xattr_types); ++p) {
if (p->prefix && !strncmp(p->prefix, key, p->prefix_len)) {
*len = p->prefix_len;
- *index = tnode->index;
+ *index = p - xattr_types;
return true;
}
}
- for (p = xattr_types; p < xattr_types + ARRAY_SIZE(xattr_types); ++p) {
+ return false;
+}
+
+static bool match_prefix(const char *key, u8 *index, u16 *len)
+{
+ struct xattr_prefix *p;
+ struct ea_type_node *tnode;
+
+ list_for_each_entry(tnode, &ea_name_prefixes, list) {
+ p = &tnode->type;
if (p->prefix && !strncmp(p->prefix, key, p->prefix_len)) {
*len = p->prefix_len;
- *index = p - xattr_types;
+ *index = tnode->index;
return true;
}
}
- return false;
+ return match_base_prefix(key, index, len);
}
static struct xattr_item *parse_one_xattr(const char *path, const char *key,
if (ret)
return ret;
- if (!match_prefix(name, &prefix, &prefixlen))
+ if (!match_base_prefix(name, &prefix, &prefixlen))
return -ENODATA;
it.it.sbi = vi->sbi;