diff options
Diffstat (limited to 'sys/msdosfs')
-rw-r--r-- | sys/msdosfs/msdosfs_denode.c | 21 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_lookup.c | 31 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vfsops.c | 63 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 58 | ||||
-rw-r--r-- | sys/msdosfs/msdosfsmount.h | 4 |
5 files changed, 89 insertions, 88 deletions
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index 258e5632c71..0debd66175d 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_denode.c,v 1.6 1997/10/06 15:22:38 csapuntz Exp $ */ +/* $OpenBSD: msdosfs_denode.c,v 1.7 1997/10/06 20:20:57 deraadt Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.22 1996/10/13 04:16:31 christos Exp $ */ /*- @@ -76,13 +76,10 @@ static struct denode *msdosfs_hashget __P((dev_t, u_long, u_long)); static void msdosfs_hashins __P((struct denode *)); static void msdosfs_hashrem __P((struct denode *)); -/*ARGSUSED*/ -int -msdosfs_init(vfsp) - struct vfsconf *vfsp; +void +msdosfs_init() { dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash); - return (0); } static struct denode * @@ -92,8 +89,7 @@ msdosfs_hashget(dev, dirclust, diroff) u_long diroff; { struct denode *dep; - struct proc *p = curproc; /* XXX */ - + for (;;) for (dep = dehashtbl[DEHASH(dev, dirclust, diroff)];; dep = dep->de_next) { @@ -108,7 +104,7 @@ msdosfs_hashget(dev, dirclust, diroff) sleep(dep, PINOD); break; } - if (!vget(DETOV(dep), LK_EXCLUSIVE, p)) + if (!vget(DETOV(dep), 1)) return (dep); break; } @@ -170,7 +166,6 @@ deget(pmp, dirclust, diroffset, depp) struct denode *ldep; struct vnode *nvp; struct buf *bp; - struct proc *p = curproc; /* XXX */ #ifdef MSDOSFS_DEBUG printf("deget(pmp %08x, dirclust %d, diroffset %x, depp %08x)\n", @@ -223,7 +218,7 @@ deget(pmp, dirclust, diroffset, depp) * can't be accessed until we've read it in and have done what we * need to it. */ - vn_lock(nvp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(nvp); msdosfs_hashins(ldep); /* @@ -567,11 +562,9 @@ msdosfs_inactive(v) { struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; } */ *ap = v; struct vnode *vp = ap->a_vp; struct denode *dep = VTODE(vp); - struct proc *p = ap->a_p; int error; extern int prtactive; @@ -615,7 +608,7 @@ msdosfs_inactive(v) dep->de_Name[0] = SLOT_DELETED; } deupdat(dep, 0); - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp); /* * If we are done with the denode, reclaim it * so that it can be reused immediately. diff --git a/sys/msdosfs/msdosfs_lookup.c b/sys/msdosfs/msdosfs_lookup.c index 42844deb5e3..2305f74d9b0 100644 --- a/sys/msdosfs/msdosfs_lookup.c +++ b/sys/msdosfs/msdosfs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_lookup.c,v 1.6 1997/10/06 15:22:39 csapuntz Exp $ */ +/* $OpenBSD: msdosfs_lookup.c,v 1.7 1997/10/06 20:20:58 deraadt Exp $ */ /* $NetBSD: msdosfs_lookup.c,v 1.30 1996/10/25 23:14:08 cgd Exp $ */ /*- @@ -89,7 +89,6 @@ msdosfs_lookup(v) struct vnode *vdp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; daddr_t bn; int error; int lockparent; @@ -162,14 +161,14 @@ msdosfs_lookup(v) VREF(vdp); error = 0; } else if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp, 0, p); - error = vget(vdp, LK_EXCLUSIVE, p); + VOP_UNLOCK(pdp); + error = vget(vdp, 1); if (!error && lockparent && (flags & ISLASTCN)) - error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_LOCK(pdp); } else { - error = vget(vdp, LK_EXCLUSIVE, p); + error = vget(vdp, 1); if (!lockparent || error || !(flags & ISLASTCN)) - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp); } /* * Check that the capability number did not change @@ -185,9 +184,9 @@ msdosfs_lookup(v) } vput(vdp); if (lockparent && pdp != vdp && (flags & ISLASTCN)) - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp); } - if ((error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p)) != 0) + if ((error = VOP_LOCK(pdp)) != 0) return (error); vdp = pdp; dp = VTODE(vdp); @@ -415,7 +414,7 @@ notfound:; */ cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp); return (EJUSTRETURN); } /* @@ -485,7 +484,7 @@ foundroot:; return (error); *vpp = DETOV(tdp); if (!lockparent) - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp); return (0); } @@ -513,7 +512,7 @@ foundroot:; *vpp = DETOV(tdp); cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp); return (0); } @@ -538,13 +537,13 @@ foundroot:; */ pdp = vdp; if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp, 0, p); /* race to get the inode */ + VOP_UNLOCK(pdp); /* race to get the inode */ if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0) { - vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(pdp); return (error); } if (lockparent && (flags & ISLASTCN) && - (error = vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p))) { + (error = VOP_LOCK(pdp))) { vput(DETOV(tdp)); return (error); } @@ -556,7 +555,7 @@ foundroot:; if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0) return (error); if (!lockparent || !(flags & ISLASTCN)) - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp); *vpp = DETOV(tdp); } diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index cf2a101328d..f10de74c684 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.8 1997/10/06 15:22:39 csapuntz Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.9 1997/10/06 20:20:59 deraadt Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.44 1996/12/22 10:10:32 cgd Exp $ */ /*- @@ -75,8 +75,10 @@ int msdosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, int msdosfs_start __P((struct mount *, int, struct proc *)); int msdosfs_unmount __P((struct mount *, int, struct proc *)); int msdosfs_root __P((struct mount *, struct vnode **)); +int msdosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); +int msdosfs_vget __P((struct mount *, ino_t, struct vnode **)); int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **)); int msdosfs_vptofh __P((struct vnode *, struct fid *)); @@ -119,10 +121,10 @@ msdosfs_mount(mp, path, data, ndp, p) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (vfs_busy(mp, 0, 0, p)) + if (vfs_busy(mp)) return (EBUSY); error = vflush(mp, NULLVP, flags); - vfs_unbusy(mp, p); + vfs_unbusy(mp); } if (!error && (mp->mnt_flag & MNT_RELOAD)) /* not yet implemented */ @@ -136,14 +138,14 @@ msdosfs_mount(mp, path, data, ndp, p) */ if (p->p_ucred->cr_uid != 0) { devvp = pmp->pm_devvp; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(devvp); error = VOP_ACCESS(devvp, VREAD | VWRITE, p->p_ucred, p); if (error) { - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp); return (error); } - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp); } pmp->pm_flags &= ~MSDOSFSMNT_RONLY; } @@ -187,13 +189,13 @@ msdosfs_mount(mp, path, data, ndp, p) accessmode = VREAD; if ((mp->mnt_flag & MNT_RDONLY) == 0) accessmode |= VWRITE; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_LOCK(devvp); error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p); if (error) { vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp); } if ((mp->mnt_flag & MNT_UPDATE) == 0) error = msdosfs_mountfs(devvp, mp, p, &args); @@ -512,7 +514,7 @@ msdosfs_mountfs(devvp, mp, p, argp) * in the directory entry where we could put uid's and gid's. */ #endif - devvp->v_specmountpoint = mp; + devvp->v_specflags |= SI_MOUNTEDON; return (0); @@ -559,7 +561,7 @@ msdosfs_unmount(mp, mntflags, p) if ((error = vflush(mp, NULLVP, flags)) != 0) return (error); pmp = VFSTOMSDOSFS(mp); - pmp->pm_devvp->v_specmountpoint = NULL; + pmp->pm_devvp->v_specflags &= ~SI_MOUNTEDON; #ifdef MSDOSFS_DEBUG printf("msdosfs_umount(): just before calling VOP_CLOSE()\n"); printf("flag %08x, usecount %d, writecount %d, holdcnt %d\n", @@ -603,6 +605,22 @@ msdosfs_root(mp, vpp) } int +msdosfs_quotactl(mp, cmds, uid, arg, p) + struct mount *mp; + int cmds; + uid_t uid; + caddr_t arg; + struct proc *p; +{ + +#ifdef QUOTA + return (EOPNOTSUPP); +#else + return (EOPNOTSUPP); +#endif +} + +int msdosfs_statfs(mp, sbp, p) struct mount *mp; struct statfs *sbp; @@ -627,7 +645,7 @@ msdosfs_statfs(mp, sbp, p) bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); } - strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); + strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN); return (0); } @@ -671,9 +689,9 @@ loop: dep = VTODE(vp); if (((dep->de_flag & (DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0) - && (vp->v_dirtyblkhd.lh_first == NULL || waitfor == MNT_LAZY)) + && (vp->v_dirtyblkhd.lh_first == NULL)) continue; - if (vget(vp, LK_EXCLUSIVE, p)) + if (vget(vp, 1)) goto loop; if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) allerror = error; @@ -735,16 +753,18 @@ msdosfs_vptofh(vp, fhp) return (0); } -#define msdosfs_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) - -#define msdosfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) +int +msdosfs_vget(mp, ino, vpp) + struct mount *mp; + ino_t ino; + struct vnode **vpp; +{ -#define msdosfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) + return (EOPNOTSUPP); +} struct vfsops msdosfs_vfsops = { + MOUNT_MSDOS, msdosfs_mount, msdosfs_start, msdosfs_unmount, @@ -755,6 +775,5 @@ struct vfsops msdosfs_vfsops = { msdosfs_vget, msdosfs_fhtovp, msdosfs_vptofh, - msdosfs_init, - msdosfs_sysctl + msdosfs_init }; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 40ff8591d07..3bc08890817 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.11 1997/10/06 15:22:40 csapuntz Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.12 1997/10/06 20:21:00 deraadt Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.48 1996/03/20 00:45:43 thorpej Exp $ */ /*- @@ -949,7 +949,6 @@ msdosfs_rename(v) register struct vnode *fdvp = ap->a_fdvp; register struct componentname *tcnp = ap->a_tcnp; register struct componentname *fcnp = ap->a_fcnp; - struct proc *p = curproc; /* XXX */ register struct denode *ip, *xp, *dp, *zp; u_char toname[11], oldname[11]; u_long from_diroffset, to_diroffset; @@ -990,7 +989,7 @@ abortit: } /* */ - if ((error = vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, p)) != 0) + if ((error = VOP_LOCK(fvp)) != 0) goto abortit; dp = VTODE(fdvp); ip = VTODE(fvp); @@ -1010,7 +1009,7 @@ abortit: (fcnp->cn_flags & ISDOTDOT) || (tcnp->cn_flags & ISDOTDOT) || (ip->de_flag & DE_RENAME)) { - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); error = EINVAL; goto abortit; } @@ -1041,7 +1040,7 @@ abortit: * call to doscheckpath(). */ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster) newparent = 1; vrele(fdvp); @@ -1107,7 +1106,7 @@ abortit: if ((fcnp->cn_flags & SAVESTART) == 0) panic("msdosfs_rename: lost from startdir"); if (!newparent) - VOP_UNLOCK(tdvp, 0, p); + VOP_UNLOCK(tdvp); (void) relookup(fdvp, &fvp, fcnp); if (fvp == NULL) { /* @@ -1117,7 +1116,7 @@ abortit: panic("rename: lost dir entry"); vrele(ap->a_fvp); if (newparent) - VOP_UNLOCK(tdvp, 0, p); + VOP_UNLOCK(tdvp); vrele(tdvp); return 0; } @@ -1137,9 +1136,9 @@ abortit: if (doingdirectory) panic("rename: lost dir entry"); vrele(ap->a_fvp); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); if (newparent) - VOP_UNLOCK(fdvp, 0, p); + VOP_UNLOCK(fdvp); xp = NULL; } else { vrele(fvp); @@ -1161,8 +1160,8 @@ abortit: if (error) { bcopy(oldname, ip->de_Name, 11); if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp); + VOP_UNLOCK(fvp); goto bad; } ip->de_refcnt++; @@ -1170,8 +1169,8 @@ abortit: if ((error = removede(zp, ip)) != 0) { /* XXX should really panic here, fs is corrupt */ if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp); + VOP_UNLOCK(fvp); goto bad; } if (!doingdirectory) { @@ -1180,8 +1179,8 @@ abortit: if (error) { /* XXX should really panic here, fs is corrupt */ if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp); + VOP_UNLOCK(fvp); goto bad; } if (ip->de_dirclust != MSDOSFSROOT) @@ -1189,7 +1188,7 @@ abortit: } reinsert(ip); if (newparent) - VOP_UNLOCK(fdvp, 0, p); + VOP_UNLOCK(fdvp); } /* @@ -1208,19 +1207,19 @@ abortit: if (error) { /* XXX should really panic here, fs is corrupt */ brelse(bp); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); goto bad; } dotdotp = (struct direntry *)bp->b_data + 1; putushort(dotdotp->deStartCluster, dp->de_StartCluster); if ((error = bwrite(bp)) != 0) { /* XXX should really panic here, fs is corrupt */ - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); goto bad; } } - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp); bad: if (xp) vput(tvp); @@ -1464,8 +1463,8 @@ msdosfs_readdir(v) struct uio *a_uio; struct ucred *a_cred; int *a_eofflag; - u_long **a_cookies; - int *a_ncookies; + u_long *a_cookies; + int a_ncookies; } */ *ap = v; int error = 0; int diff; @@ -1484,8 +1483,8 @@ msdosfs_readdir(v) struct direntry *dentp; struct dirent dirbuf; struct uio *uio = ap->a_uio; - u_long *cookies = NULL; - int ncookies = 0; + u_long *cookies; + int ncookies; off_t offset; int chksum = -1; @@ -1521,13 +1520,8 @@ msdosfs_readdir(v) lost = uio->uio_resid - count; uio->uio_resid = count; - if (ap->a_ncookies) { - ncookies = uio->uio_resid / sizeof(struct direntry) + 3; - MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, - M_WAITOK); - *ap->a_cookies = cookies; - *ap->a_ncookies = ncookies; - } + cookies = ap->a_cookies; + ncookies = ap->a_ncookies; /* * If they are reading from the root directory then, we simulate @@ -1687,10 +1681,6 @@ msdosfs_readdir(v) } out: - /* Subtract unused cookies */ - if (ap->a_ncookies) - *ap->a_ncookies -= ncookies; - uio->uio_offset = offset; uio->uio_resid += lost; if (dep->de_FileSize - (offset - bias) <= 0) diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h index 04937d4db84..b76a4694152 100644 --- a/sys/msdosfs/msdosfsmount.h +++ b/sys/msdosfs/msdosfsmount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfsmount.h,v 1.6 1997/10/06 15:22:40 csapuntz Exp $ */ +/* $OpenBSD: msdosfsmount.h,v 1.7 1997/10/06 20:21:01 deraadt Exp $ */ /* $NetBSD: msdosfsmount.h,v 1.15 1996/12/22 10:31:41 cgd Exp $ */ /*- @@ -199,4 +199,4 @@ int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **)); int msdosfs_vptofh __P((struct vnode *, struct fid *)); -int msdosfs_init __P((struct vfsconf *)); +void msdosfs_init __P((void)); |