generalize the buffer pool so that NFS can become a client
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sun, 27 Aug 1989 05:19:06 +0000 (21:19 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sun, 27 Aug 1989 05:19:06 +0000 (21:19 -0800)
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 7.13
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 7.13
SCCS-vsn: sys/ufs/ffs/ffs_vfsops.c 7.19
SCCS-vsn: sys/ufs/ffs/ufs_vfsops.c 7.19
SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 7.19
SCCS-vsn: sys/ufs/ufs/ufs_vfsops.c 7.19
SCCS-vsn: sys/ufs/ffs/ffs_alloc.c 7.11
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 7.11
SCCS-vsn: sys/kern/vfs_bio.c 7.10
SCCS-vsn: sys/kern/vfs_cluster.c 7.10
SCCS-vsn: sys/ufs/ffs/ffs_balloc.c 7.5
SCCS-vsn: sys/ufs/lfs/lfs_balloc.c 7.5
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 7.12
SCCS-vsn: sys/ufs/ffs/ufs_inode.c 7.12
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.12
SCCS-vsn: sys/ufs/ufs/ufs_inode.c 7.12
SCCS-vsn: sys/miscfs/specfs/spec_vnops.c 7.5
SCCS-vsn: sys/sys/ucred.h 7.2
SCCS-vsn: sys/sys/buf.h 7.8

19 files changed:
usr/src/sys/kern/vfs_bio.c
usr/src/sys/kern/vfs_cluster.c
usr/src/sys/miscfs/specfs/spec_vnops.c
usr/src/sys/sys/buf.h
usr/src/sys/sys/ucred.h
usr/src/sys/ufs/ffs/ffs_alloc.c
usr/src/sys/ufs/ffs/ffs_balloc.c
usr/src/sys/ufs/ffs/ffs_inode.c
usr/src/sys/ufs/ffs/ffs_vfsops.c
usr/src/sys/ufs/ffs/ufs_inode.c
usr/src/sys/ufs/ffs/ufs_lookup.c
usr/src/sys/ufs/ffs/ufs_vfsops.c
usr/src/sys/ufs/lfs/lfs_alloc.c
usr/src/sys/ufs/lfs/lfs_balloc.c
usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/lfs/lfs_vfsops.c
usr/src/sys/ufs/ufs/ufs_inode.c
usr/src/sys/ufs/ufs/ufs_lookup.c
usr/src/sys/ufs/ufs/ufs_vfsops.c

index 9801672..3acf1ff 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)vfs_bio.c   7.9 (Berkeley) %G%
+ *     @(#)vfs_bio.c   7.10 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "buf.h"
 #include "vnode.h"
 #include "trace.h"
 #include "buf.h"
 #include "vnode.h"
 #include "trace.h"
+#include "ucred.h"
 
 /*
  * Read in (if necessary) the block and return a buffer pointer.
  */
 
 /*
  * Read in (if necessary) the block and return a buffer pointer.
  */
-bread(vp, blkno, size, bpp)
+bread(vp, blkno, size, cred, bpp)
        struct vnode *vp;
        daddr_t blkno;
        int size;
        struct vnode *vp;
        daddr_t blkno;
        int size;
+       struct ucred *cred;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
@@ -51,6 +53,10 @@ bread(vp, blkno, size, bpp)
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
                panic("bread");
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
                panic("bread");
+       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+               crhold(cred);
+               bp->b_rcred = cred;
+       }
        VOP_STRATEGY(bp);
        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
        VOP_STRATEGY(bp);
        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
@@ -61,13 +67,14 @@ bread(vp, blkno, size, bpp)
  * Read in the block, like bread, but also start I/O on the
  * read-ahead block (which is not allocated to the caller)
  */
  * Read in the block, like bread, but also start I/O on the
  * read-ahead block (which is not allocated to the caller)
  */
-breada(vp, blkno, size, rablkno, rabsize, bpp)
+breada(vp, blkno, size, rablkno, rabsize, cred, bpp)
        struct vnode *vp;
        daddr_t blkno; int size;
 #ifdef SECSIZE
        long secsize;
 #endif SECSIZE
        daddr_t rablkno; int rabsize;
        struct vnode *vp;
        daddr_t blkno; int size;
 #ifdef SECSIZE
        long secsize;
 #endif SECSIZE
        daddr_t rablkno; int rabsize;
+       struct ucred *cred;
        struct buf **bpp;
 {
        register struct buf *bp, *rabp;
        struct buf **bpp;
 {
        register struct buf *bp, *rabp;
@@ -85,6 +92,10 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
                        bp->b_flags |= B_READ;
                        if (bp->b_bcount > bp->b_bufsize)
                                panic("breada");
                        bp->b_flags |= B_READ;
                        if (bp->b_bcount > bp->b_bufsize)
                                panic("breada");
+                       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+                               crhold(cred);
+                               bp->b_rcred = cred;
+                       }
                        VOP_STRATEGY(bp);
                        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size),
                            blkno);
                        VOP_STRATEGY(bp);
                        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size),
                            blkno);
@@ -109,6 +120,10 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
                        rabp->b_flags |= B_READ|B_ASYNC;
                        if (rabp->b_bcount > rabp->b_bufsize)
                                panic("breadrabp");
                        rabp->b_flags |= B_READ|B_ASYNC;
                        if (rabp->b_bcount > rabp->b_bufsize)
                                panic("breadrabp");
+                       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+                               crhold(cred);
+                               bp->b_rcred = cred;
+                       }
                        VOP_STRATEGY(rabp);
                        trace(TR_BREADMISSRA,
                            pack(vp->v_mount->m_fsid[0], rabsize), rablock);
                        VOP_STRATEGY(rabp);
                        trace(TR_BREADMISSRA,
                            pack(vp->v_mount->m_fsid[0], rabsize), rablock);
@@ -125,7 +140,7 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
 #ifdef SECSIZE
                return (bread(dev, blkno, size, secsize));
 #else SECSIZE
 #ifdef SECSIZE
                return (bread(dev, blkno, size, secsize));
 #else SECSIZE
-               return (bread(vp, blkno, size, bpp));
+               return (bread(vp, blkno, size, cred, bpp));
        return (biowait(bp));
 }
 
        return (biowait(bp));
 }
 
@@ -281,10 +296,11 @@ incore(vp, blkno)
        return (0);
 }
 
        return (0);
 }
 
-baddr(vp, blkno, size, bpp)
+baddr(vp, blkno, size, cred, bpp)
        struct vnode *vp;
        daddr_t blkno;
        int size;
        struct vnode *vp;
        daddr_t blkno;
        int size;
+       struct ucred *cred;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
@@ -292,7 +308,7 @@ baddr(vp, blkno, size, bpp)
 {
 
        if (incore(vp, blkno))
 {
 
        if (incore(vp, blkno))
-               return (bread(vp, blkno, size, bpp));
+               return (bread(vp, blkno, size, cred, bpp));
        *bpp = 0;
 #endif SECSIZE
        return (0);
        *bpp = 0;
 #endif SECSIZE
        return (0);
@@ -515,6 +531,7 @@ struct buf *
 getnewbuf()
 {
        register struct buf *bp, *dp;
 getnewbuf()
 {
        register struct buf *bp, *dp;
+       register struct ucred *cred;
        int s;
 
 loop:
        int s;
 
 loop:
@@ -538,6 +555,16 @@ loop:
        trace(TR_BRELSE,
            pack(bp->b_vp->v_mount->m_fsid[0], bp->b_bufsize), bp->b_blkno);
        brelvp(bp);
        trace(TR_BRELSE,
            pack(bp->b_vp->v_mount->m_fsid[0], bp->b_bufsize), bp->b_blkno);
        brelvp(bp);
+       if (bp->b_rcred != NOCRED) {
+               cred = bp->b_rcred;
+               bp->b_rcred = NOCRED;
+               crfree(cred);
+       }
+       if (bp->b_wcred != NOCRED) {
+               cred = bp->b_wcred;
+               bp->b_wcred = NOCRED;
+               crfree(cred);
+       }
        bp->b_flags = B_BUSY;
        return (bp);
 }
        bp->b_flags = B_BUSY;
        return (bp);
 }
@@ -552,7 +579,7 @@ biowait(bp)
        int s;
 
        s = splbio();
        int s;
 
        s = splbio();
-       while ((bp->b_flags&B_DONE)==0)
+       while ((bp->b_flags & B_DONE) == 0)
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
        /*
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
        /*
@@ -579,6 +606,8 @@ biodone(bp)
        if (bp->b_flags & B_DONE)
                panic("dup biodone");
        bp->b_flags |= B_DONE;
        if (bp->b_flags & B_DONE)
                panic("dup biodone");
        bp->b_flags |= B_DONE;
+       if ((bp->b_flags & B_READ) == 0)
+               bp->b_dirtyoff = bp->b_dirtyend = 0;
        if (bp->b_flags & B_CALL) {
                bp->b_flags &= ~B_CALL;
                (*bp->b_iodone)(bp);
        if (bp->b_flags & B_CALL) {
                bp->b_flags &= ~B_CALL;
                (*bp->b_iodone)(bp);
@@ -655,10 +684,10 @@ loop:
 
 /*
  * Make sure all write-behind blocks associated
 
 /*
  * Make sure all write-behind blocks associated
- * with vp are flushed out (from sync).
+ * with mount point are flushed out (from sync).
  */
  */
-bflush(dev)
-       dev_t dev;
+bflush(mountp)
+       struct mount *mountp;
 {
        register struct buf *bp;
        register struct buf *flist;
 {
        register struct buf *bp;
        register struct buf *flist;
@@ -666,76 +695,46 @@ bflush(dev)
 
 loop:
        s = splbio();
 
 loop:
        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)
-                       continue;
-               if (dev == NODEV || dev == bp->b_dev) {
-                       notavail(bp);
-                       (void) bawrite(bp);
-                       splx(s);
-                       goto loop;
-               }
-       }
-       splx(s);
-}
-
-#ifdef unused
-/*
- * Invalidate blocks associated with vp which are on the freelist.
- * Make sure all write-behind blocks associated with vp are flushed out.
- */
-binvalfree(vp)
-       struct vnode *vp;
-{
-       register struct buf *bp;
-       register struct buf *flist;
-       int s;
-
-loop:
-       s = splbio();
-       for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++)
-       for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
-               if (vp == (struct vnode *) 0 || vp == bp->b_vp) {
-                       if (bp->b_flags & B_DELWRI) {
+       for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++) {
+               for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
+                       if ((bp->b_flags & B_BUSY))
+                               continue;
+                       if ((bp->b_flags & B_DELWRI) == 0)
+                               continue;
+                       if (bp->b_vp && bp->b_vp->v_mount == mountp) {
                                notavail(bp);
                                notavail(bp);
-                               (void) splx(s);
                                (void) bawrite(bp);
                                (void) bawrite(bp);
-                       } else {
-                               bp->b_flags |= B_INVAL;
-                               brelvp(bp);
-                               (void) splx(s);
+                               splx(s);
+                               goto loop;
                        }
                        }
-                       goto loop;
                }
        }
                }
        }
-       (void) splx(s);
+       splx(s);
 }
 }
-#endif /* unused */
 
 /*
  * Invalidate in core blocks belonging to closed or umounted filesystem
  *
  * We walk through the buffer pool and invalidate any buffers for the
 
 /*
  * Invalidate in core blocks belonging to closed or umounted filesystem
  *
  * We walk through the buffer pool and invalidate any buffers for the
- * indicated device. Normally this routine is preceeded by a bflush
+ * indicated mount point. Normally this routine is preceeded by a bflush
  * call, so that on a quiescent filesystem there will be no dirty
  * buffers when we are done. We return the count of dirty buffers when
  * we are finished.
  */
  * call, so that on a quiescent filesystem there will be no dirty
  * buffers when we are done. We return the count of dirty buffers when
  * we are finished.
  */
-binval(dev)
-       dev_t dev;
+binval(mountp)
+       struct mount *mountp;
 {
        register struct buf *bp;
        register struct bufhd *hp;
        int s, dirty = 0;
 #define dp ((struct buf *)hp)
 
 {
        register struct buf *bp;
        register struct bufhd *hp;
        int s, dirty = 0;
 #define dp ((struct buf *)hp)
 
+loop:
+       s = splbio();
        for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++) {
                for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) {
        for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++) {
                for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) {
-                       if (bp->b_dev != dev || (bp->b_flags & B_INVAL))
+                       if (bp->b_vp == NULL || bp->b_vp->v_mount != mountp)
                                continue;
                                continue;
-               loop:
-                       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);
index c2c92cc..362ad50 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)vfs_cluster.c       7.9 (Berkeley) %G%
+ *     @(#)vfs_cluster.c       7.10 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "buf.h"
 #include "vnode.h"
 #include "trace.h"
 #include "buf.h"
 #include "vnode.h"
 #include "trace.h"
+#include "ucred.h"
 
 /*
  * Read in (if necessary) the block and return a buffer pointer.
  */
 
 /*
  * Read in (if necessary) the block and return a buffer pointer.
  */
-bread(vp, blkno, size, bpp)
+bread(vp, blkno, size, cred, bpp)
        struct vnode *vp;
        daddr_t blkno;
        int size;
        struct vnode *vp;
        daddr_t blkno;
        int size;
+       struct ucred *cred;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
@@ -51,6 +53,10 @@ bread(vp, blkno, size, bpp)
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
                panic("bread");
        bp->b_flags |= B_READ;
        if (bp->b_bcount > bp->b_bufsize)
                panic("bread");
+       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+               crhold(cred);
+               bp->b_rcred = cred;
+       }
        VOP_STRATEGY(bp);
        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
        VOP_STRATEGY(bp);
        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size), blkno);
        u.u_ru.ru_inblock++;            /* pay for read */
@@ -61,13 +67,14 @@ bread(vp, blkno, size, bpp)
  * Read in the block, like bread, but also start I/O on the
  * read-ahead block (which is not allocated to the caller)
  */
  * Read in the block, like bread, but also start I/O on the
  * read-ahead block (which is not allocated to the caller)
  */
-breada(vp, blkno, size, rablkno, rabsize, bpp)
+breada(vp, blkno, size, rablkno, rabsize, cred, bpp)
        struct vnode *vp;
        daddr_t blkno; int size;
 #ifdef SECSIZE
        long secsize;
 #endif SECSIZE
        daddr_t rablkno; int rabsize;
        struct vnode *vp;
        daddr_t blkno; int size;
 #ifdef SECSIZE
        long secsize;
 #endif SECSIZE
        daddr_t rablkno; int rabsize;
+       struct ucred *cred;
        struct buf **bpp;
 {
        register struct buf *bp, *rabp;
        struct buf **bpp;
 {
        register struct buf *bp, *rabp;
@@ -85,6 +92,10 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
                        bp->b_flags |= B_READ;
                        if (bp->b_bcount > bp->b_bufsize)
                                panic("breada");
                        bp->b_flags |= B_READ;
                        if (bp->b_bcount > bp->b_bufsize)
                                panic("breada");
+                       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+                               crhold(cred);
+                               bp->b_rcred = cred;
+                       }
                        VOP_STRATEGY(bp);
                        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size),
                            blkno);
                        VOP_STRATEGY(bp);
                        trace(TR_BREADMISS, pack(vp->v_mount->m_fsid[0], size),
                            blkno);
@@ -109,6 +120,10 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
                        rabp->b_flags |= B_READ|B_ASYNC;
                        if (rabp->b_bcount > rabp->b_bufsize)
                                panic("breadrabp");
                        rabp->b_flags |= B_READ|B_ASYNC;
                        if (rabp->b_bcount > rabp->b_bufsize)
                                panic("breadrabp");
+                       if (bp->b_rcred == NOCRED && cred != NOCRED) {
+                               crhold(cred);
+                               bp->b_rcred = cred;
+                       }
                        VOP_STRATEGY(rabp);
                        trace(TR_BREADMISSRA,
                            pack(vp->v_mount->m_fsid[0], rabsize), rablock);
                        VOP_STRATEGY(rabp);
                        trace(TR_BREADMISSRA,
                            pack(vp->v_mount->m_fsid[0], rabsize), rablock);
@@ -125,7 +140,7 @@ breada(vp, blkno, size, rablkno, rabsize, bpp)
 #ifdef SECSIZE
                return (bread(dev, blkno, size, secsize));
 #else SECSIZE
 #ifdef SECSIZE
                return (bread(dev, blkno, size, secsize));
 #else SECSIZE
-               return (bread(vp, blkno, size, bpp));
+               return (bread(vp, blkno, size, cred, bpp));
        return (biowait(bp));
 }
 
        return (biowait(bp));
 }
 
@@ -281,10 +296,11 @@ incore(vp, blkno)
        return (0);
 }
 
        return (0);
 }
 
-baddr(vp, blkno, size, bpp)
+baddr(vp, blkno, size, cred, bpp)
        struct vnode *vp;
        daddr_t blkno;
        int size;
        struct vnode *vp;
        daddr_t blkno;
        int size;
+       struct ucred *cred;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
        struct buf **bpp;
 #ifdef SECSIZE
        long secsize;
@@ -292,7 +308,7 @@ baddr(vp, blkno, size, bpp)
 {
 
        if (incore(vp, blkno))
 {
 
        if (incore(vp, blkno))
-               return (bread(vp, blkno, size, bpp));
+               return (bread(vp, blkno, size, cred, bpp));
        *bpp = 0;
 #endif SECSIZE
        return (0);
        *bpp = 0;
 #endif SECSIZE
        return (0);
@@ -515,6 +531,7 @@ struct buf *
 getnewbuf()
 {
        register struct buf *bp, *dp;
 getnewbuf()
 {
        register struct buf *bp, *dp;
+       register struct ucred *cred;
        int s;
 
 loop:
        int s;
 
 loop:
@@ -538,6 +555,16 @@ loop:
        trace(TR_BRELSE,
            pack(bp->b_vp->v_mount->m_fsid[0], bp->b_bufsize), bp->b_blkno);
        brelvp(bp);
        trace(TR_BRELSE,
            pack(bp->b_vp->v_mount->m_fsid[0], bp->b_bufsize), bp->b_blkno);
        brelvp(bp);
+       if (bp->b_rcred != NOCRED) {
+               cred = bp->b_rcred;
+               bp->b_rcred = NOCRED;
+               crfree(cred);
+       }
+       if (bp->b_wcred != NOCRED) {
+               cred = bp->b_wcred;
+               bp->b_wcred = NOCRED;
+               crfree(cred);
+       }
        bp->b_flags = B_BUSY;
        return (bp);
 }
        bp->b_flags = B_BUSY;
        return (bp);
 }
@@ -552,7 +579,7 @@ biowait(bp)
        int s;
 
        s = splbio();
        int s;
 
        s = splbio();
-       while ((bp->b_flags&B_DONE)==0)
+       while ((bp->b_flags & B_DONE) == 0)
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
        /*
                sleep((caddr_t)bp, PRIBIO);
        splx(s);
        /*
@@ -579,6 +606,8 @@ biodone(bp)
        if (bp->b_flags & B_DONE)
                panic("dup biodone");
        bp->b_flags |= B_DONE;
        if (bp->b_flags & B_DONE)
                panic("dup biodone");
        bp->b_flags |= B_DONE;
+       if ((bp->b_flags & B_READ) == 0)
+               bp->b_dirtyoff = bp->b_dirtyend = 0;
        if (bp->b_flags & B_CALL) {
                bp->b_flags &= ~B_CALL;
                (*bp->b_iodone)(bp);
        if (bp->b_flags & B_CALL) {
                bp->b_flags &= ~B_CALL;
                (*bp->b_iodone)(bp);
@@ -655,10 +684,10 @@ loop:
 
 /*
  * Make sure all write-behind blocks associated
 
 /*
  * Make sure all write-behind blocks associated
- * with vp are flushed out (from sync).
+ * with mount point are flushed out (from sync).
  */
  */
-bflush(dev)
-       dev_t dev;
+bflush(mountp)
+       struct mount *mountp;
 {
        register struct buf *bp;
        register struct buf *flist;
 {
        register struct buf *bp;
        register struct buf *flist;
@@ -666,76 +695,46 @@ bflush(dev)
 
 loop:
        s = splbio();
 
 loop:
        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)
-                       continue;
-               if (dev == NODEV || dev == bp->b_dev) {
-                       notavail(bp);
-                       (void) bawrite(bp);
-                       splx(s);
-                       goto loop;
-               }
-       }
-       splx(s);
-}
-
-#ifdef unused
-/*
- * Invalidate blocks associated with vp which are on the freelist.
- * Make sure all write-behind blocks associated with vp are flushed out.
- */
-binvalfree(vp)
-       struct vnode *vp;
-{
-       register struct buf *bp;
-       register struct buf *flist;
-       int s;
-
-loop:
-       s = splbio();
-       for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++)
-       for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
-               if (vp == (struct vnode *) 0 || vp == bp->b_vp) {
-                       if (bp->b_flags & B_DELWRI) {
+       for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++) {
+               for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
+                       if ((bp->b_flags & B_BUSY))
+                               continue;
+                       if ((bp->b_flags & B_DELWRI) == 0)
+                               continue;
+                       if (bp->b_vp && bp->b_vp->v_mount == mountp) {
                                notavail(bp);
                                notavail(bp);
-                               (void) splx(s);
                                (void) bawrite(bp);
                                (void) bawrite(bp);
-                       } else {
-                               bp->b_flags |= B_INVAL;
-                               brelvp(bp);
-                               (void) splx(s);
+                               splx(s);
+                               goto loop;
                        }
                        }
-                       goto loop;
                }
        }
                }
        }
-       (void) splx(s);
+       splx(s);
 }
 }
-#endif /* unused */
 
 /*
  * Invalidate in core blocks belonging to closed or umounted filesystem
  *
  * We walk through the buffer pool and invalidate any buffers for the
 
 /*
  * Invalidate in core blocks belonging to closed or umounted filesystem
  *
  * We walk through the buffer pool and invalidate any buffers for the
- * indicated device. Normally this routine is preceeded by a bflush
+ * indicated mount point. Normally this routine is preceeded by a bflush
  * call, so that on a quiescent filesystem there will be no dirty
  * buffers when we are done. We return the count of dirty buffers when
  * we are finished.
  */
  * call, so that on a quiescent filesystem there will be no dirty
  * buffers when we are done. We return the count of dirty buffers when
  * we are finished.
  */
-binval(dev)
-       dev_t dev;
+binval(mountp)
+       struct mount *mountp;
 {
        register struct buf *bp;
        register struct bufhd *hp;
        int s, dirty = 0;
 #define dp ((struct buf *)hp)
 
 {
        register struct buf *bp;
        register struct bufhd *hp;
        int s, dirty = 0;
 #define dp ((struct buf *)hp)
 
+loop:
+       s = splbio();
        for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++) {
                for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) {
        for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++) {
                for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) {
-                       if (bp->b_dev != dev || (bp->b_flags & B_INVAL))
+                       if (bp->b_vp == NULL || bp->b_vp->v_mount != mountp)
                                continue;
                                continue;
-               loop:
-                       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);
index 8865d6b..6e30986 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)spec_vnops.c        7.4 (Berkeley) %G%
+ *     @(#)spec_vnops.c        7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -273,8 +273,8 @@ blk_close(vp, flag, cred)
                 * we must invalidate any in core blocks, so that
                 * we can, for instance, change floppy disks.
                 */
                 * we must invalidate any in core blocks, so that
                 * we can, for instance, change floppy disks.
                 */
-               bflush(dev);
-               if (binval(dev))
+               bflush(vp->v_mount);
+               if (binval(vp->v_mount))
                        return (0);
                /*
                 * We don't want to really close the device if it is still
                        return (0);
                /*
                 * We don't want to really close the device if it is still
index ce33372..f102836 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)buf.h       7.7 (Berkeley) %G%
+ *     @(#)buf.h       7.8 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -76,8 +76,12 @@ struct buf
 #define        b_errcnt b_resid                /* while i/o in progress: # retries */
        struct  proc *b_proc;           /* proc doing physical or swap I/O */
        int     (*b_iodone)();          /* function called by iodone */
 #define        b_errcnt b_resid                /* while i/o in progress: # retries */
        struct  proc *b_proc;           /* proc doing physical or swap I/O */
        int     (*b_iodone)();          /* function called by iodone */
-       struct vnode *b_vp;             /* Vnode for dev */
+       struct  vnode *b_vp;            /* vnode for dev */
        int     b_pfcent;               /* center page when swapping cluster */
        int     b_pfcent;               /* center page when swapping cluster */
+       struct  ucred *b_rcred;         /* ref to read credentials */
+       struct  ucred *b_wcred;         /* ref to write credendtials */
+       int     b_dirtyoff;             /* offset in buffer of dirty region */
+       int     b_dirtyend;             /* offset of end of dirty region */
 };
 
 #define        BQUEUES         4               /* number of free buffer queues */
 };
 
 #define        BQUEUES         4               /* number of free buffer queues */
index b81a2cb..5af1c19 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ucred.h     7.1 (Berkeley) %G%
+ *     @(#)ucred.h     7.2 (Berkeley) %G%
  */
 
 #ifndef _UCRED_
  */
 
 #ifndef _UCRED_
@@ -35,6 +35,7 @@ struct ucred {
        uid_t   cr_ruid;                /* real uid */
 };
 #define cr_gid cr_groups[0]
        uid_t   cr_ruid;                /* real uid */
 };
 #define cr_gid cr_groups[0]
+#define NOCRED ((struct ucred *)-1)
 
 #ifdef KERNEL
 #define        crhold(cr)      (cr)->cr_ref++
 
 #ifdef KERNEL
 #define        crhold(cr)      (cr)->cr_ref++
index 3f558e2..f4bbf2a 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ffs_alloc.c 7.10 (Berkeley) %G%
+ *     @(#)ffs_alloc.c 7.11 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -160,7 +160,7 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
-                               osize, &bp);
+                               osize, NOCRED, &bp);
                        if (error) {
                                brelse(bp);
                                return (error);
                        if (error) {
                                brelse(bp);
                                return (error);
@@ -225,7 +225,8 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(ip->i_devvp, fsbtodb(fs, bprev), osize, &obp);
+               error = bread(ip->i_devvp, fsbtodb(fs, bprev), 
+                       osize, NOCRED, &obp);
                if (error) {
                        brelse(obp);
                        return (error);
                if (error) {
                        brelse(obp);
                        return (error);
@@ -541,7 +542,7 @@ fragextend(ip, cg, bprev, osize, nsize)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -609,7 +610,7 @@ alloccg(ip, cg, bpref, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -815,7 +816,7 @@ ialloccg(ip, cg, ipref, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -907,7 +908,7 @@ blkfree(ip, bno, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;
@@ -1007,7 +1008,7 @@ ifree(ip, ino, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;
index e341f37..d765537 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ffs_balloc.c        7.4 (Berkeley) %G%
+ *     @(#)ffs_balloc.c        7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -103,7 +103,7 @@ bmap(ip, bn, bnp, rablockp, rasizep)
         */
        for (; j <= NIADDR; j++) {
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
         */
        for (; j <= NIADDR; j++) {
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
-                   (int)fs->fs_bsize, &bp)) {
+                   (int)fs->fs_bsize, NOCRED, &bp)) {
                        brelse(bp);
                        return (error);
                }
                        brelse(bp);
                        return (error);
                }
@@ -281,7 +281,7 @@ gotit:
                    fs->fs_dbsize);
 #else SECSIZE
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
                    fs->fs_dbsize);
 #else SECSIZE
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
-                   (int)fs->fs_bsize, &bp)) {
+                   (int)fs->fs_bsize, NOCRED, &bp)) {
                        brelse(bp);
                        return (error);
                }
                        brelse(bp);
                        return (error);
                }
index df6de48..14c5f75 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ffs_inode.c 7.11 (Berkeley) %G%
+ *     @(#)ffs_inode.c 7.12 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -158,7 +158,7 @@ loop:
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
-           (int)fs->fs_bsize, &bp)) {
+           (int)fs->fs_bsize, NOCRED, &bp)) {
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
@@ -520,7 +520,7 @@ iupdat(ip, ta, tm, waitfor)
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
-               (int)fs->fs_bsize, &bp);
+               (int)fs->fs_bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
@@ -607,7 +607,7 @@ itrunc(oip, length)
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
-               error = bread(oip->i_devvp, bn, size, &bp);
+               error = bread(oip->i_devvp, bn, size, NOCRED, &bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
@@ -768,7 +768,8 @@ indirtrunc(ip, bn, lastbn, level, countp)
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize, &bp);
+       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize,
+               NOCRED, &bp);
        if (error) {
                brelse(bp);
                *countp = 0;
        if (error) {
                brelse(bp);
                *countp = 0;
index 80b9321..94e576c 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ffs_vfsops.c        7.18 (Berkeley) %G%
+ *     @(#)ffs_vfsops.c        7.19 (Berkeley) %G%
  */
 
  */
 
-
 #include "param.h"
 #include "systm.h"
 #include "time.h"
 #include "param.h"
 #include "systm.h"
 #include "time.h"
@@ -26,6 +25,7 @@
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
+#include "ucred.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
@@ -178,14 +178,13 @@ mountfs(devvp, mp)
                return (error);
        }
        needclose = 1;
                return (error);
        }
        needclose = 1;
-       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD,
-           (struct ucred *)0) != 0)
+       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED) != 0)
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
-       if (error = bread(devvp, SBLOCK, SBSIZE, &bp)) {
+       if (error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) {
                ump->um_fs = NULL;
                goto out;
        }
                ump->um_fs = NULL;
                goto out;
        }
@@ -246,7 +245,8 @@ mountfs(devvp, mp)
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, &bp);
+               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+                       NOCRED, &bp);
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
@@ -266,6 +266,7 @@ mountfs(devvp, mp)
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
+       devvp->v_mount = mp;
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
@@ -276,8 +277,7 @@ mountfs(devvp, mp)
        return (0);
 out:
        if (needclose)
        return (0);
 out:
        if (needclose)
-               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE,
-                       (struct ucred *)0);
+               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED);
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
@@ -435,7 +435,7 @@ ufs_sync(mp, waitfor)
        /*
         * Force stale buffer cache information to be flushed.
         */
        /*
         * Force stale buffer cache information to be flushed.
         */
-       bflush(ump->um_devvp->v_rdev);
+       bflush(ump->um_devvp->v_mount);
        return (error);
 }
 
        return (error);
 }
 
index 7c3bc9d..4946e18 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_inode.c 7.11 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.12 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -158,7 +158,7 @@ loop:
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
-           (int)fs->fs_bsize, &bp)) {
+           (int)fs->fs_bsize, NOCRED, &bp)) {
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
@@ -520,7 +520,7 @@ iupdat(ip, ta, tm, waitfor)
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
-               (int)fs->fs_bsize, &bp);
+               (int)fs->fs_bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
@@ -607,7 +607,7 @@ itrunc(oip, length)
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
-               error = bread(oip->i_devvp, bn, size, &bp);
+               error = bread(oip->i_devvp, bn, size, NOCRED, &bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
@@ -768,7 +768,8 @@ indirtrunc(ip, bn, lastbn, level, countp)
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize, &bp);
+       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize,
+               NOCRED, &bp);
        if (error) {
                brelse(bp);
                *countp = 0;
        if (error) {
                brelse(bp);
                *countp = 0;
index 73a3106..0b37fdd 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_lookup.c        7.12 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        7.13 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -736,7 +736,7 @@ blkatoff(ip, offset, res, bpp)
 #ifdef SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), bsize, fs->fs_dbsize);
 #else SECSIZE
 #ifdef SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), bsize, fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, bn, bsize, &bp);
+       error = bread(ip->i_devvp, bn, bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
index 13834e5..5e13c92 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_vfsops.c        7.18 (Berkeley) %G%
+ *     @(#)ufs_vfsops.c        7.19 (Berkeley) %G%
  */
 
  */
 
-
 #include "param.h"
 #include "systm.h"
 #include "time.h"
 #include "param.h"
 #include "systm.h"
 #include "time.h"
@@ -26,6 +25,7 @@
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
+#include "ucred.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
@@ -178,14 +178,13 @@ mountfs(devvp, mp)
                return (error);
        }
        needclose = 1;
                return (error);
        }
        needclose = 1;
-       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD,
-           (struct ucred *)0) != 0)
+       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED) != 0)
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
-       if (error = bread(devvp, SBLOCK, SBSIZE, &bp)) {
+       if (error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) {
                ump->um_fs = NULL;
                goto out;
        }
                ump->um_fs = NULL;
                goto out;
        }
@@ -246,7 +245,8 @@ mountfs(devvp, mp)
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, &bp);
+               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+                       NOCRED, &bp);
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
@@ -266,6 +266,7 @@ mountfs(devvp, mp)
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
+       devvp->v_mount = mp;
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
@@ -276,8 +277,7 @@ mountfs(devvp, mp)
        return (0);
 out:
        if (needclose)
        return (0);
 out:
        if (needclose)
-               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE,
-                       (struct ucred *)0);
+               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED);
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
@@ -435,7 +435,7 @@ ufs_sync(mp, waitfor)
        /*
         * Force stale buffer cache information to be flushed.
         */
        /*
         * Force stale buffer cache information to be flushed.
         */
-       bflush(ump->um_devvp->v_rdev);
+       bflush(ump->um_devvp->v_mount);
        return (error);
 }
 
        return (error);
 }
 
index 4d4080f..4b3fa18 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_alloc.c 7.10 (Berkeley) %G%
+ *     @(#)lfs_alloc.c 7.11 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -160,7 +160,7 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
                            fs->fs_dbsize);
 #else SECSIZE
                        error = bread(ip->i_devvp, fsbtodb(fs, bno),
-                               osize, &bp);
+                               osize, NOCRED, &bp);
                        if (error) {
                                brelse(bp);
                                return (error);
                        if (error) {
                                brelse(bp);
                                return (error);
@@ -225,7 +225,8 @@ realloccg(ip, bprev, bpref, osize, nsize, bpp)
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
                obp = bread(ip->i_dev, fsbtodb(fs, bprev), osize,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(ip->i_devvp, fsbtodb(fs, bprev), osize, &obp);
+               error = bread(ip->i_devvp, fsbtodb(fs, bprev), 
+                       osize, NOCRED, &obp);
                if (error) {
                        brelse(obp);
                        return (error);
                if (error) {
                        brelse(obp);
                        return (error);
@@ -541,7 +542,7 @@ fragextend(ip, cg, bprev, osize, nsize)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -609,7 +610,7 @@ alloccg(ip, cg, bpref, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -815,7 +816,7 @@ ialloccg(ip, cg, ipref, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (NULL);
        if (error) {
                brelse(bp);
                return (NULL);
@@ -907,7 +908,7 @@ blkfree(ip, bno, size)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;
@@ -1007,7 +1008,7 @@ ifree(ip, ino, mode)
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
            fs->fs_dbsize);
 #else SECSIZE
        error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
-               (int)fs->fs_cgsize, &bp);
+               (int)fs->fs_cgsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return;
        if (error) {
                brelse(bp);
                return;
index 56b32a0..a3872fe 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_balloc.c        7.4 (Berkeley) %G%
+ *     @(#)lfs_balloc.c        7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -103,7 +103,7 @@ bmap(ip, bn, bnp, rablockp, rasizep)
         */
        for (; j <= NIADDR; j++) {
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
         */
        for (; j <= NIADDR; j++) {
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
-                   (int)fs->fs_bsize, &bp)) {
+                   (int)fs->fs_bsize, NOCRED, &bp)) {
                        brelse(bp);
                        return (error);
                }
                        brelse(bp);
                        return (error);
                }
@@ -281,7 +281,7 @@ gotit:
                    fs->fs_dbsize);
 #else SECSIZE
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
                    fs->fs_dbsize);
 #else SECSIZE
                if (error = bread(ip->i_devvp, fsbtodb(fs, nb),
-                   (int)fs->fs_bsize, &bp)) {
+                   (int)fs->fs_bsize, NOCRED, &bp)) {
                        brelse(bp);
                        return (error);
                }
                        brelse(bp);
                        return (error);
                }
index 4d389ff..b6cb179 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_inode.c 7.11 (Berkeley) %G%
+ *     @(#)lfs_inode.c 7.12 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -158,7 +158,7 @@ loop:
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
-           (int)fs->fs_bsize, &bp)) {
+           (int)fs->fs_bsize, NOCRED, &bp)) {
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
@@ -520,7 +520,7 @@ iupdat(ip, ta, tm, waitfor)
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
-               (int)fs->fs_bsize, &bp);
+               (int)fs->fs_bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
@@ -607,7 +607,7 @@ itrunc(oip, length)
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
-               error = bread(oip->i_devvp, bn, size, &bp);
+               error = bread(oip->i_devvp, bn, size, NOCRED, &bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
@@ -768,7 +768,8 @@ indirtrunc(ip, bn, lastbn, level, countp)
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize, &bp);
+       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize,
+               NOCRED, &bp);
        if (error) {
                brelse(bp);
                *countp = 0;
        if (error) {
                brelse(bp);
                *countp = 0;
index c71d74c..2f8f2c9 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_vfsops.c        7.18 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        7.19 (Berkeley) %G%
  */
 
  */
 
-
 #include "param.h"
 #include "systm.h"
 #include "time.h"
 #include "param.h"
 #include "systm.h"
 #include "time.h"
@@ -26,6 +25,7 @@
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
+#include "ucred.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
@@ -178,14 +178,13 @@ mountfs(devvp, mp)
                return (error);
        }
        needclose = 1;
                return (error);
        }
        needclose = 1;
-       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD,
-           (struct ucred *)0) != 0)
+       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED) != 0)
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
-       if (error = bread(devvp, SBLOCK, SBSIZE, &bp)) {
+       if (error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) {
                ump->um_fs = NULL;
                goto out;
        }
                ump->um_fs = NULL;
                goto out;
        }
@@ -246,7 +245,8 @@ mountfs(devvp, mp)
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, &bp);
+               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+                       NOCRED, &bp);
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
@@ -266,6 +266,7 @@ mountfs(devvp, mp)
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
+       devvp->v_mount = mp;
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
@@ -276,8 +277,7 @@ mountfs(devvp, mp)
        return (0);
 out:
        if (needclose)
        return (0);
 out:
        if (needclose)
-               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE,
-                       (struct ucred *)0);
+               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED);
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
@@ -435,7 +435,7 @@ ufs_sync(mp, waitfor)
        /*
         * Force stale buffer cache information to be flushed.
         */
        /*
         * Force stale buffer cache information to be flushed.
         */
-       bflush(ump->um_devvp->v_rdev);
+       bflush(ump->um_devvp->v_mount);
        return (error);
 }
 
        return (error);
 }
 
index 7c3bc9d..4946e18 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_inode.c 7.11 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.12 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -158,7 +158,7 @@ loop:
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
         * Read in the disk contents for the inode.
         */
        if (error = bread(VFSTOUFS(mntp)->um_devvp, fsbtodb(fs, itod(fs, ino)),
-           (int)fs->fs_bsize, &bp)) {
+           (int)fs->fs_bsize, NOCRED, &bp)) {
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
                /*
                 * The inode doesn't contain anything useful, so it would
                 * be misleading to leave it on its hash chain. Iput() will
@@ -520,7 +520,7 @@ iupdat(ip, ta, tm, waitfor)
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
        if (vp->v_mount->m_flag & M_RDONLY)
                return (0);
        error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
-               (int)fs->fs_bsize, &bp);
+               (int)fs->fs_bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
@@ -607,7 +607,7 @@ itrunc(oip, length)
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
                size = blksize(fs, oip, lbn);
                count = howmany(size, CLBYTES);
                        munhash(oip->i_devvp, bn + i * CLBYTES / DEV_BSIZE);
-               error = bread(oip->i_devvp, bn, size, &bp);
+               error = bread(oip->i_devvp, bn, size, NOCRED, &bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
                if (error) {
                        oip->i_size = osize;
                        brelse(bp);
@@ -768,7 +768,8 @@ indirtrunc(ip, bn, lastbn, level, countp)
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), (int)fs->fs_bsize,
            fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize, &bp);
+       error = bread(ip->i_devvp, fsbtodb(fs, bn), (int)fs->fs_bsize,
+               NOCRED, &bp);
        if (error) {
                brelse(bp);
                *countp = 0;
        if (error) {
                brelse(bp);
                *countp = 0;
index 73a3106..0b37fdd 100644 (file)
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_lookup.c        7.12 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        7.13 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -736,7 +736,7 @@ blkatoff(ip, offset, res, bpp)
 #ifdef SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), bsize, fs->fs_dbsize);
 #else SECSIZE
 #ifdef SECSIZE
        bp = bread(ip->i_dev, fsbtodb(fs, bn), bsize, fs->fs_dbsize);
 #else SECSIZE
-       error = bread(ip->i_devvp, bn, bsize, &bp);
+       error = bread(ip->i_devvp, bn, bsize, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (error);
        if (error) {
                brelse(bp);
                return (error);
index 13834e5..5e13c92 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_vfsops.c        7.18 (Berkeley) %G%
+ *     @(#)ufs_vfsops.c        7.19 (Berkeley) %G%
  */
 
  */
 
-
 #include "param.h"
 #include "systm.h"
 #include "time.h"
 #include "param.h"
 #include "systm.h"
 #include "time.h"
@@ -26,6 +25,7 @@
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
 #include "vnode.h"
 #include "mount.h"
 #include "buf.h"
+#include "ucred.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
 #include "file.h"
 #include "disklabel.h"
 #include "ioctl.h"
@@ -178,14 +178,13 @@ mountfs(devvp, mp)
                return (error);
        }
        needclose = 1;
                return (error);
        }
        needclose = 1;
-       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD,
-           (struct ucred *)0) != 0)
+       if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED) != 0)
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
                size = DEV_BSIZE;
        else {
                havepart = 1;
                size = dpart.disklab->d_secsize;
        }
-       if (error = bread(devvp, SBLOCK, SBSIZE, &bp)) {
+       if (error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) {
                ump->um_fs = NULL;
                goto out;
        }
                ump->um_fs = NULL;
                goto out;
        }
@@ -246,7 +245,8 @@ mountfs(devvp, mp)
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
                tp = bread(dev, fsbtodb(fs, fs->fs_csaddr + i), size,
                    fs->fs_dbsize);
 #else SECSIZE
-               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, &bp);
+               error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
+                       NOCRED, &bp);
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
                if (error) {
                        free((caddr_t)base, M_SUPERBLK);
                        goto out;
@@ -266,6 +266,7 @@ mountfs(devvp, mp)
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
        ump->um_dev = dev;
        ump->um_devvp = devvp;
        ump->um_qinod = NULL;
+       devvp->v_mount = mp;
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
 
        /* Sanity checks for old file systems.                     XXX */
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
@@ -276,8 +277,7 @@ mountfs(devvp, mp)
        return (0);
 out:
        if (needclose)
        return (0);
 out:
        if (needclose)
-               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE,
-                       (struct ucred *)0);
+               (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED);
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
        if (ump->um_fs) {
                free((caddr_t)ump->um_fs, M_SUPERBLK);
                ump->um_fs = NULL;
@@ -435,7 +435,7 @@ ufs_sync(mp, waitfor)
        /*
         * Force stale buffer cache information to be flushed.
         */
        /*
         * Force stale buffer cache information to be flushed.
         */
-       bflush(ump->um_devvp->v_rdev);
+       bflush(ump->um_devvp->v_mount);
        return (error);
 }
 
        return (error);
 }