summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/jffs2/src/os-rtems.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-10 07:51:30 -0700
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-16 07:22:13 +0200
commit0ec9bbce63581ce9e2b9bf0fd7ab5ba7e1d9b7a1 (patch)
tree4ccd0b872d48ebb9e9c5491142a1e92efc726331 /cpukit/libfs/src/jffs2/src/os-rtems.h
parentmm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros (diff)
downloadrtems-0ec9bbce63581ce9e2b9bf0fd7ab5ba7e1d9b7a1.tar.bz2
vfs: make the string hashes salt the hash
We always mixed in the parent pointer into the dentry name hash, but we did it late at lookup time. It turns out that we can simplify that lookup-time action by salting the hash with the parent pointer early instead of late. A few other users of our string hashes also wanted to mix in their own pointers into the hash, and those are updated to use the same mechanism. Hash users that don't have any particular initial salt can just use the NULL pointer as a no-salt. Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: George Spelvin <linux@sciencehorizons.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--cpukit/libfs/src/jffs2/src/os-rtems.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpukit/libfs/src/jffs2/src/os-rtems.h b/cpukit/libfs/src/jffs2/src/os-rtems.h
index ab4f6d72bf..db1be61e67 100644
--- a/cpukit/libfs/src/jffs2/src/os-rtems.h
+++ b/cpukit/libfs/src/jffs2/src/os-rtems.h
@@ -41,9 +41,10 @@
struct _inode;
struct super_block;
-static inline unsigned int full_name_hash(const unsigned char * name, size_t len) {
+static inline unsigned int full_name_hash(const void *salt, const unsigned char * name, size_t len) {
uint32_t hash = 0;
+ (void)salt;
while (len--) {
hash = (hash << 4) | (hash >> 28);
hash ^= *(name++);