Some devices really do require the START before the PREVENT. This makes no

sense.
This commit is contained in:
mycroft 1995-01-30 11:34:25 +00:00
parent 6a96a52c80
commit 9085638020
4 changed files with 44 additions and 36 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.52 1995/01/26 12:05:49 mycroft Exp $ */ /* $NetBSD: cd.c,v 1.53 1995/01/30 11:34:25 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
@ -227,21 +227,22 @@ cdopen(dev, flag, fmt)
return ENXIO; return ENXIO;
} else { } else {
cd->flags |= CDF_LOCKED; cd->flags |= CDF_LOCKED;
sc_link->flags |= SDEV_OPEN;
/* Check that it is still responding and ok. */ /* Check that it is still responding and ok. */
if (error = scsi_test_unit_ready(sc_link, if (error = scsi_test_unit_ready(sc_link,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY))
goto bad; goto bad3;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad;
/* Start the pack spinning if necessary. */ /* Start the pack spinning if necessary. */
if (error = scsi_start(sc_link, SSS_START, if (error = scsi_start(sc_link, SSS_START,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT))
goto bad3;
sc_link->flags |= SDEV_OPEN;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad; goto bad;
if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
@ -297,6 +298,7 @@ bad:
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
sc_link->flags &= ~SDEV_OPEN; sc_link->flags &= ~SDEV_OPEN;
bad3:
cd->flags &= ~CDF_LOCKED; cd->flags &= ~CDF_LOCKED;
if ((cd->flags & CDF_WANTED) != 0) { if ((cd->flags & CDF_WANTED) != 0) {
cd->flags &= ~CDF_WANTED; cd->flags &= ~CDF_WANTED;
@ -773,11 +775,11 @@ cdioctl(dev, cmd, addr, flag, p)
case CDIOCPAUSE: case CDIOCPAUSE:
return cd_pause(cd, 0); return cd_pause(cd, 0);
case CDIOCSTART: case CDIOCSTART:
return scsi_start(cd->sc_link, SSS_START, 0); return scsi_start(cd->sc_link, SSS_START|SSS_LOEJ, 0);
case CDIOCSTOP: case CDIOCSTOP:
return scsi_start(cd->sc_link, SSS_STOP, 0); return scsi_start(cd->sc_link, SSS_STOP, 0);
case CDIOCEJECT: case CDIOCEJECT:
return scsi_start(cd->sc_link, SSS_LOEJ, 0); return scsi_start(cd->sc_link, SSS_STOP|SSS_LOEJ, 0);
case CDIOCALLOW: case CDIOCALLOW:
return scsi_prevent(cd->sc_link, PR_ALLOW, 0); return scsi_prevent(cd->sc_link, PR_ALLOW, 0);
case CDIOCPREVENT: case CDIOCPREVENT:

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.56 1995/01/26 12:05:54 mycroft Exp $ */ /* $NetBSD: sd.c,v 1.57 1995/01/30 11:34:30 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
@ -230,21 +230,22 @@ sdopen(dev, flag, fmt)
return ENXIO; return ENXIO;
} else { } else {
sd->flags |= SDF_LOCKED; sd->flags |= SDF_LOCKED;
sc_link->flags |= SDEV_OPEN;
/* Check that it is still responding and ok. */ /* Check that it is still responding and ok. */
if (error = scsi_test_unit_ready(sc_link, if (error = scsi_test_unit_ready(sc_link,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY))
goto bad; goto bad3;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad;
/* Start the pack spinning if necessary. */ /* Start the pack spinning if necessary. */
if (error = scsi_start(sc_link, SSS_START, if (error = scsi_start(sc_link, SSS_START,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT))
goto bad3;
sc_link->flags |= SDEV_OPEN;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad; goto bad;
if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
@ -300,6 +301,7 @@ bad:
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
sc_link->flags &= ~SDEV_OPEN; sc_link->flags &= ~SDEV_OPEN;
bad3:
sd->flags &= ~SDF_LOCKED; sd->flags &= ~SDF_LOCKED;
if ((sd->flags & SDF_WANTED) != 0) { if ((sd->flags & SDF_WANTED) != 0) {
sd->flags &= ~SDF_WANTED; sd->flags &= ~SDF_WANTED;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.52 1995/01/26 12:05:49 mycroft Exp $ */ /* $NetBSD: cd.c,v 1.53 1995/01/30 11:34:25 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
@ -227,21 +227,22 @@ cdopen(dev, flag, fmt)
return ENXIO; return ENXIO;
} else { } else {
cd->flags |= CDF_LOCKED; cd->flags |= CDF_LOCKED;
sc_link->flags |= SDEV_OPEN;
/* Check that it is still responding and ok. */ /* Check that it is still responding and ok. */
if (error = scsi_test_unit_ready(sc_link, if (error = scsi_test_unit_ready(sc_link,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY))
goto bad; goto bad3;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad;
/* Start the pack spinning if necessary. */ /* Start the pack spinning if necessary. */
if (error = scsi_start(sc_link, SSS_START, if (error = scsi_start(sc_link, SSS_START,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT))
goto bad3;
sc_link->flags |= SDEV_OPEN;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad; goto bad;
if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
@ -297,6 +298,7 @@ bad:
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
sc_link->flags &= ~SDEV_OPEN; sc_link->flags &= ~SDEV_OPEN;
bad3:
cd->flags &= ~CDF_LOCKED; cd->flags &= ~CDF_LOCKED;
if ((cd->flags & CDF_WANTED) != 0) { if ((cd->flags & CDF_WANTED) != 0) {
cd->flags &= ~CDF_WANTED; cd->flags &= ~CDF_WANTED;
@ -773,11 +775,11 @@ cdioctl(dev, cmd, addr, flag, p)
case CDIOCPAUSE: case CDIOCPAUSE:
return cd_pause(cd, 0); return cd_pause(cd, 0);
case CDIOCSTART: case CDIOCSTART:
return scsi_start(cd->sc_link, SSS_START, 0); return scsi_start(cd->sc_link, SSS_START|SSS_LOEJ, 0);
case CDIOCSTOP: case CDIOCSTOP:
return scsi_start(cd->sc_link, SSS_STOP, 0); return scsi_start(cd->sc_link, SSS_STOP, 0);
case CDIOCEJECT: case CDIOCEJECT:
return scsi_start(cd->sc_link, SSS_LOEJ, 0); return scsi_start(cd->sc_link, SSS_STOP|SSS_LOEJ, 0);
case CDIOCALLOW: case CDIOCALLOW:
return scsi_prevent(cd->sc_link, PR_ALLOW, 0); return scsi_prevent(cd->sc_link, PR_ALLOW, 0);
case CDIOCPREVENT: case CDIOCPREVENT:

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.56 1995/01/26 12:05:54 mycroft Exp $ */ /* $NetBSD: sd.c,v 1.57 1995/01/30 11:34:30 mycroft Exp $ */
/* /*
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
@ -230,21 +230,22 @@ sdopen(dev, flag, fmt)
return ENXIO; return ENXIO;
} else { } else {
sd->flags |= SDF_LOCKED; sd->flags |= SDF_LOCKED;
sc_link->flags |= SDEV_OPEN;
/* Check that it is still responding and ok. */ /* Check that it is still responding and ok. */
if (error = scsi_test_unit_ready(sc_link, if (error = scsi_test_unit_ready(sc_link,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_IGNORE_NOT_READY))
goto bad; goto bad3;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad;
/* Start the pack spinning if necessary. */ /* Start the pack spinning if necessary. */
if (error = scsi_start(sc_link, SSS_START, if (error = scsi_start(sc_link, SSS_START,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT)) SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | SCSI_SILENT))
goto bad3;
sc_link->flags |= SDEV_OPEN;
/* Lock the pack in. */
if (error = scsi_prevent(sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE))
goto bad; goto bad;
if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
@ -300,6 +301,7 @@ bad:
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE);
sc_link->flags &= ~SDEV_OPEN; sc_link->flags &= ~SDEV_OPEN;
bad3:
sd->flags &= ~SDF_LOCKED; sd->flags &= ~SDF_LOCKED;
if ((sd->flags & SDF_WANTED) != 0) { if ((sd->flags & SDF_WANTED) != 0) {
sd->flags &= ~SDF_WANTED; sd->flags &= ~SDF_WANTED;