FreeBSD/sys/kern/vfs_bio.c
/*
 * Wait for a BIO to finish.
 */
Wait for a BIO to finish.
Wait for a BIO to finish .
int
biowait(struct bio *bp, const char *wchan)
{
	struct mtx *mtxp;
	mtxp = mtx_pool_find(mtxpool_sleep, bp);
	mtx_lock(mtxp);
	while ((bp->bio_flags & BIO_DONE) == 0)
		msleep(bp, mtxp, PRIBIO, wchan, 0);
	mtx_unlock(mtxp);
	if (bp->bio_error != 0)
		return (bp->bio_error);
	if (!(bp->bio_flags & BIO_ERROR))
		return (0);
	return (EIO);
}
int biowait ( struct bio * bp , const char * wchan ) { struct mtx * mtxp ; mtxp = mtx_pool_find ( mtxpool_sleep , bp ) ; mtx_lock ( mtxp ) ; while ( ( bp -> bio_flags & BIO_DONE ) == 0 ) msleep ( bp , mtxp , PRIBIO , wchan , 0 ) ; mtx_unlock ( mtxp ) ; if ( bp -> bio_error != 0 ) return ( bp -> bio_error ) ; if ( ! ( bp -> bio_flags & BIO_ERROR ) ) return ( 0 ) ; return ( EIO ) ; }
Wait for a BIO to finish.
Wait for a BIO to finish .