Subject: Re: cache_*() case-insensitive searching
To: Jaromir Dolecek <>
From: Ignatios Souvatzis <>
List: tech-kern
Date: 08/10/1999 12:32:31
On Tue, Aug 10, 1999 at 12:11:49PM +0200, Jaromir Dolecek wrote:
> Bill Sommerfeld wrote:
> > cnp->cn_hash is computed in vfs_lookup.c from the pathname component:
> > 
> > 	cnp->cn_hash = 0;
> > 	for (cp = cnp->cn_nameptr; *cp != '\0' && *cp != '/'; cp++)
> > 		cnp->cn_hash += (unsigned char)*cp;
> Is there any reason why this is not done in vfs_cache:cache_lookup()
> right before the value is actually used ?
> There seem to be some situations when the hash value is not used (such
> as when the name is too long), so it would actually make more sense
> to count it just-in-time. And it would ease the implementation of the
> case-insensitive searching (there would be just one place to worry about,
> with no side effects).

You can't do this (case-insensitiveness) file system independent.

Some filesystems come in defined flavours of charset (e.g. ADOSFS), and
have different caseness properties dependend on this.
Some filesystems have no defined character set.
Some filesystems have US-ASCII.
Some filesystems have CP437.
Some filesystems have iso-8859-1.
Some filesystems have Unicode.
Some filesystems have EBCDIC.

if at all, the filesystem code might know what is right.


 * Progress (n.): The process through which Usenet has evolved from
   smart people in front of dumb terminals to dumb people in front of
   smart terminals.  -- (obscurity)