* Set bio_data or bio_ma for struct bio from the struct buf. */
| 5104 | * Set bio_data or bio_ma for struct bio from the struct buf. |
| 5105 | */ |
| 5106 | void |
| 5107 | bdata2bio(struct buf *bp, struct bio *bip) |
| 5108 | { |
| 5109 | |
| 5110 | if (!buf_mapped(bp)) { |
| 5111 | KASSERT(unmapped_buf_allowed, ("unmapped")); |
| 5112 | bip->bio_ma = bp->b_pages; |
| 5113 | bip->bio_ma_n = bp->b_npages; |
| 5114 | bip->bio_data = unmapped_buf; |
| 5115 | bip->bio_ma_offset = (vm_offset_t)bp->b_offset & PAGE_MASK; |
| 5116 | bip->bio_flags |= BIO_UNMAPPED; |
| 5117 | KASSERT(round_page(bip->bio_ma_offset + bip->bio_length) / |
| 5118 | PAGE_SIZE == bp->b_npages, |
| 5119 | ("Buffer %p too short: %d %lld %d", bp, bip->bio_ma_offset, |
| 5120 | (long long)bip->bio_length, bip->bio_ma_n)); |
| 5121 | } else { |
| 5122 | bip->bio_data = bp->b_data; |
| 5123 | bip->bio_ma = NULL; |
| 5124 | } |
| 5125 | } |
| 5126 | |
| 5127 | /* |
| 5128 | * The MIPS pmap code currently doesn't handle aliased pages. |
nothing calls this directly
no test coverage detected