correct no-such-process error
[unix-history] / usr / src / sys / kern / vfs_cluster.c
index 372644a..30c295f 100644 (file)
@@ -3,7 +3,7 @@
  * 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.
  *
- *     @(#)vfs_cluster.c       6.6 (Berkeley) %G%
+ *     @(#)vfs_cluster.c       6.9 (Berkeley) %G%
  */
 
 #include "../machine/pte.h"
  */
 
 #include "../machine/pte.h"
@@ -35,7 +35,7 @@ bread(dev, blkno, size)
        bp = getblk(dev, blkno, size);
        if (bp->b_flags&B_DONE) {
                trace(TR_BREADHIT, pack(dev, size), blkno);
        bp = getblk(dev, blkno, size);
        if (bp->b_flags&B_DONE) {
                trace(TR_BREADHIT, pack(dev, size), blkno);
-               return(bp);
+               return (bp);
        }
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
        }
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
@@ -44,7 +44,7 @@ bread(dev, blkno, size)
        trace(TR_BREADMISS, pack(dev, size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
        biowait(bp);
        trace(TR_BREADMISS, pack(dev, size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
        biowait(bp);
-       return(bp);
+       return (bp);
 }
 
 /*
 }
 
 /*
@@ -202,7 +202,7 @@ brelse(bp)
        /*
         * Stick the buffer back on a free list.
         */
        /*
         * Stick the buffer back on a free list.
         */
-       s = spl6();
+       s = splbio();
        if (bp->b_bufsize <= 0) {
                /* block has no buffer ... put at front of unused buffer list */
                flist = &bfreelist[BQ_EMPTY];
        if (bp->b_bufsize <= 0) {
                /* block has no buffer ... put at front of unused buffer list */
                flist = &bfreelist[BQ_EMPTY];
@@ -273,6 +273,8 @@ getblk(dev, blkno, size)
        register struct buf *bp, *dp;
        int s;
 
        register struct buf *bp, *dp;
        int s;
 
+       if (size > MAXBSIZE)
+               panic("getblk: size too big");
        /*
         * To prevent overflow of 32-bit ints when converting block
         * numbers to byte offsets, blknos > 2^32 / DEV_BSIZE are set
        /*
         * To prevent overflow of 32-bit ints when converting block
         * numbers to byte offsets, blknos > 2^32 / DEV_BSIZE are set
@@ -294,7 +296,7 @@ loop:
                if (bp->b_blkno != blkno || bp->b_dev != dev ||
                    bp->b_flags&B_INVAL)
                        continue;
                if (bp->b_blkno != blkno || bp->b_dev != dev ||
                    bp->b_flags&B_INVAL)
                        continue;
-               s = spl6();
+               s = splbio();
                if (bp->b_flags&B_BUSY) {
                        bp->b_flags |= B_WANTED;
                        sleep((caddr_t)bp, PRIBIO+1);
                if (bp->b_flags&B_BUSY) {
                        bp->b_flags |= B_WANTED;
                        sleep((caddr_t)bp, PRIBIO+1);
@@ -306,7 +308,7 @@ loop:
                if (bp->b_bcount != size && brealloc(bp, size) == 0)
                        goto loop;
                bp->b_flags |= B_CACHE;
                if (bp->b_bcount != size && brealloc(bp, size) == 0)
                        goto loop;
                bp->b_flags |= B_CACHE;
-               return(bp);
+               return (bp);
        }
        if (major(dev) >= nblkdev)
                panic("blkdev");
        }
        if (major(dev) >= nblkdev)
                panic("blkdev");
@@ -319,7 +321,7 @@ loop:
        bp->b_error = 0;
        if (brealloc(bp, size) == 0)
                goto loop;
        bp->b_error = 0;
        if (brealloc(bp, size) == 0)
                goto loop;
-       return(bp);
+       return (bp);
 }
 
 /*
 }
 
 /*
@@ -332,6 +334,8 @@ geteblk(size)
 {
        register struct buf *bp, *flist;
 
 {
        register struct buf *bp, *flist;
 
+       if (size > MAXBSIZE)
+               panic("geteblk: size too big");
 loop:
        bp = getnewbuf();
        bp->b_flags |= B_INVAL;
 loop:
        bp = getnewbuf();
        bp->b_flags |= B_INVAL;
@@ -343,7 +347,7 @@ loop:
        bp->b_error = 0;
        if (brealloc(bp, size) == 0)
                goto loop;
        bp->b_error = 0;
        if (brealloc(bp, size) == 0)
                goto loop;
-       return(bp);
+       return (bp);
 }
 
 /*
 }
 
 /*
@@ -398,7 +402,7 @@ loop:
                if (ep->b_bcount == 0 || ep->b_blkno > last ||
                    ep->b_blkno + btodb(ep->b_bcount) <= start)
                        continue;
                if (ep->b_bcount == 0 || ep->b_blkno > last ||
                    ep->b_blkno + btodb(ep->b_bcount) <= start)
                        continue;
-               s = spl6();
+               s = splbio();
                if (ep->b_flags&B_BUSY) {
                        ep->b_flags |= B_WANTED;
                        sleep((caddr_t)ep, PRIBIO+1);
                if (ep->b_flags&B_BUSY) {
                        ep->b_flags |= B_WANTED;
                        sleep((caddr_t)ep, PRIBIO+1);
@@ -429,7 +433,7 @@ getnewbuf()
        int s;
 
 loop:
        int s;
 
 loop:
-       s = spl6();
+       s = splbio();
        for (dp = &bfreelist[BQ_AGE]; dp > bfreelist; dp--)
                if (dp->av_forw != dp)
                        break;
        for (dp = &bfreelist[BQ_AGE]; dp > bfreelist; dp--)
                if (dp->av_forw != dp)
                        break;
@@ -461,7 +465,7 @@ biowait(bp)
 {
        int s;
 
 {
        int s;
 
-       s = spl6();
+       s = splbio();
        while ((bp->b_flags&B_DONE)==0)
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
        while ((bp->b_flags&B_DONE)==0)
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
@@ -519,7 +523,7 @@ loop:
                if (ep->b_bcount == 0 || ep->b_blkno > last ||
                    ep->b_blkno + btodb(ep->b_bcount) <= start)
                        continue;
                if (ep->b_bcount == 0 || ep->b_blkno > last ||
                    ep->b_blkno + btodb(ep->b_bcount) <= start)
                        continue;
-               s = spl6();
+               s = splbio();
                if (ep->b_flags&B_BUSY) {
                        ep->b_flags |= B_WANTED;
                        sleep((caddr_t)ep, PRIBIO+1);
                if (ep->b_flags&B_BUSY) {
                        ep->b_flags |= B_WANTED;
                        sleep((caddr_t)ep, PRIBIO+1);
@@ -550,7 +554,7 @@ bflush(dev)
        int s;
 
 loop:
        int s;
 
 loop:
-       s = spl6();
+       s = splbio();
        for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++)
        for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
                if ((bp->b_flags & B_DELWRI) == 0)
        for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++)
        for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
                if ((bp->b_flags & B_DELWRI) == 0)
@@ -568,9 +572,7 @@ loop:
 
 /*
  * Pick up the device's error number and pass it to the user;
 
 /*
  * Pick up the device's error number and pass it to the user;
- * if there is an error but the number is 0 set a generalized
- * code.  Actually the latter is always true because devices
- * don't yet return specific errors.
+ * if there is an error but the number is 0 set a generalized code.
  */
 geterror(bp)
        register struct buf *bp;
  */
 geterror(bp)
        register struct buf *bp;