summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/ubifs.h
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-11-11 14:46:06 -0500
committerRichard Weinberger <richard@nod.at>2016-12-12 17:07:38 -0500
commit528e3d178f257e36001345d4d61ae5af35422017 (patch)
tree6ad691850c8ab01965cc3b556b746b1828efb002 /fs/ubifs/ubifs.h
parentb91dc9816e5cd684b0d131fe6ec608a99bfbe3ee (diff)
ubifs: Add full hash lookup support
UBIFS stores a 32bit hash of every file, for traditional lookups by name this scheme is fine since UBIFS can first try to find the file by the hash of the filename and upon collisions it can walk through all entries with the same hash and do a string compare. When filesnames are encrypted fscrypto will ask the filesystem for a unique cookie, based on this cookie the filesystem has to be able to locate the target file again. With 32bit hashes this is impossible because the chance for collisions is very high. Do deal with that we store a 32bit cookie directly in the UBIFS directory entry node such that we get a 64bit cookie (32bit from filename hash and the dent cookie). For a lookup by hash UBIFS finds the entry by the first 32bit and then compares the dent cookie. If it does not match, it has to do a linear search of the whole directory and compares all dent cookies until the correct entry is found. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/ubifs.h')
-rw-r--r--fs/ubifs/ubifs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 8ccd19257a81..a80610758543 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1571,6 +1571,8 @@ int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key,
1571 struct ubifs_znode **zn, int *n); 1571 struct ubifs_znode **zn, int *n);
1572int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, 1572int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key,
1573 void *node, const struct fscrypt_name *nm); 1573 void *node, const struct fscrypt_name *nm);
1574int ubifs_tnc_lookup_dh(struct ubifs_info *c, const union ubifs_key *key,
1575 void *node, uint32_t secondary_hash);
1574int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, 1576int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,
1575 void *node, int *lnum, int *offs); 1577 void *node, int *lnum, int *offs);
1576int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, 1578int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum,