summaryrefslogtreecommitdiffstats
path: root/sys/scsi/worm.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-01-20 15:27:36 +0000
committerjoerg <joerg@FreeBSD.org>1996-01-20 15:27:36 +0000
commit4b3be413097fff9ffc7a86b4305c8cfcbd2a6ec1 (patch)
tree337ebc721c5b1e262f6b8b4c16e73e86a9205ce3 /sys/scsi/worm.c
parentfb3b6ba3b03063c224a9ffc657d1bbe6d55e8c33 (diff)
downloadFreeBSD-src-4b3be413097fff9ffc7a86b4305c8cfcbd2a6ec1.zip
FreeBSD-src-4b3be413097fff9ffc7a86b4305c8cfcbd2a6ec1.tar.gz
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.
Diffstat (limited to 'sys/scsi/worm.c')
-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 3486876..169e373 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;
OpenPOWER on IntegriCloud