svn commit: r210918 - head/sys/fs/devfs

Konstantin Belousov kib at FreeBSD.org
Fri Aug 6 09:06:56 UTC 2010


Author: kib
Date: Fri Aug  6 09:06:55 2010
New Revision: 210918
URL: http://svn.freebsd.org/changeset/base/210918

Log:
  Initialize VV_ISTTY vnode flag on the devfs vnode creation instead of
  doing it on each open.
  
  In collaboration with:	pho
  MFC after:	1 month

Modified:
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Fri Aug  6 08:59:54 2010	(r210917)
+++ head/sys/fs/devfs/devfs_vnops.c	Fri Aug  6 09:06:55 2010	(r210918)
@@ -337,6 +337,7 @@ devfs_allocv(struct devfs_dirent *de, st
 	struct vnode *vp;
 	struct cdev *dev;
 	struct devfs_mount *dmp;
+	struct cdevsw *dsw;
 
 	dmp = VFSTODEVFS(mp);
 	if (de->de_flags & DE_DOOMED) {
@@ -393,6 +394,10 @@ devfs_allocv(struct devfs_dirent *de, st
 		KASSERT(vp->v_usecount == 1,
 		    ("%s %d (%d)\n", __func__, __LINE__, vp->v_usecount));
 		dev->si_usecount += vp->v_usecount;
+		/* Special casing of ttys for deadfs.  Probably redundant. */
+		dsw = dev->si_devsw;
+		if (dsw != NULL && (dsw->d_flags & D_TTY) != 0)
+			vp->v_vflag |= VV_ISTTY;
 		dev_unlock();
 		VI_UNLOCK(vp);
 		vp->v_op = &devfs_specops;
@@ -972,10 +977,6 @@ devfs_open(struct vop_open_args *ap)
 	if (dsw == NULL)
 		return (ENXIO);
 
-	/* XXX: Special casing of ttys for deadfs.  Probably redundant. */
-	if (dsw->d_flags & D_TTY)
-		vp->v_vflag |= VV_ISTTY;
-
 	VOP_UNLOCK(vp, 0);
 
 	fpop = td->td_fpop;


More information about the svn-src-all mailing list