diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-06-23 02:07:58 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-06-23 02:07:58 +0000 |
commit | 883624e9986baee8db2f3d68ff2471c6ca9beb00 (patch) | |
tree | 14f1b386656e0a15b52019132dc8f139762c1778 /sys/ufs/ffs | |
parent | 1c7daffba6f64b26bd7e1427cf933c1365bec83f (diff) |
Privatize several vnode operations that are not used by the generic code.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 70 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_balloc.c | 37 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 17 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 90 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 23 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_subr.c | 29 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 13 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 30 |
8 files changed, 110 insertions, 199 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index c473c617942..f5593ee5743 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_alloc.c,v 1.28 2001/04/19 16:22:16 gluk Exp $ */ +/* $OpenBSD: ffs_alloc.c,v 1.29 2001/06/23 02:07:53 csapuntz Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */ /* @@ -73,7 +73,6 @@ static daddr_t ffs_mapsearch __P((struct fs *, struct cg *, daddr_t, int)); #ifdef DIAGNOSTIC static int ffs_checkblk __P((struct inode *, daddr_t, long)); #endif -int ffs_freefile __P((struct vop_vfree_args *)); /* * Allocate a block in the file system. @@ -346,7 +345,6 @@ ffs_reallocblks(v) daddr_t start_lbn, end_lbn, soff, newblk, blkno; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; int i, len, start_lvl, end_lvl, pref, ssize; - struct timespec ts; if (doreallocblks == 0) return (ENOSPC); @@ -492,8 +490,7 @@ ffs_reallocblks(v) } else { ip->i_flag |= IN_CHANGE | IN_UPDATE; if (!doasyncfree) { - TIMEVAL_TO_TIMESPEC(&time, &ts); - VOP_UPDATE(vp, &ts, &ts, 1); + UFS_UPDATE(ip, MNT_WAIT); } } if (ssize < len) { @@ -555,25 +552,16 @@ fail: * available inode is located. */ int -ffs_valloc(v) - void *v; +ffs_inode_alloc(struct inode *pip, int mode, struct ucred *cred, + struct vnode **vpp) { - struct vop_valloc_args /* { - struct vnode *a_pvp; - int a_mode; - struct ucred *a_cred; - struct vnode **a_vpp; - } */ *ap = v; - register struct vnode *pvp = ap->a_pvp; - register struct inode *pip; - register struct fs *fs; - register struct inode *ip; - mode_t mode = ap->a_mode; + struct vnode *pvp = ITOV(pip); + struct fs *fs; + struct inode *ip; ino_t ino, ipref; int cg, error; - *ap->a_vpp = NULL; - pip = VTOI(pvp); + *vpp = NULL; fs = pip->i_fs; if (fs->fs_cstotal.cs_nifree == 0) goto noinodes; @@ -600,12 +588,12 @@ ffs_valloc(v) ino = (ino_t)ffs_hashalloc(pip, cg, (long)ipref, mode, ffs_nodealloccg); if (ino == 0) goto noinodes; - error = VFS_VGET(pvp->v_mount, ino, ap->a_vpp); + error = VFS_VGET(pvp->v_mount, ino, vpp); if (error) { - VOP_VFREE(pvp, ino, mode); + ffs_inode_free(pip, ino, mode); return (error); } - ip = VTOI(*ap->a_vpp); + ip = VTOI(*vpp); if (ip->i_ffs_mode) { printf("mode = 0%o, inum = %d, fs = %s\n", ip->i_ffs_mode, ip->i_number, fs->fs_fsmnt); @@ -628,7 +616,7 @@ ffs_valloc(v) ip->i_ffs_gen = 1; /* shouldn't happen */ return (0); noinodes: - ffs_fserr(fs, ap->a_cred->cr_uid, "out of inodes"); + ffs_fserr(fs, cred->cr_uid, "out of inodes"); uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt); return (ENOSPC); } @@ -1495,25 +1483,17 @@ ffs_blkfree(ip, bno, size) bdwrite(bp); } -/* - * Free an inode. - */ int -ffs_vfree(v) - void *v; +ffs_inode_free(struct inode *pip, ino_t ino, int mode) { - struct vop_vfree_args /* { - struct vnode *a_pvp; - ino_t a_ino; - int a_mode; - } */ *ap = v; + struct vnode *pvp = ITOV(pip); - if (DOINGSOFTDEP(ap->a_pvp)) { - softdep_freefile(ap->a_pvp, ap->a_ino, ap->a_mode); + if (DOINGSOFTDEP(pvp)) { + softdep_freefile(pvp, ino, mode); return (0); } - return (ffs_freefile(ap)); + return (ffs_freefile(pip, ino, mode)); } /* @@ -1521,21 +1501,13 @@ ffs_vfree(v) * The specified inode is placed back in the free map. */ int -ffs_freefile(ap) - struct vop_vfree_args /* { - struct vnode *a_pvp; - ino_t a_ino; - int a_mode; - } */ *ap; +ffs_freefile(struct inode *pip, ino_t ino, int mode) { - register struct fs *fs; - register struct cg *cgp; - register struct inode *pip; - ino_t ino = ap->a_ino; + struct fs *fs; + struct cg *cgp; struct buf *bp; int error, cg; - pip = VTOI(ap->a_pvp); fs = pip->i_fs; if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) panic("ffs_freefile: range: dev = 0x%x, ino = %d, fs = %s", @@ -1566,7 +1538,7 @@ ffs_freefile(ap) cgp->cg_cs.cs_nifree++; fs->fs_cstotal.cs_nifree++; fs->fs_cs(fs, cg).cs_nifree++; - if ((ap->a_mode & IFMT) == IFDIR) { + if ((mode & IFMT) == IFDIR) { cgp->cg_cs.cs_ndir--; fs->fs_cstotal.cs_ndir--; fs->fs_cs(fs, cg).cs_ndir--; diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index 4fc440ceedb..0c1d2782a46 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_balloc.c,v 1.12 2001/03/20 19:33:06 art Exp $ */ +/* $OpenBSD: ffs_balloc.c,v 1.13 2001/06/23 02:07:53 csapuntz Exp $ */ /* $NetBSD: ffs_balloc.c,v 1.3 1996/02/09 22:22:21 christos Exp $ */ /* @@ -63,22 +63,10 @@ * the inode and the logical block number in a file. */ int -ffs_balloc(v) - void *v; +ffs_balloc(struct inode *ip, off_t startoffset, int size, struct ucred *cred, + int flags, struct buf **bpp) { - struct vop_balloc_args /* { - struct vnode *a_vp; - off_t a_startpoint; - int a_size; - struct ucred *a_cred; - int a_flags; - struct buf **a_bpp; - } */ *ap = v; - struct inode *ip; daddr_t lbn; - int size; - struct ucred *cred; - int flags; struct fs *fs; daddr_t nb; struct buf *bp, *nbp; @@ -89,18 +77,15 @@ ffs_balloc(v) daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR+1]; int unwindidx = -1; - vp = ap->a_vp; - ip = VTOI(vp); + vp = ITOV(ip); fs = ip->i_fs; - lbn = lblkno(fs, ap->a_startoffset); - size = blkoff(fs, ap->a_startoffset) + ap->a_size; + lbn = lblkno(fs, startoffset); + size = blkoff(fs, startoffset) + size; if (size > fs->fs_bsize) panic("ffs_balloc: blk too big"); - *ap->a_bpp = NULL; + *bpp = NULL; if (lbn < 0) return (EFBIG); - cred = ap->a_cred; - flags = ap->a_flags; /* * If the next write will extend the file into a new block, @@ -146,7 +131,7 @@ ffs_balloc(v) brelse(bp); return (error); } - *ap->a_bpp = bp; + *bpp = bp; return (0); } if (nb != 0) { @@ -193,7 +178,7 @@ ffs_balloc(v) } ip->i_ffs_db[lbn] = dbtofsb(fs, bp->b_blkno); ip->i_flag |= IN_CHANGE | IN_UPDATE; - *ap->a_bpp = bp; + *bpp = bp; return (0); } /* @@ -333,7 +318,7 @@ ffs_balloc(v) } else { bdwrite(bp); } - *ap->a_bpp = nbp; + *bpp = nbp; return (0); } brelse(bp); @@ -347,7 +332,7 @@ ffs_balloc(v) nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } - *ap->a_bpp = nbp; + *bpp = nbp; return (0); fail: diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 38466edc2c6..40f61d068b4 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_extern.h,v 1.12 2001/03/22 00:11:36 art Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.13 2001/06/23 02:07:53 csapuntz Exp $ */ /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */ /*- @@ -77,27 +77,28 @@ int ffs_alloc __P((struct inode *, daddr_t, daddr_t , int, struct ucred *, int ffs_realloccg __P((struct inode *, daddr_t, daddr_t, int, int , struct ucred *, struct buf **)); int ffs_reallocblks __P((void *)); -int ffs_valloc __P((void *)); +int ffs_inode_alloc(struct inode *, int, struct ucred *, struct vnode **); +int ffs_inode_free(struct inode *, ino_t, int); +int ffs_freefile(struct inode *, ino_t, int); + daddr_t ffs_blkpref __P((struct inode *, daddr_t, int, daddr_t *)); void ffs_blkfree __P((struct inode *, daddr_t, long)); -int ffs_vfree __P((void *)); void ffs_clusteracct __P((struct fs *, struct cg *, daddr_t, int)); /* ffs_balloc.c */ -int ffs_balloc __P((void *)); +int ffs_balloc(struct inode *, off_t, int, struct ucred *, int, struct buf **); /* ffs_inode.c */ int ffs_init __P((struct vfsconf *)); -int ffs_update __P((void *)); -int ffs_truncate __P((void *)); +int ffs_update(struct inode *, struct timespec *, struct timespec *, int); +int ffs_truncate(struct inode *, off_t, int, struct ucred *); /* ffs_subr.c */ -int ffs_blkatoff __P((void *)); +int ffs_bufatoff(struct inode *, off_t, char **, struct buf **); void ffs_fragacct __P((struct fs *, int, int32_t[], int)); #ifdef DIAGNOSTIC void ffs_checkoverlap __P((struct buf *, struct inode *)); #endif -int ffs_freefile __P((struct vop_vfree_args *)); int ffs_isfreeblock __P((struct fs *, unsigned char *, daddr_t)); int ffs_isblock __P((struct fs *, unsigned char *, daddr_t)); void ffs_clrblock __P((struct fs *, u_char *, daddr_t)); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 26811ff1245..284af8362e5 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_inode.c,v 1.19 2001/03/20 19:50:30 art Exp $ */ +/* $OpenBSD: ffs_inode.c,v 1.20 2001/06/23 02:07:54 csapuntz Exp $ */ /* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */ /* @@ -74,40 +74,36 @@ static int ffs_indirtrunc __P((struct inode *, daddr_t, daddr_t, daddr_t, int, * of the inode to complete. */ int -ffs_update(v) - void *v; +ffs_update(struct inode *ip, struct timespec *atime, + struct timespec *mtime, int waitfor) { - struct vop_update_args /* { - struct vnode *a_vp; - struct timespec *a_access; - struct timespec *a_modify; - int a_waitfor; - } */ *ap = v; - register struct fs *fs; + struct vnode *vp; + struct fs *fs; struct buf *bp; - struct inode *ip; int error; + struct timespec ts; - ip = VTOI(ap->a_vp); - if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) { + TIMEVAL_TO_TIMESPEC(&time, &ts); + vp = ITOV(ip); + if (vp->v_mount->mnt_flag & MNT_RDONLY) { ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE); return (0); - } else if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) && + } else if ((vp->v_mount->mnt_flag & MNT_NOATIME) && !(ip->i_flag & (IN_CHANGE | IN_UPDATE))) { ip->i_flag &= ~IN_ACCESS; } if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 && - ap->a_waitfor != MNT_WAIT) + waitfor != MNT_WAIT) return (0); if (ip->i_flag & IN_ACCESS) { - ip->i_ffs_atime = ap->a_access->tv_sec; - ip->i_ffs_atimensec = ap->a_access->tv_nsec; + ip->i_ffs_atime = atime ? atime->tv_sec : ts.tv_sec; + ip->i_ffs_atimensec = atime ? atime->tv_nsec : ts.tv_nsec; } if (ip->i_flag & IN_UPDATE) { - ip->i_ffs_mtime = ap->a_modify->tv_sec; - ip->i_ffs_mtimensec = ap->a_modify->tv_nsec; + ip->i_ffs_mtime = mtime ? mtime->tv_sec : ts.tv_sec; + ip->i_ffs_mtimensec = mtime ? mtime->tv_nsec : ts.tv_nsec; ip->i_modrev++; } if (ip->i_flag & IN_CHANGE) { @@ -131,14 +127,14 @@ ffs_update(v) return (error); } - if (DOINGSOFTDEP(ap->a_vp)) - softdep_update_inodeblock(ip, bp, ap->a_waitfor); + if (DOINGSOFTDEP(vp)) + softdep_update_inodeblock(ip, bp, waitfor); else if (ip->i_effnlink != ip->i_ffs_nlink) panic("ffs_update: bad link cnt"); *((struct dinode *)bp->b_data + ino_to_fsbo(fs, ip->i_number)) = ip->i_din.ffs_din; - if (ap->a_waitfor && !DOINGASYNC(ap->a_vp)) { + if (waitfor && !DOINGASYNC(vp)) { return (bwrite(bp)); } else { bdwrite(bp); @@ -154,37 +150,25 @@ ffs_update(v) * disk blocks. */ int -ffs_truncate(v) - void *v; +ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred) { - struct vop_truncate_args /* { - struct vnode *a_vp; - off_t a_length; - int a_flags; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap = v; - register struct vnode *ovp = ap->a_vp; - register daddr_t lastblock; - register struct inode *oip; + struct vnode *ovp; + daddr_t lastblock; daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR]; daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; - off_t length = ap->a_length; - register struct fs *fs; + struct fs *fs; struct buf *bp; int offset, size, level; long count, nblocks, vflags, blocksreleased = 0; - struct timespec ts; register int i; int aflags, error, allerror; off_t osize; if (length < 0) return (EINVAL); - oip = VTOI(ovp); + ovp = ITOV(oip); if (oip->i_ffs_size == length) return (0); - TIMEVAL_TO_TIMESPEC(&time, &ts); if (ovp->v_type == VLNK && (oip->i_ffs_size < ovp->v_mount->mnt_maxsymlinklen || (ovp->v_mount->mnt_maxsymlinklen == 0 && @@ -196,7 +180,7 @@ ffs_truncate(v) bzero((char *)&oip->i_ffs_shortlink, (u_int)oip->i_ffs_size); oip->i_ffs_size = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; - return (VOP_UPDATE(ovp, &ts, &ts, 1)); + return (UFS_UPDATE(oip, MNT_WAIT)); } #ifdef QUOTA if ((error = getinoquota(oip)) != 0) @@ -221,17 +205,17 @@ ffs_truncate(v) * rarely, we solve the problem by syncing the file * so that it will have no data structures left. */ - if ((error = VOP_FSYNC(ovp, ap->a_cred, MNT_WAIT, - ap->a_p)) != 0) + if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT, + curproc)) != 0) return (error); } else { #ifdef QUOTA (void) chkdq(oip, -oip->i_ffs_blocks, NOCRED, 0); #endif softdep_setup_freeblocks(oip, length); - (void) vinvalbuf(ovp, 0, ap->a_cred, ap->a_p, 0, 0); + (void) vinvalbuf(ovp, 0, cred, curproc, 0, 0); oip->i_flag |= IN_CHANGE | IN_UPDATE; - return (VOP_UPDATE(ovp, &ts, &ts, 0)); + return (UFS_UPDATE(oip, 0)); } } @@ -246,10 +230,10 @@ ffs_truncate(v) if (length > fs->fs_maxfilesize) return (EFBIG); aflags = B_CLRBUF; - if (ap->a_flags & IO_SYNC) + if (flags & IO_SYNC) aflags |= B_SYNC; - error = VOP_BALLOC(ovp, length - 1, 1, - ap->a_cred, aflags, &bp); + error = UFS_BUF_ALLOC(oip, length - 1, 1, + cred, aflags, &bp); if (error) return (error); oip->i_ffs_size = length; @@ -265,7 +249,7 @@ ffs_truncate(v) else bawrite(bp); oip->i_flag |= IN_CHANGE | IN_UPDATE; - return (VOP_UPDATE(ovp, &ts, &ts, 1)); + return (UFS_UPDATE(oip, MNT_WAIT)); } #if defined(UVM) uvm_vnp_setsize(ovp, length); @@ -287,10 +271,10 @@ ffs_truncate(v) } else { lbn = lblkno(fs, length); aflags = B_CLRBUF; - if (ap->a_flags & IO_SYNC) + if (flags & IO_SYNC) aflags |= B_SYNC; - error = VOP_BALLOC(ovp, length - 1, 1, - ap->a_cred, aflags, &bp); + error = UFS_BUF_ALLOC(oip, length - 1, 1, + cred, aflags, &bp); if (error) return (error); oip->i_ffs_size = length; @@ -335,7 +319,7 @@ ffs_truncate(v) for (i = NDADDR - 1; i > lastblock; i--) oip->i_ffs_db[i] = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; - if ((error = VOP_UPDATE(ovp, &ts, &ts, 1)) != 0) + if ((error = UFS_UPDATE(oip, MNT_WAIT)) != 0) allerror = error; /* * Having written the new inode to disk, save its new configuration @@ -347,7 +331,7 @@ ffs_truncate(v) bcopy((caddr_t)oldblks, (caddr_t)&oip->i_ffs_db[0], sizeof oldblks); oip->i_ffs_size = osize; vflags = ((length > 0) ? V_SAVE : 0) | V_SAVEMETA; - allerror = vinvalbuf(ovp, vflags, ap->a_cred, ap->a_p, 0, 0); + allerror = vinvalbuf(ovp, vflags, cred, curproc, 0, 0); /* * Indirect blocks first. diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 1dea5971c61..1f1a648007d 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_softdep.c,v 1.22 2001/04/06 18:59:16 gluk Exp $ */ +/* $OpenBSD: ffs_softdep.c,v 1.23 2001/06/23 02:07:54 csapuntz Exp $ */ /* * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved. * @@ -2832,7 +2832,7 @@ handle_workitem_remove(dirrem) panic("handle_workitem_remove: bad dir delta"); inodedep->id_nlinkdelta = ip->i_ffs_nlink - ip->i_effnlink; FREE_LOCK(&lk); - if ((error = VOP_TRUNCATE(vp, (off_t)0, 0, p->p_ucred, p)) != 0) + if ((error = UFS_TRUNCATE(ip, (off_t)0, 0, p->p_ucred)) != 0) softdep_error("handle_workitem_remove: truncate", error); /* * Rename a directory to a new parent. Since, we are both deleting @@ -2904,15 +2904,10 @@ handle_workitem_freefile(freefile) tip.i_fs = fs; tip.i_vnode = &vp; vp.v_data = &tip; - { - struct vop_vfree_args vargs; - vargs.a_pvp = &vp; - vargs.a_ino = freefile->fx_oldinum; - vargs.a_mode = freefile->fx_mode; - - if ((error = ffs_freefile(&vargs)) != 0) - softdep_error("handle_workitem_freefile", error); + if ((error = ffs_freefile(&tip, freefile->fx_oldinum, + freefile->fx_mode)) != 0) { + softdep_error("handle_workitem_freefile", error); } WORKITEM_FREE(freefile, D_FREEFILE); } @@ -3895,7 +3890,6 @@ softdep_fsync(vp) int error, flushparent; ino_t parentino; ufs_lbn_t lbn; - struct timespec ts; ip = VTOI(vp); fs = ip->i_fs; @@ -3960,8 +3954,7 @@ softdep_fsync(vp) if (error != 0) return (error); if (flushparent) { - TIMEVAL_TO_TIMESPEC(&time, &ts); - if ((error = VOP_UPDATE(pvp, &ts, &ts, MNT_WAIT))) { + if ((error = UFS_UPDATE(VTOI(pvp), MNT_WAIT))) { vput(pvp); return (error); } @@ -4398,7 +4391,6 @@ flush_pagedep_deps(pvp, mp, diraddhdp) struct inodedep *inodedep; struct ufsmount *ump; struct diradd *dap; - struct timespec ts; struct vnode *vp; int gotit, error = 0; struct buf *bp; @@ -4411,9 +4403,8 @@ flush_pagedep_deps(pvp, mp, diraddhdp) * has a MKDIR_PARENT dependency. */ if (dap->da_state & MKDIR_PARENT) { - TIMEVAL_TO_TIMESPEC(&time, &ts); FREE_LOCK(&lk); - if ((error = VOP_UPDATE(pvp, &ts, &ts, MNT_WAIT))) + if ((error = UFS_UPDATE(VTOI(pvp), MNT_WAIT))) break; ACQUIRE_LOCK(&lk); /* diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 1400d5b0cb3..3f10074d09d 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_subr.c,v 1.7 2001/03/20 19:54:08 art Exp $ */ +/* $OpenBSD: ffs_subr.c,v 1.8 2001/06/23 02:07:55 csapuntz Exp $ */ /* $NetBSD: ffs_subr.c,v 1.6 1996/03/17 02:16:23 christos Exp $ */ /* @@ -53,34 +53,27 @@ * remaining space in the directory. */ int -ffs_blkatoff(v) - void *v; +ffs_bufatoff(struct inode *ip, off_t offset, char **res, struct buf **bpp) { - struct vop_blkatoff_args /* { - struct vnode *a_vp; - off_t a_offset; - char **a_res; - struct buf **a_bpp; - } */ *ap = v; - struct inode *ip; - register struct fs *fs; + struct fs *fs; + struct vnode *vp; struct buf *bp; daddr_t lbn; int bsize, error; - ip = VTOI(ap->a_vp); + vp = ITOV(ip); fs = ip->i_fs; - lbn = lblkno(fs, ap->a_offset); + lbn = lblkno(fs, offset); bsize = blksize(fs, ip, lbn); - *ap->a_bpp = NULL; - if ((error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) != 0) { + *bpp = NULL; + if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) { brelse(bp); return (error); } - if (ap->a_res) - *ap->a_res = (char *)bp->b_data + blkoff(fs, ap->a_offset); - *ap->a_bpp = bp; + if (res) + *res = (char *)bp->b_data + blkoff(fs, offset); + *bpp = bp; return (0); } #endif diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 6df1ee27efa..c16953ed2a3 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.42 2001/05/15 23:44:41 ho Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.43 2001/06/23 02:07:55 csapuntz Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -85,6 +85,15 @@ struct vfsops ffs_vfsops = { ufs_check_export }; +struct inode_vtbl ffs_vtbl = { + ffs_truncate, + ffs_update, + ffs_inode_alloc, + ffs_inode_free, + ffs_balloc, + ffs_bufatoff +}; + extern u_long nextgennumber; /* @@ -1088,6 +1097,8 @@ retry: ip->i_fs = fs = ump->um_fs; ip->i_dev = dev; ip->i_number = ino; + ip->i_vtbl = &ffs_vtbl; + #ifdef QUOTA { int i; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 432a2fc0539..a41c5d3d0be 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.16 2001/03/22 00:11:36 art Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.17 2001/06/23 02:07:55 csapuntz Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -89,9 +89,7 @@ struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_select_desc, ufs_select }, /* select */ { &vop_kqfilter_desc, ufs_kqfilter }, /* kqfilter */ { &vop_revoke_desc, ufs_revoke }, /* revoke */ - { &vop_mmap_desc, ufs_mmap }, /* mmap */ { &vop_fsync_desc, ffs_fsync }, /* fsync */ - { &vop_seek_desc, ufs_seek }, /* seek */ { &vop_remove_desc, ufs_remove }, /* remove */ { &vop_link_desc, ufs_link }, /* link */ { &vop_rename_desc, ufs_rename }, /* rename */ @@ -111,13 +109,7 @@ struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_islocked_desc, ufs_islocked }, /* islocked */ { &vop_pathconf_desc, ufs_pathconf }, /* pathconf */ { &vop_advlock_desc, ufs_advlock }, /* advlock */ - { &vop_blkatoff_desc, ffs_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, ffs_valloc }, /* valloc */ - { &vop_balloc_desc, ffs_balloc }, /* balloc */ { &vop_reallocblks_desc, ffs_reallocblks }, /* reallocblks */ - { &vop_vfree_desc, ffs_vfree }, /* vfree */ - { &vop_truncate_desc, ffs_truncate }, /* truncate */ - { &vop_update_desc, ffs_update }, /* update */ { &vop_bwrite_desc, vop_generic_bwrite }, { (struct vnodeop_desc*)NULL, (int(*) __P((void*)))NULL } }; @@ -142,9 +134,7 @@ struct vnodeopv_entry_desc ffs_specop_entries[] = { { &vop_select_desc, spec_select }, /* select */ { &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */ { &vop_revoke_desc, spec_revoke }, /* revoke */ - { &vop_mmap_desc, spec_mmap }, /* mmap */ { &vop_fsync_desc, ffs_fsync }, /* fsync */ - { &vop_seek_desc, spec_seek }, /* seek */ { &vop_remove_desc, spec_remove }, /* remove */ { &vop_link_desc, spec_link }, /* link */ { &vop_rename_desc, spec_rename }, /* rename */ @@ -164,13 +154,7 @@ struct vnodeopv_entry_desc ffs_specop_entries[] = { { &vop_islocked_desc, ufs_islocked }, /* islocked */ { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ - { &vop_vfree_desc, ffs_vfree }, /* vfree */ - { &vop_blkatoff_desc, spec_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, spec_valloc }, /* valloc */ { &vop_reallocblks_desc, spec_reallocblks }, /* reallocblks */ - { &vop_vfree_desc, ffs_vfree }, /* vfree */ - { &vop_truncate_desc, spec_truncate }, /* truncate */ - { &vop_update_desc, ffs_update }, /* update */ { &vop_bwrite_desc, vop_generic_bwrite }, { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } }; @@ -196,9 +180,7 @@ struct vnodeopv_entry_desc ffs_fifoop_entries[] = { { &vop_select_desc, fifo_select }, /* select */ { &vop_kqfilter_desc, fifo_kqfilter }, /* kqfilter */ { &vop_revoke_desc, fifo_revoke }, /* revoke */ - { &vop_mmap_desc, fifo_mmap }, /* mmap */ { &vop_fsync_desc, ffs_fsync }, /* fsync */ - { &vop_seek_desc, fifo_seek }, /* seek */ { &vop_remove_desc, fifo_remove }, /* remove */ { &vop_link_desc, fifo_link }, /* link */ { &vop_rename_desc, fifo_rename }, /* rename */ @@ -218,13 +200,7 @@ struct vnodeopv_entry_desc ffs_fifoop_entries[] = { { &vop_islocked_desc, ufs_islocked }, /* islocked */ { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ - { &vop_vfree_desc, ffs_vfree }, /* vfree */ - { &vop_blkatoff_desc, fifo_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, fifo_valloc }, /* valloc */ { &vop_reallocblks_desc, fifo_reallocblks }, /* reallocblks */ - { &vop_vfree_desc, ffs_vfree }, /* vfree */ - { &vop_truncate_desc, fifo_truncate }, /* truncate */ - { &vop_update_desc, ffs_update }, /* update */ { &vop_bwrite_desc, vop_generic_bwrite }, { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL } }; @@ -256,7 +232,6 @@ ffs_fsync(v) } */ *ap = v; struct vnode *vp = ap->a_vp; struct buf *bp, *nbp; - struct timespec ts; int s, error, passes, skipmeta; if (vp->v_type == VBLK && @@ -338,8 +313,7 @@ loop: } } splx(s); - TIMEVAL_TO_TIMESPEC(&time, &ts); - return (VOP_UPDATE(vp, &ts, &ts, ap->a_waitfor == MNT_WAIT)); + return (UFS_UPDATE(VTOI(vp), ap->a_waitfor == MNT_WAIT)); } /* |