summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1999-08-13 16:29:27 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1999-08-13 16:29:27 +0000
commit2820b2e76279127ce494c58f5f3f922500e022a3 (patch)
tree774216f00585bdb1c7e4057c00964fa0d82dbd75
parente9e879c34d40e24bec415dcf86db79cce7197721 (diff)
Notes
-rw-r--r--sys/fs/specfs/spec_vnops.c77
-rw-r--r--sys/miscfs/specfs/spec_vnops.c77
-rw-r--r--sys/sys/conf.h5
-rw-r--r--sys/sys/linedisc.h5
4 files changed, 42 insertions, 122 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index e683dab4de6d..befab656f2fd 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.93 1999/08/13 10:29:23 phk Exp $
+ * $Id: spec_vnops.c,v 1.94 1999/08/13 10:53:58 phk Exp $
*/
#include <sys/param.h>
@@ -615,7 +615,6 @@ spec_close(ap)
{
register struct vnode *vp = ap->a_vp;
dev_t dev = vp->v_rdev;
- d_close_t *devclose;
int mode, error;
switch (vp->v_type) {
@@ -636,14 +635,6 @@ spec_close(ap)
vrele(vp);
ap->a_p->p_session->s_ttyvp = NULL;
}
- /*
- * If the vnode is locked, then we are in the midst
- * of forcably closing the device, otherwise we only
- * close on last reference.
- */
- if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
- return (0);
- devclose = devsw(dev)->d_close;
mode = S_IFCHR;
break;
@@ -659,27 +650,29 @@ spec_close(ap)
if (error)
return (error);
- /*
- * We do not want to really close the device if it
- * is still in use unless we are trying to close it
- * forcibly. Since every use (buffer, vnode, swap, cmap)
- * holds a reference to the vnode, and because we mark
- * any other vnodes that alias this device, when the
- * sum of the reference counts on all the aliased
- * vnodes descends to one, we are on last close.
- */
- if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
- return (0);
-
- devclose = devsw(dev)->d_close;
mode = S_IFBLK;
break;
default:
panic("spec_close: not special");
}
-
- return ((*devclose)(dev, ap->a_fflag, mode, ap->a_p));
+ /*
+ * We do not want to really close the device if it
+ * is still in use unless we are trying to close it
+ * forcibly. Since every use (buffer, vnode, swap, cmap)
+ * holds a reference to the vnode, and because we mark
+ * any other vnodes that alias this device, when the
+ * sum of the reference counts on all the aliased
+ * vnodes descends to one, we are on last close.
+ */
+ if (vp->v_flag & VXLOCK) {
+ /* Forced close */
+ } else if (devsw(dev)->d_flags & D_TRACKCLOSE) {
+ /* Keep device updated on status */
+ } else if (vcount(vp) > 1) {
+ return (0);
+ }
+ return (devsw(dev)->d_close(dev, ap->a_fflag, mode, ap->a_p));
}
/*
@@ -923,37 +916,3 @@ spec_getpages(ap)
relpbuf(bp, NULL);
return VM_PAGER_OK;
}
-
-/* ARGSUSED */
-static int
-spec_getattr(ap)
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct proc *a_p;
- } */ *ap;
-{
- register struct vnode *vp = ap->a_vp;
- register struct vattr *vap = ap->a_vap;
- struct partinfo dpart;
-
- bzero(vap, sizeof (*vap));
-
- if (vp->v_type == VBLK) {
- if (vp->v_rdev)
- vap->va_blocksize = vp->v_specmountpoint->mnt_stat.f_iosize;
- else
- vap->va_blocksize = BLKDEV_IOSIZE;
- } else if (vp->v_type == VCHR) {
- vap->va_blocksize = MAXBSIZE;
- }
-
- if ((*devsw(vp->v_rdev)->d_ioctl)(vp->v_rdev, DIOCGPART,
- (caddr_t)&dpart, FREAD, ap->a_p) == 0) {
- vap->va_bytes = dbtob(dpart.disklab->d_partitions
- [minor(vp->v_rdev)].p_size);
- vap->va_size = vap->va_bytes;
- }
- return (0);
-}
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index e683dab4de6d..befab656f2fd 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.93 1999/08/13 10:29:23 phk Exp $
+ * $Id: spec_vnops.c,v 1.94 1999/08/13 10:53:58 phk Exp $
*/
#include <sys/param.h>
@@ -615,7 +615,6 @@ spec_close(ap)
{
register struct vnode *vp = ap->a_vp;
dev_t dev = vp->v_rdev;
- d_close_t *devclose;
int mode, error;
switch (vp->v_type) {
@@ -636,14 +635,6 @@ spec_close(ap)
vrele(vp);
ap->a_p->p_session->s_ttyvp = NULL;
}
- /*
- * If the vnode is locked, then we are in the midst
- * of forcably closing the device, otherwise we only
- * close on last reference.
- */
- if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
- return (0);
- devclose = devsw(dev)->d_close;
mode = S_IFCHR;
break;
@@ -659,27 +650,29 @@ spec_close(ap)
if (error)
return (error);
- /*
- * We do not want to really close the device if it
- * is still in use unless we are trying to close it
- * forcibly. Since every use (buffer, vnode, swap, cmap)
- * holds a reference to the vnode, and because we mark
- * any other vnodes that alias this device, when the
- * sum of the reference counts on all the aliased
- * vnodes descends to one, we are on last close.
- */
- if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
- return (0);
-
- devclose = devsw(dev)->d_close;
mode = S_IFBLK;
break;
default:
panic("spec_close: not special");
}
-
- return ((*devclose)(dev, ap->a_fflag, mode, ap->a_p));
+ /*
+ * We do not want to really close the device if it
+ * is still in use unless we are trying to close it
+ * forcibly. Since every use (buffer, vnode, swap, cmap)
+ * holds a reference to the vnode, and because we mark
+ * any other vnodes that alias this device, when the
+ * sum of the reference counts on all the aliased
+ * vnodes descends to one, we are on last close.
+ */
+ if (vp->v_flag & VXLOCK) {
+ /* Forced close */
+ } else if (devsw(dev)->d_flags & D_TRACKCLOSE) {
+ /* Keep device updated on status */
+ } else if (vcount(vp) > 1) {
+ return (0);
+ }
+ return (devsw(dev)->d_close(dev, ap->a_fflag, mode, ap->a_p));
}
/*
@@ -923,37 +916,3 @@ spec_getpages(ap)
relpbuf(bp, NULL);
return VM_PAGER_OK;
}
-
-/* ARGSUSED */
-static int
-spec_getattr(ap)
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct proc *a_p;
- } */ *ap;
-{
- register struct vnode *vp = ap->a_vp;
- register struct vattr *vap = ap->a_vap;
- struct partinfo dpart;
-
- bzero(vap, sizeof (*vap));
-
- if (vp->v_type == VBLK) {
- if (vp->v_rdev)
- vap->va_blocksize = vp->v_specmountpoint->mnt_stat.f_iosize;
- else
- vap->va_blocksize = BLKDEV_IOSIZE;
- } else if (vp->v_type == VCHR) {
- vap->va_blocksize = MAXBSIZE;
- }
-
- if ((*devsw(vp->v_rdev)->d_ioctl)(vp->v_rdev, DIOCGPART,
- (caddr_t)&dpart, FREAD, ap->a_p) == 0) {
- vap->va_bytes = dbtob(dpart.disklab->d_partitions
- [minor(vp->v_rdev)].p_size);
- vap->va_size = vap->va_bytes;
- }
- return (0);
-}
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 90a4422c9b33..9124880d7c5d 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.70 1999/08/13 10:10:11 phk Exp $
+ * $Id: conf.h,v 1.71 1999/08/13 10:29:31 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -122,7 +122,7 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
*/
#define D_TAPE 1
#define D_DISK 2
-#define D_TTY 3
+#define D_TTY 4
#define D_TYPEMASK 0xffff
@@ -133,6 +133,7 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
#define D_CANFREE 0x40000 /* can free blocks */
+#define D_TRACKCLOSE 0x80000 /* track all closes */
/*
* Character device switch table
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index 90a4422c9b33..9124880d7c5d 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.70 1999/08/13 10:10:11 phk Exp $
+ * $Id: conf.h,v 1.71 1999/08/13 10:29:31 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -122,7 +122,7 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
*/
#define D_TAPE 1
#define D_DISK 2
-#define D_TTY 3
+#define D_TTY 4
#define D_TYPEMASK 0xffff
@@ -133,6 +133,7 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
#define D_CANFREE 0x40000 /* can free blocks */
+#define D_TRACKCLOSE 0x80000 /* track all closes */
/*
* Character device switch table