/* * Queue a transfer request, and if possible, hand it to the controller. */ void rastrategy(struct buf *bp) { struct ra_softc *ra = mscp_device_lookup(bp->b_dev); int b; /* * Make sure this is a reasonable drive to use. */ if (ra == NULL) { bp->b_error = ENXIO; goto done; } /* * If drive is open `raw' or reading label, let it at it. */ if (ra->ra_state == DK_RDLABEL) { /* Make some statistics... /bqt */ b = splbio(); disk_busy(&ra->ra_disk); splx(b); mscp_strategy(bp, device_parent(ra->ra_dev)); return; } /* If disk is not online, try to put it online */ if (ra->ra_state == DK_CLOSED) if (ra_putonline(bp->b_dev, ra) == MSCP_FAILED) { bp->b_error = EIO; goto done; } /* * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. */ if (bounds_check_with_label(&ra->ra_disk, bp, ra->ra_wlabel) <= 0) goto done; /* Make some statistics... /bqt */ b = splbio(); disk_busy(&ra->ra_disk); splx(b); mscp_strategy(bp, device_parent(ra->ra_dev)); return; done: biodone(bp); }
/* * Queue a transfer request, and if possible, hand it to the controller. * * This routine is broken into two so that the internal version * udastrat1() can be called by the (nonexistent, as yet) bad block * revectoring routine. */ void rxstrategy(struct buf *bp) { int unit; struct rx_softc *rx; int b; /* * Make sure this is a reasonable drive to use. */ unit = DISKUNIT(bp->b_dev); if ((rx = device_lookup_private(&rx_cd, unit)) == NULL) { bp->b_error = ENXIO; goto done; } /* If disk is not online, try to put it online */ if (rx->ra_state == DK_CLOSED) if (rx_putonline(rx) == MSCP_FAILED) { bp->b_error = EIO; goto done; } /* * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. */ if (bp->b_blkno >= rx->ra_disk.dk_label->d_secperunit) { bp->b_resid = bp->b_bcount; goto done; } /* Make some statistics... /bqt */ b = splbio(); disk_busy(&rx->ra_disk); splx(b); mscp_strategy(bp, device_parent(rx->ra_dev)); return; done: biodone(bp); }
void mtstrategy(struct buf *bp) { int unit; struct mt_softc *mt; /* * Make sure this is a reasonable drive to use. */ unit = mtunit(bp->b_dev); if ((mt = device_lookup_private(&mt_cd, unit)) == NULL) { bp->b_error = ENXIO; biodone(bp); return; } mt->mt_waswrite = bp->b_flags & B_READ ? 0 : 1; mscp_strategy(bp, device_parent(mt->mt_dev)); return; }