Subject: Re: cache_*() case-insensitive searching
To: None <tech-kern@netbsd.org,>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: tech-kern
Date: 08/10/1999 12:58:08
Ignatios Souvatzis wrote:
> You can't do this (case-insensitiveness) file system independent.

Yeah, I know. I'm not talking about making the search FS-I,
just thinking about how to provide a way for fs's code
to do case-independant search in the cache.

The problem is, that the hash value is counted before the fs code is
able to touch the name to be searched for. If the name passed
to lookup() is not the same as the the canonified one, we end up
looking into wrong hash bucket in cache_lookup() and it's very
likely the entry won't be found.

If we would leave the counting of cnp->cn_hash in lookup() (as it's
currently), we have to provide a hook for fs code
to supply "canonified" name for the name we are currently doing
the lookup for or the fs code would be forced to recount
the hash value before calling cache_lookup(). I like neither of
those two possibilities.

If the hash value would be counted in cache_lookup() directly,
fs code can do whatever it wants to canonify the filename
and the hash value would be counted for the right name. Furthermore,
the hash will be counted only when it would actually be used -- not
such a bit optimization, but every bit counts :)

Jaromir