summaryrefslogtreecommitdiffstats
path: root/sys/msdosfs/msdosfs_lookup.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-08-26 07:32:51 +0000
committerphk <phk@FreeBSD.org>1997-08-26 07:32:51 +0000
commitfddfc9d5bb4c35d88417fa80a062219876186593 (patch)
tree7f29931e5661e3731f6b972dc3a9508534617833 /sys/msdosfs/msdosfs_lookup.c
parentf320b3a30651cae7b34067561adb48f2b6f57621 (diff)
downloadFreeBSD-src-fddfc9d5bb4c35d88417fa80a062219876186593.zip
FreeBSD-src-fddfc9d5bb4c35d88417fa80a062219876186593.tar.gz
Uncut&paste cache_lookup().
This unifies several times in theory indentical 50 lines of code. The filesystems have a new method: vop_cachedlookup, which is the meat of the lookup, and use vfs_cache_lookup() for their vop_lookup method. vfs_cache_lookup() will check the namecache and pass on to the vop_cachedlookup method in case of a miss. It's still the task of the individual filesystems to populate the namecache with cache_enter(). Filesystems that do not use the namecache will just provide the vop_lookup method as usual.
Diffstat (limited to 'sys/msdosfs/msdosfs_lookup.c')
-rw-r--r--sys/msdosfs/msdosfs_lookup.c59
1 files changed, 2 insertions, 57 deletions
diff --git a/sys/msdosfs/msdosfs_lookup.c b/sys/msdosfs/msdosfs_lookup.c
index 9bc576c..9e7b095 100644
--- a/sys/msdosfs/msdosfs_lookup.c
+++ b/sys/msdosfs/msdosfs_lookup.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_lookup.c,v 1.10 1997/02/22 09:40:47 peter Exp $ */
+/* $Id: msdosfs_lookup.c,v 1.11 1997/02/26 14:23:13 bde Exp $ */
/* $NetBSD: msdosfs_lookup.c,v 1.14 1994/08/21 18:44:07 ws Exp $ */
/*-
@@ -82,7 +82,7 @@ static int markdeleted __P((struct msdosfsmount *pmp, u_long dirclust,
*/
int
msdosfs_lookup(ap)
- struct vop_lookup_args /* {
+ struct vop_cachedlookup_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
@@ -141,61 +141,6 @@ msdosfs_lookup(ap)
return ENOTDIR;
/*
- * See if the component of the pathname we are looking for is in
- * the directory cache. If so then do a few things and return.
- */
- error = cache_lookup(vdp, vpp, cnp);
- if (error) {
- int vpid;
-
- if (error == ENOENT)
- return error;
- pdp = vdp;
- vdp = *vpp;
- dp = VTODE(vdp);
- vpid = vdp->v_id;
- if (pdp == vdp) {
- VREF(vdp);
- error = 0;
- } else if (flags & ISDOTDOT) {
- VOP_UNLOCK(pdp, 0, p);
- error = vget(vdp, LK_EXCLUSIVE, p);
- if (!error && lockparent && (flags & ISLASTCN))
- error = vn_lock(pdp, LK_EXCLUSIVE, p);
- } else {
- error = vget(vdp, LK_EXCLUSIVE, p);
- if (!lockparent || error || !(flags & ISLASTCN))
- VOP_UNLOCK(pdp, 0, p);
- }
-
- if (!error) {
- if (vpid == vdp->v_id) {
-#ifdef MSDOSFS_DEBUG
- printf("msdosfs_lookup(): cache hit, vnode %08x, file %s\n",
- vdp, dp->de_Name);
-#endif
-#ifdef PC98
- /*
- * 1024 byte/sector support
- */
- if (pmp->pm_BytesPerSec == 1024)
- vdp->v_flag |= 0x10000;
-#endif
- return 0;
- }
- vput(vdp);
- if (lockparent && pdp != vdp && (flags & ISLASTCN))
- VOP_UNLOCK(pdp, 0, p);
- }
- error = vn_lock(pdp, LK_EXCLUSIVE, p);
- if (error)
- return error;
- vdp = pdp;
- dp = VTODE(vdp);
- *vpp = NULL;
- }
-
- /*
* If they are going after the . or .. entry in the root directory,
* they won't find it. DOS filesystems don't have them in the root
* directory. So, we fake it. deget() is in on this scam too.
OpenPOWER on IntegriCloud