diff options
author | ache <ache@FreeBSD.org> | 1996-02-02 22:08:28 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-02-02 22:08:28 +0000 |
commit | bc4a7990f2433495c81be22ceb47ef367c6bbce3 (patch) | |
tree | 317989354effa440dcf0f7939e6d984b1f7e8b46 /sys/i386/isa/mcd.c | |
parent | 8b50fd992ab3d2101642ca708dca94e7abb58c19 (diff) | |
download | FreeBSD-src-bc4a7990f2433495c81be22ceb47ef367c6bbce3.zip FreeBSD-src-bc4a7990f2433495c81be22ceb47ef367c6bbce3.tar.gz |
Implement PREVENT & CLOSE ioctls
Diffstat (limited to 'sys/i386/isa/mcd.c')
-rw-r--r-- | sys/i386/isa/mcd.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 7401393..419ea81 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -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); @@ -1282,6 +1287,18 @@ mcd_eject(int unit) } 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) { struct mcd_data *cd = mcd_data + unit; |