diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/cd.c | 11 | ||||
-rw-r--r-- | sys/scsi/sd.c | 17 |
2 files changed, 20 insertions, 8 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index d19864ef6e5..bf9c8925571 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.78 2005/04/06 02:51:13 krw Exp $ */ +/* $OpenBSD: cd.c,v 1.79 2005/05/01 19:29:17 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -359,6 +359,7 @@ cdopen(dev, flag, fmt, p) * and don't ignore NOT_READY. */ error = scsi_test_unit_ready(sc_link, TEST_READY_RETRIES_CD, + (part == RAW_PART && fmt == S_IFCHR) ? SCSI_SILENT : 0 | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); /* Start the cd spinning if necessary. */ @@ -368,9 +369,10 @@ cdopen(dev, flag, fmt, p) SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT); if (error) { - if (part == RAW_PART && fmt == S_IFCHR) + if (part == RAW_PART && fmt == S_IFCHR) { + error = 0; goto out; - else + } else goto bad; } @@ -1100,12 +1102,15 @@ cdioctl(dev, cmd, addr, flag, p) error = scsi_start(cd->sc_link, SSS_STOP, 0); break; + close_tray: case CDIOCCLOSE: error = scsi_start(cd->sc_link, SSS_START|SSS_LOEJ, SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE); break; case MTIOCTOP: + if (((struct mtop *)addr)->mt_op == MTRETEN) + goto close_tray; if (((struct mtop *)addr)->mt_op != MTOFFL) { error = EIO; break; diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 1e13885f423..33e41e1c884 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.75 2005/04/06 02:51:13 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.76 2005/05/01 19:29:17 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -383,9 +383,11 @@ sdopen(dev, flag, fmt, p) if (sd->sc_dk.dk_openmask != 0) { /* * If any partition is open, but the disk has been invalidated, - * disallow further opens. + * disallow further opens of non-raw partition. */ if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { + if (part == RAW_PART && fmt == S_IFCHR) + goto out; error = EIO; goto bad; } @@ -405,8 +407,13 @@ sdopen(dev, flag, fmt, p) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); - if (error) - goto bad; + if (error) { + if (part == RAW_PART && fmt == S_IFCHR) { + error = 0; + goto out; + } else + goto bad; + } /* Lock the pack in. */ if ((sc_link->flags & SDEV_REMOVABLE) != 0) { @@ -440,7 +447,7 @@ sdopen(dev, flag, fmt, p) goto bad; } - /* Insure only one open at a time. */ +out: /* Insure only one open at a time. */ switch (fmt) { case S_IFCHR: sd->sc_dk.dk_copenmask |= (1 << part); |