1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Implement PREVENT & CLOSE ioctls

This commit is contained in:
Andrey A. Chernov 1996-02-02 22:08:28 +00:00
parent aeb13d5b74
commit 1cf944e85c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13866
2 changed files with 38 additions and 4 deletions

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.66 1996/02/02 20:50:03 ache Exp $
* $Id: mcd.c,v 1.67 1996/02/02 21:18:02 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -200,6 +200,7 @@ static int mcd_read_toc(int unit);
static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
static int mcd_stop(int unit);
static int mcd_eject(int unit);
static int mcd_inject(int unit);
static int mcd_playtracks(int unit, struct ioc_play_track *pt);
static int mcd_play(int unit, struct mcd_read2 *pb);
static int mcd_playmsf(int unit, struct ioc_play_msf *pt);
@ -649,6 +650,10 @@ MCD_TRACE("ioctl called 0x%x\n", cmd);
return mcd_hard_reset(unit);
case CDIOCALLOW:
return mcd_lock_door(unit, MCD_LK_UNLOCK);
case CDIOCPREVENT:
return mcd_lock_door(unit, MCD_LK_LOCK);
case CDIOCCLOSE:
return mcd_inject(unit);
default:
return ENOTTY;
}
@ -1272,7 +1277,7 @@ mcd_eject(int unit)
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
return EIO;
if (cd->status & MCDDOOROPEN)
return mcd_close_tray(unit);
return 0;
if ((r = mcd_stop(unit)) == EIO)
return r;
outb(port+mcd_command, MCD_CMDEJECTDISK);
@ -1281,6 +1286,18 @@ mcd_eject(int unit)
return 0;
}
static int
mcd_inject(int unit)
{
struct mcd_data *cd = mcd_data + unit;
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
return EIO;
if (cd->status & MCDDOOROPEN)
return mcd_close_tray(unit);
return 0;
}
static int
mcd_hard_reset(int unit)
{

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.66 1996/02/02 20:50:03 ache Exp $
* $Id: mcd.c,v 1.67 1996/02/02 21:18:02 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -200,6 +200,7 @@ static int mcd_read_toc(int unit);
static int mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
static int mcd_stop(int unit);
static int mcd_eject(int unit);
static int mcd_inject(int unit);
static int mcd_playtracks(int unit, struct ioc_play_track *pt);
static int mcd_play(int unit, struct mcd_read2 *pb);
static int mcd_playmsf(int unit, struct ioc_play_msf *pt);
@ -649,6 +650,10 @@ MCD_TRACE("ioctl called 0x%x\n", cmd);
return mcd_hard_reset(unit);
case CDIOCALLOW:
return mcd_lock_door(unit, MCD_LK_UNLOCK);
case CDIOCPREVENT:
return mcd_lock_door(unit, MCD_LK_LOCK);
case CDIOCCLOSE:
return mcd_inject(unit);
default:
return ENOTTY;
}
@ -1272,7 +1277,7 @@ mcd_eject(int unit)
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
return EIO;
if (cd->status & MCDDOOROPEN)
return mcd_close_tray(unit);
return 0;
if ((r = mcd_stop(unit)) == EIO)
return r;
outb(port+mcd_command, MCD_CMDEJECTDISK);
@ -1281,6 +1286,18 @@ mcd_eject(int unit)
return 0;
}
static int
mcd_inject(int unit)
{
struct mcd_data *cd = mcd_data + unit;
if (mcd_getstat(unit,1) == -1) /* detect disk change too */
return EIO;
if (cd->status & MCDDOOROPEN)
return mcd_close_tray(unit);
return 0;
}
static int
mcd_hard_reset(int unit)
{