aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1996-01-20 15:27:36 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1996-01-20 15:27:36 +0000
commit794b6a665fd1c4a5bf3b39f3cc4715664a89c023 (patch)
tree337ebc721c5b1e262f6b8b4c16e73e86a9205ce3
parente82d9e7eb567e495596ce0c102acb1c7a61f07c0 (diff)
downloadsrc-794b6a665fd1c4a5bf3b39f3cc4715664a89c023.tar.gz
src-794b6a665fd1c4a5bf3b39f3cc4715664a89c023.zip
Fold in my latest changes to the worm driver.
This makes it sorta usable, just for my ``proof-of-concept'' Perl script i've been posting to freebsd-scsi. The driver will be overhauled further, this is just to provide Jordan with a base to perform testing of his own with his HP burner. Use entirely at your own risk, expect a bunch of misburnt CD-R's when using it already in this very green stage. Note that by now the driver will only work when the CD-R has already been in the drive at boot time.
Notes
Notes: svn path=/head/; revision=13517
-rw-r--r--sys/scsi/worm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c
index 34868760b03e..169e373baf48 100644
--- a/sys/scsi/worm.c
+++ b/sys/scsi/worm.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: worm.c,v 1.17 1996/01/02 15:44:00 joerg Exp $
+ * $Id: worm.c,v 1.18 1996/01/05 20:12:53 wollman Exp $
*/
/* XXX This is PRELIMINARY.
@@ -287,11 +287,15 @@ worm_strategy(struct buf *bp, struct scsi_link *sc_link)
unit = minor((bp->b_dev));
worm = sc_link->sd;
- /* XXX: Can't we move this check up to "scsi_strategy"?
+ /*
+ * The ugly modulo operation is necessary since audio tracks
+ * have a block size of 2352 bytes.
*/
if (!(sc_link->flags & SDEV_MEDIA_LOADED) ||
- bp->b_blkno > worm->n_blks ||
- bp->b_bcount & (worm->blk_size - 1)) {
+ bp->b_blkno * DEV_BSIZE > worm->n_blks * worm->blk_size||
+ (bp->b_bcount % worm->blk_size) != 0) {
+ SC_DEBUG(sc_link, SDEV_DB2,
+ ("worm block size / capacity error") );
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
biodone(bp);
@@ -355,18 +359,23 @@ struct scsi_link *sc_link)
sc_link->flags &= ~SDEV_OPEN;
return ENXIO;
}
-
+#if 0
scsi_start_unit(sc_link, SCSI_SILENT);
scsi_prevent(sc_link, PR_PREVENT, SCSI_SILENT);
+ /*
+ * XXX The worm_size() is required, alas, putting it here will
+ * result in an ICORRECT COMMAND SEQUENCE error. Without it,
+ * the driver will only work if the CD-R was present at boot-time.
+ */
if (worm_size(sc_link, 0) == 0) {
scsi_stop_unit(sc_link, 0, SCSI_SILENT);
scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT);
sc_link->flags &= ~SDEV_OPEN;
return ENXIO;
}
-
+#endif
return 0;
}
@@ -374,8 +383,10 @@ static int
worm_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link)
{
+#if 0
scsi_stop_unit(sc_link, 0, SCSI_SILENT);
scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT);
+#endif
sc_link->flags &= ~SDEV_OPEN;
return 0;