diff options
Diffstat (limited to 'sys/fs/msdosfs')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 8 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_lookup.c | 29 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 28 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfsmount.h | 12 |
5 files changed, 48 insertions, 35 deletions
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index de4bf5e..a891ddc 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -124,7 +124,7 @@ msdosfs_hashget(dev, dirclust, diroff) (void) tsleep((caddr_t)dep, PINOD, "msdhgt", 0); break; } - if (!vget(DETOV(dep), 1)) + if (!vget(DETOV(dep), LK_EXCLUSIVE | LK_INTERLOCK, curproc)) return dep; break; } @@ -259,7 +259,7 @@ deget(pmp, dirclust, diroffset, direntptr, depp) * can't be accessed until we've read it in and have done what we * need to it. */ - VOP_LOCK(nvp); + vn_lock(nvp, LK_EXCLUSIVE | LK_RETRY, curproc); msdosfs_hashins(ldep); /* @@ -716,7 +716,7 @@ msdosfs_inactive(ap) printf("msdosfs_inactive(): dep %p, refcnt %ld, mntflag %x, MNT_RDONLY %x\n", dep, dep->de_refcnt, vp->v_mount->mnt_flag, MNT_RDONLY); #endif - VOP_LOCK(vp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc); if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { error = detrunc(dep, (u_long) 0, 0, NOCRED, NULL); dep->de_flag |= DE_UPDATE; @@ -726,7 +726,7 @@ msdosfs_inactive(ap) TIMEVAL_TO_TIMESPEC(&time, &ts); deupdat(dep, &ts, 0); } - VOP_UNLOCK(vp); + VOP_UNLOCK(vp, 0, curproc); dep->de_flag = 0; /* diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index 60236b8..6617f9e 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -54,6 +54,7 @@ #include <sys/vnode.h> #include <sys/mount.h> #include <sys/systm.h> +#include <sys/proc.h> #include <msdosfs/bpb.h> #include <msdosfs/direntry.h> @@ -156,14 +157,14 @@ msdosfs_lookup(ap) VREF(vdp); error = 0; } else if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp); - error = vget(vdp, 1); + VOP_UNLOCK(pdp, 0, curproc); + error = vget(vdp, LK_EXCLUSIVE | LK_INTERLOCK, curproc); if (!error && lockparent && (flags & ISLASTCN)) - error = VOP_LOCK(pdp); + error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, curproc); } else { - error = vget(vdp, 1); + error = vget(vdp, LK_EXCLUSIVE | LK_INTERLOCK, curproc); if (!lockparent || error || !(flags & ISLASTCN)) - VOP_UNLOCK(pdp); + VOP_UNLOCK(pdp, 0, curproc); } if (!error) { @@ -183,9 +184,9 @@ msdosfs_lookup(ap) } vput(vdp); if (lockparent && pdp != vdp && (flags & ISLASTCN)) - VOP_UNLOCK(pdp); + VOP_UNLOCK(pdp, 0, curproc); } - error = VOP_LOCK(pdp); + error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, curproc); if (error) return error; vdp = pdp; @@ -345,7 +346,7 @@ notfound:; /* dp->de_flag |= DE_UPDATE; never update dos directories */ cnp->cn_flags |= SAVENAME; if (!lockparent)/* leave searched dir locked? */ - VOP_UNLOCK(vdp); + VOP_UNLOCK(vdp, 0, curproc); return EJUSTRETURN; } /* @@ -398,7 +399,7 @@ foundroot:; } *vpp = DETOV(tdp); if (!lockparent) - VOP_UNLOCK(vdp); + VOP_UNLOCK(vdp, 0, curproc); if (bp) brelse(bp); return 0; @@ -428,7 +429,7 @@ foundroot:; *vpp = DETOV(tdp); cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(vdp); + VOP_UNLOCK(vdp, 0, curproc); if (bp) brelse(bp); return 0; @@ -439,16 +440,16 @@ foundroot:; */ pdp = vdp; if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp); + VOP_UNLOCK(pdp, 0, curproc); error = deget(pmp, cluster, diroff, dep, &tdp); if (error) { - VOP_LOCK(pdp); + vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, curproc); if (bp) brelse(bp); return error; } if (lockparent && (flags & ISLASTCN) - && (error = VOP_LOCK(pdp))) { + && (error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, curproc))) { vput(DETOV(tdp)); return error; } @@ -464,7 +465,7 @@ foundroot:; return error; } if (!lockparent || !(flags & ISLASTCN)) - VOP_UNLOCK(pdp); + VOP_UNLOCK(pdp, 0, curproc); *vpp = DETOV(tdp); } if (bp) diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 5669c63..d0c8cdb 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -130,10 +130,10 @@ msdosfs_mount(mp, path, data, ndp, p) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (vfs_busy(mp)) + if (vfs_busy(mp, LK_NOWAIT, 0, p)) return EBUSY; error = vflush(mp, NULLVP, flags); - vfs_unbusy(mp); + vfs_unbusy(mp, p); } if (!error && (mp->mnt_flag & MNT_RELOAD)) /* not yet implemented */ @@ -707,7 +707,7 @@ loop: if ((dep->de_flag & (DE_MODIFIED | DE_UPDATE)) == 0 && vp->v_dirtyblkhd.lh_first == NULL) continue; - if (vget(vp, 1)) /* not there anymore? */ + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) /* not there anymore? */ goto loop; error = VOP_FSYNC(vp, cred, waitfor, p); if (error) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index bc4e12e..0f4deae 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1172,17 +1172,17 @@ msdosfs_rename(ap) */ if (newparent == 0) { /* tddep and fddep point to the same denode here */ - VOP_LOCK(ap->a_fvp); /* ap->a_fdvp is already locked */ + vn_lock(ap->a_fvp, LK_EXCLUSIVE | LK_RETRY, curproc); /* ap->a_fdvp is already locked */ error = readep(fddep->de_pmp, fdep->de_dirclust, fdep->de_diroffset, &bp, &ep); if (error) { - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); goto bad; } bcopy(toname, ep->deName, 11); error = bwrite(bp); if (error) { - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); goto bad; } bcopy(toname, fdep->de_Name, 11); /* update denode */ @@ -1204,7 +1204,7 @@ msdosfs_rename(ap) * will also insure that the directory entry on disk has a * filesize of zero. */ - VOP_LOCK(ap->a_fvp); + vn_lock(ap->a_fvp, LK_EXCLUSIVE | LK_RETRY, curproc); bcopy(toname, fdep->de_Name, 11); /* update denode */ if (fdep->de_Attributes & ATTR_DIRECTORY) { dirsize = fdep->de_FileSize; @@ -1216,22 +1216,22 @@ msdosfs_rename(ap) } if (error) { /* should put back filename */ - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); goto bad; } - VOP_LOCK(ap->a_fdvp); + vn_lock(ap->a_fdvp, LK_EXCLUSIVE | LK_RETRY, curproc); error = readep(fddep->de_pmp, fddep->de_fndclust, fddep->de_fndoffset, &bp, &ep); if (error) { - VOP_UNLOCK(ap->a_fvp); - VOP_UNLOCK(ap->a_fdvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); + VOP_UNLOCK(ap->a_fdvp, 0, curproc); goto bad; } ep->deName[0] = SLOT_DELETED; error = bwrite(bp); if (error) { - VOP_UNLOCK(ap->a_fvp); - VOP_UNLOCK(ap->a_fdvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); + VOP_UNLOCK(ap->a_fdvp, 0, curproc); goto bad; } if (!sourceisadirectory) { @@ -1239,7 +1239,7 @@ msdosfs_rename(ap) fdep->de_diroffset = tddep->de_fndoffset; reinsert(fdep); } - VOP_UNLOCK(ap->a_fdvp); + VOP_UNLOCK(ap->a_fdvp, 0, curproc); } /* fdep is still locked here */ @@ -1259,19 +1259,19 @@ msdosfs_rename(ap) NOCRED, &bp); if (error) { /* should really panic here, fs is corrupt */ - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); goto bad; } dotdotp = (struct direntry *) bp->b_data + 1; putushort(dotdotp->deStartCluster, tddep->de_StartCluster); error = bwrite(bp); - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); if (error) { /* should really panic here, fs is corrupt */ goto bad; } } else - VOP_UNLOCK(ap->a_fvp); + VOP_UNLOCK(ap->a_fvp, 0, curproc); bad: ; vrele(DETOV(fdep)); vrele(DETOV(fddep)); diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h index 7b0a22e..77c6add 100644 --- a/sys/fs/msdosfs/msdosfsmount.h +++ b/sys/fs/msdosfs/msdosfsmount.h @@ -169,3 +169,15 @@ struct msdosfsmount { (((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift) int msdosfs_init __P((void)); + +/* + * Arguments to mount MSDOS filesystems. + */ +struct msdosfs_args { + char *fspec; /* blocks special holding the fs to mount */ + struct export_args export; /* network export information */ + uid_t uid; /* uid that owns msdosfs files */ + gid_t gid; /* gid that owns msdosfs files */ + mode_t mask; /* mask to be applied for msdosfs perms */ +}; + |