summaryrefslogtreecommitdiff
path: root/fs/fscache/internal.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2021-10-20 15:45:28 +0100
committerDavid Howells <dhowells@redhat.com>2022-01-07 09:22:19 +0000
commite8a07c9d22afdace966353231d0273d29efe0890 (patch)
tree05ac1f37dc2a4d0c699e34cf00e44796169f2c16 /fs/fscache/internal.h
parent1e1236b841166f1d2daf36fdf6bb3e656bc5f5ca (diff)
fscache: Implement a hash function
Implement a function to generate hashes. It needs to be stable over time and endianness-independent as the hashes will appear on disk in future patches. It can assume that its input is a multiple of four bytes in size and alignment. This is borrowed from the VFS and simplified. le32_to_cpu() is added to make it endianness-independent. Changes ======= ver #3: - Read the data being hashed in an endianness-independent way[1]. - Change the size parameter to be in bytes rather than words. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/CAHk-=whtkzB446+hX0zdLsdcUJsJ=8_-0S1mE_R+YurThfUbLA@mail.gmail.com [1] Link: https://lore.kernel.org/r/163819586113.215744.1699465806130102367.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906888735.143852.10944614318596881429.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967082342.1823006.8915671045444488742.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021493624.640689.9990442668811178628.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'fs/fscache/internal.h')
-rw-r--r--fs/fscache/internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index ea52f8594a77..f345bdb018ba 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -22,6 +22,8 @@
*/
extern unsigned fscache_debug;
+extern unsigned int fscache_hash(unsigned int salt, const void *data, size_t len);
+
/*
* proc.c
*/