Messages in this thread Patch in this message | | | Date | Thu, 30 Oct 1997 13:47:49 -0500 | From | Bill Hawes <> | Subject | minor addition to dcache.h |
| |
This patch adds a routine for computing dentry hash codes to dcache.h. Since several filesystems (nfs, smbfs, amybe more?) need to do this, it would be better to have one routine to do it correctly.
Regards, Bill--- include/linux/dcache.h.old Sat Oct 25 07:43:21 1997 +++ include/linux/dcache.h Thu Oct 30 11:22:59 1997 @@ -17,7 +17,8 @@ */ struct qstr { const unsigned char * name; - unsigned int len, hash; + unsigned int len; + unsigned int hash; }; /* Name hashing routines. Initial hash value */ @@ -38,6 +39,15 @@ return (unsigned int) hash; } +/* Compute the hash for a name string. */ +static inline unsigned int full_name_hash(const char * name, unsigned int len) +{ + unsigned long hash = init_name_hash(); + while (len--) + hash = partial_name_hash(*name++, hash); + return end_name_hash(hash); +} + struct dentry { int d_count; unsigned int d_flags; | |