diff options
author | phk <phk@FreeBSD.org> | 2000-01-10 12:04:27 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-01-10 12:04:27 +0000 |
commit | ae0c1ec8f72abc7b43c1fed6860db12370093a0a (patch) | |
tree | d473773da273d9f8e9ef585dcf6dea59e03c2855 /sys/kern/vfs_export.c | |
parent | 5a624ba37849e1a07c962f1ec21e8e3df37884af (diff) | |
download | FreeBSD-src-ae0c1ec8f72abc7b43c1fed6860db12370093a0a.zip FreeBSD-src-ae0c1ec8f72abc7b43c1fed6860db12370093a0a.tar.gz |
Give vn_isdisk() a second argument where it can return a suitable errno.
Suggested by: bde
Diffstat (limited to 'sys/kern/vfs_export.c')
-rw-r--r-- | sys/kern/vfs_export.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 4e6123e..97d6251 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -1012,7 +1012,7 @@ sched_sync(void) * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - !vn_isdisk(vp)) + !vn_isdisk(vp, NULL)) panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); /* * Put us back on the worklist. The worklist @@ -2516,7 +2516,7 @@ vfs_object_create(vp, p, cred) vm_object_t object; int error = 0; - if (!vn_isdisk(vp) && vn_canvmio(vp) == FALSE) + if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE) return 0; retry: @@ -2875,15 +2875,27 @@ vn_todev(vp) * Check if vnode represents a disk device */ int -vn_isdisk(vp) +vn_isdisk(vp, errp) struct vnode *vp; + int *errp; { - if (vp->v_type != VBLK && vp->v_type != VCHR) + if (vp->v_type != VBLK && vp->v_type != VCHR) { + if (errp != NULL) + *errp = ENOTBLK; return (0); - if (!devsw(vp->v_rdev)) + } + if (!devsw(vp->v_rdev)) { + if (errp != NULL) + *errp = ENXIO; return (0); - if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) + } + if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) { + if (errp != NULL) + *errp = ENOTBLK; return (0); + } + if (errp != NULL) + *errp = 0; return (1); } |