add some missing returns, correct args to ipcaccess, general cleanup
[unix-history] / usr / src / sys / kern / kern_physio.c
index 79e2e03..b12dde4 100644 (file)
@@ -3,12 +3,11 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_physio.c       7.5 (Berkeley) %G%
+ *     @(#)kern_physio.c       7.14 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
  */
 
 #include "param.h"
 #include "systm.h"
-#include "dir.h"
 #include "user.h"
 #include "buf.h"
 #include "conf.h"
 #include "user.h"
 #include "buf.h"
 #include "conf.h"
@@ -17,7 +16,8 @@
 #include "vm.h"
 #include "trace.h"
 #include "map.h"
 #include "vm.h"
 #include "trace.h"
 #include "map.h"
-#include "uio.h"
+#include "vnode.h"
+#include "specdev.h"
 
 #include "machine/pte.h"
 #ifdef SECSIZE
 
 #include "machine/pte.h"
 #ifdef SECSIZE
@@ -50,12 +50,12 @@ struct      buf *swbuf;
  * biodone() will link the header to a list of cleaned
  * pages to be processed by the pageout daemon.
  */
  * biodone() will link the header to a list of cleaned
  * pages to be processed by the pageout daemon.
  */
-swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
+swap(p, dblkno, addr, nbytes, rdflg, flag, vp, pfcent)
        struct proc *p;
        swblk_t dblkno;
        caddr_t addr;
        int nbytes, rdflg, flag;
        struct proc *p;
        swblk_t dblkno;
        caddr_t addr;
        int nbytes, rdflg, flag;
-       dev_t dev;
+       struct vnode *vp;
        u_int pfcent;
 {
        register struct buf *bp;
        u_int pfcent;
 {
        register struct buf *bp;
@@ -92,21 +92,33 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
        } else
                bp->b_un.b_addr = addr;
        while (nbytes > 0) {
        } else
                bp->b_un.b_addr = addr;
        while (nbytes > 0) {
+               bp->b_blkno = dblkno;
+               if (bp->b_vp)
+                       brelvp(bp);
+               VHOLD(vp);
+               bp->b_vp = vp;
+               bp->b_dev = vp->v_rdev;
                bp->b_bcount = nbytes;
                bp->b_bcount = nbytes;
+               if ((bp->b_flags & B_READ) == 0)
+                       vp->v_numoutput++;
                minphys(bp);
                c = bp->b_bcount;
                minphys(bp);
                c = bp->b_bcount;
-               bp->b_blkno = dblkno;
-               bp->b_dev = dev;
 #ifdef TRACE
 #ifdef TRACE
-               trace(TR_SWAPIO, dev, bp->b_blkno);
+               trace(TR_SWAPIO, vp, bp->b_blkno);
+#endif
+#if defined(hp300)
+               vmapbuf(bp);
 #endif
 #endif
-               (*bdevsw[major(dev)].d_strategy)(bp);
+               VOP_STRATEGY(bp);
                /* pageout daemon doesn't wait for pushed pages */
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                                panic("big push");
                        return (0);
                }
                /* pageout daemon doesn't wait for pushed pages */
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                                panic("big push");
                        return (0);
                }
+#if defined(hp300)
+               vunmapbuf(bp);
+#endif
                bp->b_un.b_addr += c;
                bp->b_flags &= ~B_DONE;
                if (bp->b_flags & B_ERROR) {
                bp->b_un.b_addr += c;
                bp->b_flags &= ~B_DONE;
                if (bp->b_flags & B_ERROR) {
@@ -145,6 +157,9 @@ swdone(bp)
        bclnlist = bp;
        if (bswlist.b_flags & B_WANTED)
                wakeup((caddr_t)&proc[2]);
        bclnlist = bp;
        if (bswlist.b_flags & B_WANTED)
                wakeup((caddr_t)&proc[2]);
+#if defined(hp300)
+       vunmapbuf(bp);
+#endif
        splx(s);
 }
 
        splx(s);
 }
 
@@ -194,7 +209,7 @@ physio(strat, bp, dev, rw, mincnt, uio)
        struct uio *uio;
 {
        register struct iovec *iov;
        struct uio *uio;
 {
        register struct iovec *iov;
-       register int c;
+       register int requested, done;
        char *a;
        int s, allocbuf = 0, error = 0;
        struct buf *getswbuf();
        char *a;
        int s, allocbuf = 0, error = 0;
        struct buf *getswbuf();
@@ -268,12 +283,14 @@ physio(strat, bp, dev, rw, mincnt, uio)
                }
                bp->b_flags &= ~(B_BUSY|B_WANTED|B_PHYS);
                error = geterror(bp);
                }
                bp->b_flags &= ~(B_BUSY|B_WANTED|B_PHYS);
                error = geterror(bp);
-               /* temp kludge for tape drives */
                if (bp->b_resid || error)
                        return (error);
                uio->uio_iov++;
                uio->uio_iovcnt--;
        }
                if (bp->b_resid || error)
                        return (error);
                uio->uio_iov++;
                uio->uio_iovcnt--;
        }
+#if defined(hp300)
+       DCIU();
+#endif
        if (allocbuf)
                freeswbuf(bp);
        return (error);
        if (allocbuf)
                freeswbuf(bp);
        return (error);
@@ -315,6 +332,8 @@ freeswbuf(bp)
        s = splbio();
        bp->av_forw = bswlist.av_forw;
        bswlist.av_forw = bp;
        s = splbio();
        bp->av_forw = bswlist.av_forw;
        bswlist.av_forw = bp;
+       if (bp->b_vp)
+               brelvp(bp);
        if (bswlist.b_flags & B_WANTED) {
                bswlist.b_flags &= ~B_WANTED;
                wakeup((caddr_t)&bswlist);
        if (bswlist.b_flags & B_WANTED) {
                bswlist.b_flags &= ~B_WANTED;
                wakeup((caddr_t)&bswlist);