diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-08-25 12:24:39 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-08-25 12:24:39 +0000 |
| commit | 41d2e3e09ea3c2796feaf57a978acc3f8f6fe74a (patch) | |
| tree | dd4e0641fd024a6e4dac3cd36a669ad725575295 /sys/kern/vfs_subr.c | |
| parent | a431597b251954ad0c29f02685867f8799549d1d (diff) | |
Notes
Diffstat (limited to 'sys/kern/vfs_subr.c')
| -rw-r--r-- | sys/kern/vfs_subr.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 53572972037b..46d31fcf0feb 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.218 1999/08/22 00:15:04 jdp Exp $ + * $Id: vfs_subr.c,v 1.219 1999/08/25 04:55:17 julian Exp $ */ /* @@ -860,10 +860,7 @@ bgetvp(vp, bp) vhold(vp); bp->b_vp = vp; - if (vp->v_type == VBLK || vp->v_type == VCHR) - bp->b_dev = vp->v_rdev; - else - bp->b_dev = NODEV; + bp->b_dev = vn_todev(vp); /* * Insert onto list for new vnode. */ @@ -1095,10 +1092,7 @@ pbgetvp(vp, bp) bp->b_vp = vp; bp->b_flags |= B_PAGING; - if (vp->v_type == VBLK || vp->v_type == VCHR) - bp->b_dev = vp->v_rdev; - else - bp->b_dev = NODEV; + bp->b_dev = vn_todev(vp); } /* @@ -3015,3 +3009,20 @@ vn_todev(vp) return (NODEV); return (vp->v_rdev); } + +/* + * Check if vnode represents a disk device + */ +int +vn_isdisk(vp) + struct vnode *vp; +{ + if (vp->v_type != VBLK) + return (0); + if (!devsw(vp->v_rdev)) + return (0); + if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) + return (0); + return (1); +} + |
