minor addition to dcache.h

Bill Hawes (whawes@star.net)
Thu, 30 Oct 1997 13:47:49 -0500


This is a multi-part message in MIME format.
--------------5A384FC199F6AA146EF55514
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
--------------5A384FC199F6AA146EF55514
Content-Type: text/plain; charset=us-ascii; name="dch_60-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dch_60-patch"

--- 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;

--------------5A384FC199F6AA146EF55514--