Commit d561b441 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] sysv_hash() is cleanups

From:  Scharfe <l.s.r@web.de>

The sysvfs code was confusing. Rewrite it to be readable, and
use the existing VFS helper for recalculating the hash instead
of doing it all by hand.
parent dc4e2d6e
...@@ -42,21 +42,12 @@ static int add_nondir(struct dentry *dentry, struct inode *inode) ...@@ -42,21 +42,12 @@ static int add_nondir(struct dentry *dentry, struct inode *inode)
static int sysv_hash(struct dentry *dentry, struct qstr *qstr) static int sysv_hash(struct dentry *dentry, struct qstr *qstr)
{ {
unsigned long hash;
int i;
const unsigned char *name;
i = SYSV_NAMELEN;
if (i >= qstr->len)
return 0;
/* Truncate the name in place, avoids having to define a compare /* Truncate the name in place, avoids having to define a compare
function. */ function. */
qstr->len = i; if (qstr->len > SYSV_NAMELEN) {
name = qstr->name; qstr->len = SYSV_NAMELEN;
hash = init_name_hash(); qstr->hash = full_name_hash(qstr->name, qstr->len);
while (i--) }
hash = partial_name_hash(*name++, hash);
qstr->hash = end_name_hash(hash);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment