This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / kern / spec_vnops.c
index d1be0ab..12e5ce4 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)spec_vnops.c  7.37 (Berkeley) 5/30/91
  * SUCH DAMAGE.
  *
  *     from: @(#)spec_vnops.c  7.37 (Berkeley) 5/30/91
- *     $Id$
+ *     $Id: spec_vnops.c,v 1.3 1993/11/25 01:33:15 wollman Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "disklabel.h"
 
 /* symbolic sleep message strings for devices */
 #include "disklabel.h"
 
 /* symbolic sleep message strings for devices */
-char   devopn[] = "devopn";
-char   devio[] = "devio";
-char   devwait[] = "devwait";
-char   devin[] = "devin";
-char   devout[] = "devout";
-char   devioc[] = "devioc";
-char   devcls[] = "devcls";
+const char     devopn[] = "devopn";
+const char     devio[] = "devio";
+const char     devwait[] = "devwait";
+const char     devin[] = "devin";
+const char     devout[] = "devout";
+const char     devioc[] = "devioc";
+const char     devcls[] = "devcls";
 
 struct vnodeops spec_vnodeops = {
        spec_lookup,            /* lookup */
 
 struct vnodeops spec_vnodeops = {
        spec_lookup,            /* lookup */
@@ -99,6 +99,7 @@ struct vnodeops spec_vnodeops = {
 /*
  * Trivial lookup routine that always fails.
  */
 /*
  * Trivial lookup routine that always fails.
  */
+int
 spec_lookup(vp, ndp, p)
        struct vnode *vp;
        struct nameidata *ndp;
 spec_lookup(vp, ndp, p)
        struct vnode *vp;
        struct nameidata *ndp;
@@ -116,6 +117,7 @@ spec_lookup(vp, ndp, p)
  * Otherwise, call device driver open function.
  */
 /* ARGSUSED */
  * Otherwise, call device driver open function.
  */
 /* ARGSUSED */
+int
 spec_open(vp, mode, cred, p)
        register struct vnode *vp;
        int mode;
 spec_open(vp, mode, cred, p)
        register struct vnode *vp;
        int mode;
@@ -135,7 +137,9 @@ spec_open(vp, mode, cred, p)
                if ((u_int)maj >= nchrdev)
                        return (ENXIO);
                VOP_UNLOCK(vp);
                if ((u_int)maj >= nchrdev)
                        return (ENXIO);
                VOP_UNLOCK(vp);
+               vp->v_opencount++;
                error = (*cdevsw[maj].d_open)(dev, mode, S_IFCHR, p);
                error = (*cdevsw[maj].d_open)(dev, mode, S_IFCHR, p);
+               --vp->v_opencount;
                VOP_LOCK(vp);
                return (error);
 
                VOP_LOCK(vp);
                return (error);
 
@@ -153,6 +157,7 @@ spec_open(vp, mode, cred, p)
  * Vnode op for read
  */
 /* ARGSUSED */
  * Vnode op for read
  */
 /* ARGSUSED */
+int
 spec_read(vp, uio, ioflag, cred)
        register struct vnode *vp;
        register struct uio *uio;
 spec_read(vp, uio, ioflag, cred)
        register struct vnode *vp;
        register struct uio *uio;
@@ -237,6 +242,7 @@ spec_read(vp, uio, ioflag, cred)
  * Vnode op for write
  */
 /* ARGSUSED */
  * Vnode op for write
  */
 /* ARGSUSED */
+int
 spec_write(vp, uio, ioflag, cred)
        register struct vnode *vp;
        register struct uio *uio;
 spec_write(vp, uio, ioflag, cred)
        register struct vnode *vp;
        register struct uio *uio;
@@ -319,6 +325,7 @@ spec_write(vp, uio, ioflag, cred)
  * Device ioctl operation.
  */
 /* ARGSUSED */
  * Device ioctl operation.
  */
 /* ARGSUSED */
+int
 spec_ioctl(vp, com, data, fflag, cred, p)
        struct vnode *vp;
        int com;
 spec_ioctl(vp, com, data, fflag, cred, p)
        struct vnode *vp;
        int com;
@@ -351,6 +358,7 @@ spec_ioctl(vp, com, data, fflag, cred, p)
 }
 
 /* ARGSUSED */
 }
 
 /* ARGSUSED */
+int
 spec_select(vp, which, fflags, cred, p)
        struct vnode *vp;
        int which, fflags;
 spec_select(vp, which, fflags, cred, p)
        struct vnode *vp;
        int which, fflags;
@@ -373,6 +381,7 @@ spec_select(vp, which, fflags, cred, p)
 /*
  * Just call the device strategy routine
  */
 /*
  * Just call the device strategy routine
  */
+int
 spec_strategy(bp)
        register struct buf *bp;
 {
 spec_strategy(bp)
        register struct buf *bp;
 {
@@ -384,6 +393,7 @@ spec_strategy(bp)
 /*
  * This is a noop, simply returning what one has been given.
  */
 /*
  * This is a noop, simply returning what one has been given.
  */
+int
 spec_bmap(vp, bn, vpp, bnp)
        struct vnode *vp;
        daddr_t bn;
 spec_bmap(vp, bn, vpp, bnp)
        struct vnode *vp;
        daddr_t bn;
@@ -402,6 +412,7 @@ spec_bmap(vp, bn, vpp, bnp)
  * At the moment we do not do any locking.
  */
 /* ARGSUSED */
  * At the moment we do not do any locking.
  */
 /* ARGSUSED */
+int
 spec_lock(vp)
        struct vnode *vp;
 {
 spec_lock(vp)
        struct vnode *vp;
 {
@@ -410,6 +421,7 @@ spec_lock(vp)
 }
 
 /* ARGSUSED */
 }
 
 /* ARGSUSED */
+int
 spec_unlock(vp)
        struct vnode *vp;
 {
 spec_unlock(vp)
        struct vnode *vp;
 {
@@ -421,6 +433,7 @@ spec_unlock(vp)
  * Device close routine
  */
 /* ARGSUSED */
  * Device close routine
  */
 /* ARGSUSED */
+int
 spec_close(vp, flag, cred, p)
        register struct vnode *vp;
        int flag;
 spec_close(vp, flag, cred, p)
        register struct vnode *vp;
        int flag;
@@ -428,7 +441,7 @@ spec_close(vp, flag, cred, p)
        struct proc *p;
 {
        dev_t dev = vp->v_rdev;
        struct proc *p;
 {
        dev_t dev = vp->v_rdev;
-       int (*devclose) __P((dev_t, int, int, struct proc *));
+       int (*devclose) __P((int /*dev_t*/, int, int, struct proc *));
        int mode;
 
        switch (vp->v_type) {
        int mode;
 
        switch (vp->v_type) {
@@ -479,6 +492,7 @@ spec_close(vp, flag, cred, p)
 /*
  * Print out the contents of a special device vnode.
  */
 /*
  * Print out the contents of a special device vnode.
  */
+void
 spec_print(vp)
        struct vnode *vp;
 {
 spec_print(vp)
        struct vnode *vp;
 {
@@ -491,6 +505,7 @@ spec_print(vp)
  * Special device advisory byte-level locks.
  */
 /* ARGSUSED */
  * Special device advisory byte-level locks.
  */
 /* ARGSUSED */
+int
 spec_advlock(vp, id, op, fl, flags)
        struct vnode *vp;
        caddr_t id;
 spec_advlock(vp, id, op, fl, flags)
        struct vnode *vp;
        caddr_t id;
@@ -505,6 +520,7 @@ spec_advlock(vp, id, op, fl, flags)
 /*
  * Special device failed operation
  */
 /*
  * Special device failed operation
  */
+int
 spec_ebadf()
 {
 
 spec_ebadf()
 {
 
@@ -514,6 +530,7 @@ spec_ebadf()
 /*
  * Special device bad operation
  */
 /*
  * Special device bad operation
  */
+int
 spec_badop()
 {
 
 spec_badop()
 {