ffs code.
ok mpi tedu
-/* $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 $ */
/*
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);
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
-/* $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 $ */
/*
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);
+}
-/* $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 $ */
/*
* 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);
-/* $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 $ */
/*-
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 *);
-/* $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 $ */
/*
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.
*/