aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2017-03-10 12:39:42 -0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:35:20 +0200
commit2dbbee543111a1e4fb309fd3d597c79898912724 (patch)
tree257ac701f986e129f85913acf9422b5ff9ef00d7 /fs
parent4227bc7247f0ef65f68312ae343c1f8a9b609740 (diff)
ANDROID: sdcardfs: Use case insensitive hash function
Case insensitive comparisons don't help us much if we hash to different buckets... Signed-off-by: Daniel Rosenberg <drosen@google.com> bug: 36004503 Change-Id: I91e00dbcd860a709cbd4f7fd7fc6d855779f3285
Diffstat (limited to 'fs')
-rwxr-xr-xfs/sdcardfs/packagelist.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/sdcardfs/packagelist.c b/fs/sdcardfs/packagelist.c
index 490dd9702..89f238914 100755
--- a/fs/sdcardfs/packagelist.c
+++ b/fs/sdcardfs/packagelist.c
@@ -20,6 +20,7 @@
#include "sdcardfs.h"
#include <linux/hashtable.h>
+#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/radix-tree.h>
#include <linux/dcache.h>
@@ -44,10 +45,18 @@ static DEFINE_HASHTABLE(ext_to_groupid, 8);
static struct kmem_cache *hashtable_entry_cachep;
+static unsigned int full_name_case_hash(const unsigned char *name, unsigned int len)
+{
+ unsigned long hash = init_name_hash();
+ while (len--)
+ hash = partial_name_hash(tolower(*name++), hash);
+ return end_name_hash(hash);
+}
+
static void inline qstr_init(struct qstr *q, const char *name) {
q->name = name;
q->len = strlen(q->name);
- q->hash = full_name_hash(q->name, q->len);
+ q->hash = full_name_case_hash(q->name, q->len);
}
static inline int qstr_copy(const struct qstr *src, struct qstr *dest) {