vfs_subr.c (0ff7b13acdfdba786950abc8c07a7d501d43ad39) vfs_subr.c (41d2e3e09ea3c2796feaf57a978acc3f8f6fe74a)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
39 * $Id: vfs_subr.c,v 1.218 1999/08/22 00:15:04 jdp Exp $
39 * $Id: vfs_subr.c,v 1.219 1999/08/25 04:55:17 julian Exp $
40 */
41
42/*
43 * External virtual filesystem routines
44 */
45#include "opt_ddb.h"
46
47#include <sys/param.h>

--- 807 unchanged lines hidden (view full) ---

855 register struct buf *bp;
856{
857 int s;
858
859 KASSERT(bp->b_vp == NULL, ("bgetvp: not free"));
860
861 vhold(vp);
862 bp->b_vp = vp;
40 */
41
42/*
43 * External virtual filesystem routines
44 */
45#include "opt_ddb.h"
46
47#include <sys/param.h>

--- 807 unchanged lines hidden (view full) ---

855 register struct buf *bp;
856{
857 int s;
858
859 KASSERT(bp->b_vp == NULL, ("bgetvp: not free"));
860
861 vhold(vp);
862 bp->b_vp = vp;
863 if (vp->v_type == VBLK || vp->v_type == VCHR)
864 bp->b_dev = vp->v_rdev;
865 else
866 bp->b_dev = NODEV;
863 bp->b_dev = vn_todev(vp);
867 /*
868 * Insert onto list for new vnode.
869 */
870 s = splbio();
871 bp->b_xflags |= B_VNCLEAN;
872 bp->b_xflags &= ~B_VNDIRTY;
873 TAILQ_INSERT_TAIL(&vp->v_cleanblkhd, bp, b_vnbufs);
874 splx(s);

--- 215 unchanged lines hidden (view full) ---

1090 register struct vnode *vp;
1091 register struct buf *bp;
1092{
1093
1094 KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
1095
1096 bp->b_vp = vp;
1097 bp->b_flags |= B_PAGING;
864 /*
865 * Insert onto list for new vnode.
866 */
867 s = splbio();
868 bp->b_xflags |= B_VNCLEAN;
869 bp->b_xflags &= ~B_VNDIRTY;
870 TAILQ_INSERT_TAIL(&vp->v_cleanblkhd, bp, b_vnbufs);
871 splx(s);

--- 215 unchanged lines hidden (view full) ---

1087 register struct vnode *vp;
1088 register struct buf *bp;
1089{
1090
1091 KASSERT(bp->b_vp == NULL, ("pbgetvp: not free"));
1092
1093 bp->b_vp = vp;
1094 bp->b_flags |= B_PAGING;
1098 if (vp->v_type == VBLK || vp->v_type == VCHR)
1099 bp->b_dev = vp->v_rdev;
1100 else
1101 bp->b_dev = NODEV;
1095 bp->b_dev = vn_todev(vp);
1102}
1103
1104/*
1105 * Disassociate a p-buffer from a vnode.
1106 */
1107void
1108pbrelvp(bp)
1109 register struct buf *bp;

--- 1900 unchanged lines hidden (view full) ---

3010dev_t
3011vn_todev(vp)
3012 struct vnode *vp;
3013{
3014 if (vp->v_type != VBLK && vp->v_type != VCHR)
3015 return (NODEV);
3016 return (vp->v_rdev);
3017}
1096}
1097
1098/*
1099 * Disassociate a p-buffer from a vnode.
1100 */
1101void
1102pbrelvp(bp)
1103 register struct buf *bp;

--- 1900 unchanged lines hidden (view full) ---

3004dev_t
3005vn_todev(vp)
3006 struct vnode *vp;
3007{
3008 if (vp->v_type != VBLK && vp->v_type != VCHR)
3009 return (NODEV);
3010 return (vp->v_rdev);
3011}
3012
3013/*
3014 * Check if vnode represents a disk device
3015 */
3016int
3017vn_isdisk(vp)
3018 struct vnode *vp;
3019{
3020 if (vp->v_type != VBLK)
3021 return (0);
3022 if (!devsw(vp->v_rdev))
3023 return (0);
3024 if (!(devsw(vp->v_rdev)->d_flags & D_DISK))
3025 return (0);
3026 return (1);
3027}
3028