1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Move extern declaration of dead_vnodeop_p to a .h file.

Remove race condition in vn_isdisk().
This commit is contained in:
Poul-Henning Kamp 2000-09-05 21:09:56 +00:00
parent bfb752885a
commit 64dc16df4a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65492
3 changed files with 12 additions and 7 deletions

View File

@ -438,7 +438,6 @@ vattr_null(vap)
/*
* Routines having to do with the management of the vnode table.
*/
extern vop_t **dead_vnodeop_p;
/*
* Return the next vnode from the free list.
@ -2926,6 +2925,8 @@ vn_isdisk(vp, errp)
struct vnode *vp;
int *errp;
{
struct cdevsw *cdevsw;
if (vp->v_type != VBLK && vp->v_type != VCHR) {
if (errp != NULL)
*errp = ENOTBLK;
@ -2936,12 +2937,13 @@ vn_isdisk(vp, errp)
*errp = ENXIO;
return (0);
}
if (!devsw(vp->v_rdev)) {
cdevsw = devsw(vp->v_rdev);
if (cdevsw == NULL) {
if (errp != NULL)
*errp = ENXIO;
return (0);
}
if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) {
if (!(cdevsw->d_flags & D_DISK)) {
if (errp != NULL)
*errp = ENOTBLK;
return (0);

View File

@ -438,7 +438,6 @@ vattr_null(vap)
/*
* Routines having to do with the management of the vnode table.
*/
extern vop_t **dead_vnodeop_p;
/*
* Return the next vnode from the free list.
@ -2926,6 +2925,8 @@ vn_isdisk(vp, errp)
struct vnode *vp;
int *errp;
{
struct cdevsw *cdevsw;
if (vp->v_type != VBLK && vp->v_type != VCHR) {
if (errp != NULL)
*errp = ENOTBLK;
@ -2936,12 +2937,13 @@ vn_isdisk(vp, errp)
*errp = ENXIO;
return (0);
}
if (!devsw(vp->v_rdev)) {
cdevsw = devsw(vp->v_rdev);
if (cdevsw == NULL) {
if (errp != NULL)
*errp = ENXIO;
return (0);
}
if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) {
if (!(cdevsw->d_flags & D_DISK)) {
if (errp != NULL)
*errp = ENOTBLK;
return (0);

View File

@ -636,8 +636,9 @@ void vrele __P((struct vnode *vp));
void vref __P((struct vnode *vp));
void vbusy __P((struct vnode *vp));
extern vop_t **default_vnodeop_p;
extern vop_t **default_vnodeop_p;
extern vop_t **spec_vnodeop_p;
extern vop_t **dead_vnodeop_p;
#endif /* _KERNEL */