FreeBSD/sys/kern/vfs_bio.c
/*
 * Set bio_data or bio_ma for struct bio from the struct buf.
 */
Set bio_data or bio_ma for struct bio from the struct buf.
Set bio_data or bio_ma for struct bio from the struct buf .
void
bdata2bio(struct buf *bp, struct bio *bip)
{
	if (!buf_mapped(bp)) {
		KASSERT(unmapped_buf_allowed, ("unmapped"));
		bip->bio_ma = bp->b_pages;
		bip->bio_ma_n = bp->b_npages;
		bip->bio_data = unmapped_buf;
		bip->bio_ma_offset = (vm_offset_t)bp->b_offset & PAGE_MASK;
		bip->bio_flags |= BIO_UNMAPPED;
		KASSERT(round_page(bip->bio_ma_offset + bip->bio_length) /
		    PAGE_SIZE == bp->b_npages,
		    ("Buffer %p too short: %d %lld %d", bp, bip->bio_ma_offset,
		    (long long)bip->bio_length, bip->bio_ma_n));
	} else {
		bip->bio_data = bp->b_data;
		bip->bio_ma = NULL;
	}
}
void bdata2bio ( struct buf * bp , struct bio * bip ) { if ( ! buf_mapped ( bp ) ) { KASSERT ( unmapped_buf_allowed , ( " " ) ) ; bip -> bio_ma = bp -> b_pages ; bip -> bio_ma_n = bp -> b_npages ; bip -> bio_data = unmapped_buf ; bip -> bio_ma_offset = ( vm_offset_t ) bp -> b_offset & PAGE_MASK ; bip -> bio_flags |= BIO_UNMAPPED ; KASSERT ( round_page ( bip -> bio_ma_offset + bip -> bio_length ) / PAGE_SIZE == bp -> b_npages , ( " " , bp , bip -> bio_ma_offset , ( long long ) bip -> bio_length , bip -> bio_ma_n ) ) ; } else { bip -> bio_data = bp -> b_data ; bip -> bio_ma = NULL ; } }
Set bio_data or bio_ma for struct bio from the struct buf.
Set bio_data or bio_ma for struct bio from the struct buf .