patch-2.1.90 linux/fs/hfs/string.c

Next file: linux/fs/hfs/super.c
Previous file: linux/fs/hfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.89/linux/fs/hfs/string.c linux/fs/hfs/string.c
@@ -81,11 +81,14 @@
 /*
  * Hash a string to an integer in a case-independent way
  */
-unsigned int hfs_strhash(const struct hfs_name *cname)
+unsigned long hfs_strhash(const struct hfs_name *cname)
 {
-	/* Currently just sum of the 'order' of first and last characters */
-	return ((unsigned int)caseorder[cname->Name[0]] +
-		(unsigned int)caseorder[cname->Name[cname->Len - 1]]);
+	unsigned long hash = init_name_hash();
+	unsigned int i;
+	for (i = 0; i < cname->Len; i++) {
+	        hash = partial_name_hash(caseorder[cname->Name[i]], hash);
+	}
+	return end_name_hash(hash);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov