diff options
author | phk <phk@FreeBSD.org> | 1999-08-25 12:24:39 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-08-25 12:24:39 +0000 |
commit | ea55d634757e3bbadb6525c31e5cb18f4f05ad53 (patch) | |
tree | bf5db0228b3f8aba1534aff880eed69f71082a05 /sys/kern/vfs_export.c | |
parent | 8bfe025139b1ec3d8cbe77369f343a2dbd6e5702 (diff) | |
download | FreeBSD-src-ea55d634757e3bbadb6525c31e5cb18f4f05ad53.zip FreeBSD-src-ea55d634757e3bbadb6525c31e5cb18f4f05ad53.tar.gz |
Introduce vn_isdisk(struct vnode *vp) function, and use it to test for diskness.
Diffstat (limited to 'sys/kern/vfs_export.c')
-rw-r--r-- | sys/kern/vfs_export.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 5357297..46d31fc 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.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); +} + |