VFS messaging/interfacing work stage 6/99. Populate and maintain the
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 28 Sep 2004 00:25:34 +0000 (00:25 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 28 Sep 2004 00:25:34 +0000 (00:25 +0000)
commit690a3127c6bcff1aec2edae24fd0fe5f41633faf
treedf920e0687a086a3d1de29bb3ad6febd339de782
parenta1e1264228e58e0c3783c42940113528e99b3b30
VFS messaging/interfacing work stage 6/99.  Populate and maintain the
namecache pointers previously attached to struct filedesc, giving the new
lookup code a base from which to work.

Implement the new lookup API (it is not yet being used by anything) and
augment the namecache API to handle the new functions, in particular
adding cache_setvp() to resolve an unresolved namecache entry into a
positive or negative hit and set various flags.  Note that we do not yet
cache symlink data but we could very easily.

The new API is greatly simplified.  Basically nlookups need only returned
a locked namecache pointer (guarenteeing namespace atomicy).  Related
vnodes are not locked.  Both the leaf and governing directory vnodes can
be extracted from the returned namecache pointer.  namecache pointers may
also represent negative hits, which means that their namespace locking
feature serves to reserve a filename that has not yet been created (e.g.
open+create, rename).

The kernel is still using the old API as of this commit.  This commit is
primarily introducing the management infrastructure required to actually
start writing code to use the new API.

VOP_RESOLVE() has been added, along with a default function which falls back
to VOP_LOOKUP()/VOP_CACHEDLOOKUP().  This VOP function is not yet being used
as of this commit.  This VOP will be responsible for taking an unresolved
but locked namecache structure (hence the namespace is locked), and actually
does the directory lookup.  But unlike the far more complex
VOP_LOOKUP()/VOP_CACHEDLOOKUP() API the VOP_RESOLVE() API only needs to
attach a vnode (or NULL if the entry does not exist) to the passed-in
namecache structure.  It is likely that timeouts, e.g. for NFS, will also
be attached via this API.

This commit does not implement any of the cache-coherency infrastructure
but keeps this future requirement in mind in its design.
14 files changed:
sys/conf/files
sys/emulation/svr4/svr4_misc.c
sys/kern/init_main.c
sys/kern/kern_descrip.c
sys/kern/vfs_cache.c
sys/kern/vfs_default.c
sys/kern/vfs_lookup.c
sys/kern/vfs_nlookup.c [new file with mode: 0644]
sys/kern/vfs_syscalls.c
sys/kern/vfs_vopops.c
sys/sys/namecache.h
sys/sys/namei.h
sys/sys/nlookup.h [new file with mode: 0644]
sys/sys/vfsops.h