From b2403cbafa9de628f723d264482cce034e092517 Mon Sep 17 00:00:00 2001 From: natano Date: Wed, 10 Aug 2016 08:04:57 +0000 Subject: [PATCH] ufs_vinit() should really be called ffs_vinit(); it's only called from ffs code. ok mpi tedu --- sys/ufs/ffs/ffs_extern.h | 9 ++---- sys/ufs/ffs/ffs_subr.c | 67 ++++++++++++++++++++++++++++++++++++++- sys/ufs/ffs/ffs_vfsops.c | 5 ++- sys/ufs/ufs/ufs_extern.h | 3 +- sys/ufs/ufs/ufs_vnops.c | 68 +--------------------------------------- 5 files changed, 72 insertions(+), 80 deletions(-) diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index ecb37e464ff..45de5724f2f 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.42 2016/05/23 09:31:28 natano Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.43 2016/08/10 08:04:57 natano Exp $ */ /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */ /* @@ -132,6 +132,7 @@ int ffs_isfreeblock(struct fs *, u_char *, daddr_t); int ffs_isblock(struct fs *, u_char *, daddr_t); void ffs_clrblock(struct fs *, u_char *, daddr_t); void ffs_setblock(struct fs *, u_char *, daddr_t); +int ffs_vinit(struct mount *, struct vnode **); /* ffs_vfsops.c */ int ffs_mountroot(void); @@ -188,12 +189,6 @@ void softdep_fsync_mountdev(struct vnode *, int); int softdep_sync_metadata(struct vop_fsync_args *); int softdep_fsync(struct vnode *); -#ifdef FIFO -#define FFS_FIFOOPS &ffs_fifovops -#else -#define FFS_FIFOOPS NULL -#endif - extern struct pool ffs_ino_pool; /* memory pool for inodes */ extern struct pool ffs_dinode1_pool; /* memory pool for UFS1 dinodes */ #ifdef FFS2 diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 3da51515e37..d2455d45ef7 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.30 2015/11/28 21:52:02 beck Exp $ */ +/* $OpenBSD: ffs_subr.c,v 1.31 2016/08/10 08:04:57 natano Exp $ */ /* $NetBSD: ffs_subr.c,v 1.6 1996/03/17 02:16:23 christos Exp $ */ /* @@ -244,3 +244,68 @@ ffs_isfreeblock(struct fs *fs, u_char *cp, daddr_t h) return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0); } } + +/* + * Initialize the vnode associated with a new inode, handle aliased + * vnodes. + */ +int +ffs_vinit(struct mount *mntp, struct vnode **vpp) +{ + struct inode *ip; + struct vnode *vp, *nvp; + struct timeval mtv; + + vp = *vpp; + ip = VTOI(vp); + switch(vp->v_type = IFTOVT(DIP(ip, mode))) { + case VCHR: + case VBLK: + vp->v_op = &ffs_specvops; + if ((nvp = checkalias(vp, DIP(ip, rdev), mntp)) != NULL) { + /* + * Discard unneeded vnode, but save its inode. + * Note that the lock is carried over in the inode + * to the replacement vnode. + */ + nvp->v_data = vp->v_data; + vp->v_data = NULL; + vp->v_op = &spec_vops; +#ifdef VFSLCKDEBUG + vp->v_flag &= ~VLOCKSWORK; +#endif + vrele(vp); + vgone(vp); + /* + * Reinitialize aliased inode. + */ + vp = nvp; + ip->i_vnode = vp; + } + break; + case VFIFO: +#ifdef FIFO + vp->v_op = &ffs_fifovops; + break; +#else + return (EOPNOTSUPP); +#endif + case VNON: + case VBAD: + case VSOCK: + case VLNK: + case VDIR: + case VREG: + break; + } + if (ip->i_number == ROOTINO) + vp->v_flag |= VROOT; + /* + * Initialize modrev times + */ + getmicrouptime(&mtv); + ip->i_modrev = (u_quad_t)mtv.tv_sec << 32; + ip->i_modrev |= (u_quad_t)mtv.tv_usec * 4294; + *vpp = vp; + return (0); +} diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 20fee3d9773..5249344fc0a 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.160 2016/06/19 11:54:34 natano Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.161 2016/08/10 08:04:57 natano Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -1367,8 +1367,7 @@ retry: * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ufs_vinit(mp, &ffs_specvops, FFS_FIFOOPS, &vp); - if (error) { + if ((error = ffs_vinit(mp, &vp)) != 0) { vput(vp); *vpp = NULL; return (error); diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index be7ed8575da..229d3c25501 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_extern.h,v 1.35 2014/01/25 23:31:13 guenther Exp $ */ +/* $OpenBSD: ufs_extern.h,v 1.36 2016/08/10 08:04:57 natano Exp $ */ /* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */ /*- @@ -130,7 +130,6 @@ int ufs_check_export(struct mount *, struct mbuf *, int *, struct ucred **); /* ufs_vnops.c */ -int ufs_vinit(struct mount *, struct vops *, struct vops *, struct vnode **); void ufs_itimes(struct vnode *); int ufs_makeinode(int, struct vnode *, struct vnode **, struct componentname *); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 30fafc3f8b7..5ddf03597d4 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.129 2016/07/14 03:34:28 guenther Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.130 2016/08/10 08:04:57 natano Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1802,72 +1802,6 @@ ufs_advlock(void *v) ap->a_fl, ap->a_flags)); } -/* - * Initialize the vnode associated with a new inode, handle aliased - * vnodes. - */ -int -ufs_vinit(struct mount *mntp, struct vops *specops, struct vops *fifoops, - struct vnode **vpp) -{ - struct inode *ip; - struct vnode *vp, *nvp; - struct timeval mtv; - - vp = *vpp; - ip = VTOI(vp); - switch(vp->v_type = IFTOVT(DIP(ip, mode))) { - case VCHR: - case VBLK: - vp->v_op = specops; - if ((nvp = checkalias(vp, DIP(ip, rdev), mntp)) != NULL) { - /* - * Discard unneeded vnode, but save its inode. - * Note that the lock is carried over in the inode - * to the replacement vnode. - */ - nvp->v_data = vp->v_data; - vp->v_data = NULL; - vp->v_op = &spec_vops; -#ifdef VFSLCKDEBUG - vp->v_flag &= ~VLOCKSWORK; -#endif - vrele(vp); - vgone(vp); - /* - * Reinitialize aliased inode. - */ - vp = nvp; - ip->i_vnode = vp; - } - break; - case VFIFO: -#ifdef FIFO - vp->v_op = fifoops; - break; -#else - return (EOPNOTSUPP); -#endif - case VNON: - case VBAD: - case VSOCK: - case VLNK: - case VDIR: - case VREG: - break; - } - if (ip->i_number == ROOTINO) - vp->v_flag |= VROOT; - /* - * Initialize modrev times - */ - getmicrouptime(&mtv); - ip->i_modrev = (u_quad_t)mtv.tv_sec << 32; - ip->i_modrev |= (u_quad_t)mtv.tv_usec * 4294; - *vpp = vp; - return (0); -} - /* * Allocate a new inode. */ -- 2.20.1