@@ -73,7 +73,7 @@ hash_f(
if (use_dir2_hash)
hashval = libxfs_dir2_hashname(mp, &xname);
else
- hashval = libxfs_da_hashname(xname.name, xname.len);
+ hashval = libxfs_attr_hashname(xname.name, xname.len);
dbprintf("0x%x\n", hashval);
}
@@ -306,7 +306,7 @@ collide_xattrs(
unsigned long i;
int error = 0;
- old_hash = libxfs_da_hashname((uint8_t *)name, namelen);
+ old_hash = libxfs_attr_hashname((uint8_t *)name, namelen);
if (fd >= 0) {
/*
@@ -331,8 +331,8 @@ collide_xattrs(
snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
obfuscate_name(old_hash, namelen, (uint8_t *)xattrname + 5,
false);
- ASSERT(old_hash == libxfs_da_hashname((uint8_t *)xattrname + 5,
- namelen));
+ ASSERT(old_hash == libxfs_attr_hashname(
+ (uint8_t *)xattrname + 5, namelen));
if (fd >= 0) {
error = fsetxattr(fd, xattrname, "1", 1, 0);
@@ -835,7 +835,7 @@ dirattr_hashname(
return libxfs_dir2_hashname(mp, &xname);
}
- return libxfs_da_hashname(name, namelen);
+ return libxfs_attr_hashname(name, namelen);
}
static void
@@ -982,9 +982,9 @@ obfuscate_path_components(
if (!slash) {
/* last (or single) component */
namelen = strnlen((char *)comp, len);
- hash = libxfs_da_hashname(comp, namelen);
+ hash = dirattr_hashname(true, comp, namelen);
obfuscate_name(hash, namelen, comp, false);
- ASSERT(hash == libxfs_da_hashname(comp, namelen));
+ ASSERT(hash == dirattr_hashname(true, comp, namelen));
break;
}
namelen = slash - (char *)comp;
@@ -994,9 +994,9 @@ obfuscate_path_components(
len--;
continue;
}
- hash = libxfs_da_hashname(comp, namelen);
+ hash = dirattr_hashname(true, comp, namelen);
obfuscate_name(hash, namelen, comp, false);
- ASSERT(hash == libxfs_da_hashname(comp, namelen));
+ ASSERT(hash == dirattr_hashname(true, comp, namelen));
comp += namelen + 1;
len -= namelen + 1;
}
@@ -38,6 +38,8 @@
#define xfs_attr_check_namespace libxfs_attr_check_namespace
#define xfs_attr_get libxfs_attr_get
+#define xfs_attr_hashname libxfs_attr_hashname
+#define xfs_attr_hashval libxfs_attr_hashval
#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize
#define xfs_attr_namecheck libxfs_attr_namecheck
#define xfs_attr_set libxfs_attr_set
@@ -485,6 +485,7 @@ process_leaf_attr_local(
xfs_ino_t ino)
{
xfs_attr_leaf_name_local_t *local;
+ xfs_dahash_t computed;
local = xfs_attr3_leaf_name_local(leaf, i);
if (local->namelen == 0 ||
@@ -504,9 +505,12 @@ process_leaf_attr_local(
* ordering anyway in case both the name value and the
* hashvalue were wrong but matched. Unlikely, however.
*/
- if (be32_to_cpu(entry->hashval) != libxfs_da_hashname(
- &local->nameval[0], local->namelen) ||
- be32_to_cpu(entry->hashval) < last_hashval) {
+ computed = libxfs_attr_hashval(mp, entry->flags, local->nameval,
+ local->namelen,
+ local->nameval + local->namelen,
+ be16_to_cpu(local->valuelen));
+ if (be32_to_cpu(entry->hashval) != computed ||
+ be32_to_cpu(entry->hashval) < last_hashval) {
do_warn(
_("bad hashvalue for attribute entry %d in attr block %u, inode %" PRIu64 "\n"),
i, da_bno, ino);
@@ -540,15 +544,17 @@ process_leaf_attr_remote(
{
xfs_attr_leaf_name_remote_t *remotep;
char* value;
+ xfs_dahash_t computed;
remotep = xfs_attr3_leaf_name_remote(leaf, i);
+ computed = libxfs_attr_hashval(mp, entry->flags, remotep->name,
+ remotep->namelen, NULL,
+ be32_to_cpu(remotep->valuelen));
if (remotep->namelen == 0 ||
!libxfs_attr_namecheck(entry->flags, remotep->name,
remotep->namelen) ||
- be32_to_cpu(entry->hashval) !=
- libxfs_da_hashname((unsigned char *)&remotep->name[0],
- remotep->namelen) ||
+ be32_to_cpu(entry->hashval) != computed ||
be32_to_cpu(entry->hashval) < last_hashval ||
be32_to_cpu(remotep->valueblk) == 0) {
do_warn(