Patch from Julian. Commit message by me.

cd.c:
Initialize channel info in CDIOCSETVOL ioctl.
Correct CDIOCSTOP and CDIOCEJCET ioctls to use scsi_stop_unit
instead of scsi_start_unit.
Add CDIOCALLOW and CDIOCPREVENT ioctls.

ch.h:
Return EBUSY instead of ENXIO if the device is already in use.

scsi_base.c:
Add scsi_stop_unit routine.

sd.c:
Add mising indirection through sc_link to sd_get_parms routine
when checking for media loaded.

st.c:
Return EBUSY instead of ENXIO if the device is already in use.
Clear the SDEV_WAITING flag in ststart if we do the wakeup call.
This commit is contained in:
Rodney W. Grimes 1994-01-29 10:30:41 +00:00
parent 2e8a06d0b6
commit 861e92cb98
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1034
5 changed files with 48 additions and 11 deletions

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id: cd.c,v 1.13 1993/11/25 01:37:28 wollman Exp $
* $Id: cd.c,v 1.14 1993/12/19 00:54:44 wollman Exp $
*/
#define SPLCD splbio
@ -753,7 +753,9 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag)
struct cd_mode_data data;
if (error = cd_get_mode(unit, &data, AUDIO_PAGE))
break;
data.page.audio.port[LEFT_PORT].channels = CHANNEL_0;
data.page.audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT];
data.page.audio.port[RIGHT_PORT].channels = CHANNEL_1;
data.page.audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT];
data.page.audio.port[2].volume = arg->vol[2];
data.page.audio.port[3].volume = arg->vol[3];
@ -841,10 +843,16 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag)
error = scsi_start_unit(cd->sc_link, 0);
break;
case CDIOCSTOP:
error = scsi_start_unit(cd->sc_link, 0);
error = scsi_stop_unit(cd->sc_link, 0, 0);
break;
case CDIOCEJECT:
error = scsi_start_unit(cd->sc_link, 0);
error = scsi_stop_unit(cd->sc_link, 1, 0);
break;
case CDIOCALLOW:
error = scsi_prevent(cd->sc_link, PR_ALLOW, 0);
break;
case CDIOCPREVENT:
error = scsi_prevent(cd->sc_link, PR_PREVENT, 0);
break;
case CDIOCSETDEBUG:
cd->sc_link->flags |= (SDEV_DB1 | SDEV_DB2);

View File

@ -2,7 +2,7 @@
* Written by grefen@?????
* Based on scsi drivers by Julian Elischer (julian@tfs.com)
*
* $Id: ch.c,v 1.6 1993/11/25 01:37:31 wollman Exp $
* $Id: ch.c,v 1.7 1993/12/19 00:54:49 wollman Exp $
*/
#include <sys/types.h>
@ -148,7 +148,7 @@ chopen(dev)
*/
if (ch_data[unit].flags & CH_OPEN) {
printf("ch%d: already open\n", unit);
return ENXIO;
return EBUSY;
}
/*
* Make sure the device has been initialised

View File

@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.3 1993/12/19 00:54:50 wollman Exp $
* $Id: scsi_base.c,v 1.4 1994/01/14 16:25:29 davidg Exp $
*/
#define SPLSD splbio
@ -287,6 +287,34 @@ scsi_start_unit(sc_link, flags)
scsi_cmd.op_code = START_STOP;
scsi_cmd.how = SSS_START;
return (scsi_scsi_cmd(sc_link,
(struct scsi_generic *) &scsi_cmd,
sizeof(scsi_cmd),
0,
0,
2,
2000,
NULL,
flags));
}
/*
* Get scsi driver to send a "stop" command
*/
errval
scsi_stop_unit(sc_link, eject, flags)
struct scsi_link *sc_link;
u_int32 eject;
u_int32 flags;
{
struct scsi_start_stop scsi_cmd;
bzero(&scsi_cmd, sizeof(scsi_cmd));
scsi_cmd.op_code = START_STOP;
if (eject) {
scsi_cmd.how = SSS_LOEJ;
}
return (scsi_scsi_cmd(sc_link,
(struct scsi_generic *) &scsi_cmd,
sizeof(scsi_cmd),

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
* $Id: sd.c,v 1.15 1994/01/06 18:08:03 rgrimes Exp $
* $Id: sd.c,v 1.16 1994/01/22 11:05:16 rgrimes Exp $
*/
#define SPLSD splbio
@ -818,7 +818,7 @@ sd_get_parms(unit, flags)
/*
* First check if we have it all loaded
*/
if (sd->flags & SDEV_MEDIA_LOADED)
if (sd->sc_link->flags & SDEV_MEDIA_LOADED)
return 0;
/*

View File

@ -21,13 +21,13 @@
* 16 Feb 93 Julian Elischer ADDED for SCSI system
* 1.15 is the last version to support MACH and OSF/1
*/
/* $Revision: 1.13 $ */
/* $Revision: 1.14 $ */
/*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
* major changes by Julian Elischer (julian@jules.dialix.oz.au) May 1993
*
* $Id: st.c,v 1.13 1993/11/18 05:03:05 rgrimes Exp $
* $Id: st.c,v 1.14 1993/12/19 00:54:59 wollman Exp $
*/
/*
@ -485,7 +485,7 @@ stopen(dev, flags)
* Only allow one at a time
*/
if (st->flags & ST_OPEN) {
return (ENXIO);
return (EBUSY);
}
/*
* Throw out a dummy instruction to catch 'Unit attention
@ -975,6 +975,7 @@ ststart(unit)
/* if a special awaits, let it proceed first */
if (sc_link->flags & SDEV_WAITING) {
sc_link->flags &= ~SDEV_WAITING;
wakeup((caddr_t)sc_link);
return;
}