The ufs_vinit() function should really be called ffs_vinit(). The only
place it is called from is ffs_vget(). And again, the FIFOOPS macro can
be killed.

Ok?

natano


Index: ufs/ffs/ffs_extern.h
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_extern.h,v
retrieving revision 1.42
diff -u -p -r1.42 ffs_extern.h
--- ufs/ffs/ffs_extern.h        23 May 2016 09:31:28 -0000      1.42
+++ ufs/ffs/ffs_extern.h        7 Aug 2016 21:25:39 -0000
@@ -132,6 +132,7 @@ int  ffs_isfreeblock(struct fs *, u_char
 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);
@@ -187,12 +188,6 @@ void  softdep_setup_allocindir_page(stru
 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 */
Index: ufs/ffs/ffs_subr.c
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_subr.c,v
retrieving revision 1.30
diff -u -p -r1.30 ffs_subr.c
--- ufs/ffs/ffs_subr.c  28 Nov 2015 21:52:02 -0000      1.30
+++ ufs/ffs/ffs_subr.c  7 Aug 2016 21:25:39 -0000
@@ -244,3 +244,68 @@ ffs_isfreeblock(struct fs *fs, u_char *c
                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);
+}
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.160
diff -u -p -r1.160 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c        19 Jun 2016 11:54:34 -0000      1.160
+++ ufs/ffs/ffs_vfsops.c        7 Aug 2016 21:25:39 -0000
@@ -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);
Index: ufs/ufs/ufs_extern.h
===================================================================
RCS file: /cvs/src/sys/ufs/ufs/ufs_extern.h,v
retrieving revision 1.35
diff -u -p -r1.35 ufs_extern.h
--- ufs/ufs/ufs_extern.h        25 Jan 2014 23:31:13 -0000      1.35
+++ ufs/ufs/ufs_extern.h        7 Aug 2016 21:25:39 -0000
@@ -130,7 +130,6 @@ int ufs_check_export(struct mount *, str
                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 *);
Index: ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /cvs/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.129
diff -u -p -r1.129 ufs_vnops.c
--- ufs/ufs/ufs_vnops.c 14 Jul 2016 03:34:28 -0000      1.129
+++ ufs/ufs/ufs_vnops.c 7 Aug 2016 21:25:39 -0000
@@ -1803,72 +1803,6 @@ ufs_advlock(void *v)
 }
 
 /*
- * 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.
  */
 int

Reply via email to