summaryrefslogtreecommitdiff
path: root/sys/dev/atapi/acd.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-06-10 00:44:01 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-06-10 00:44:01 +0000
commit5f8e6f389312dc58d7e115698eddf1aadba5d2cf (patch)
tree3cbfbe54a59611a5998349f98f02141dca907fe3 /sys/dev/atapi/acd.c
parent34e21fa7427630a0fd22a30e611f27d844a36035 (diff)
Several changes:
* Implemented NetBSD PR#2529, adding ZIP 100. * Added MTIOCTOP support to acd, cd, and sd. * Implemented eject on close for acd, cd, and sd. `mt -f /dev/rcd0d offline' now ejects a mounted {acd|cd|sd} when it is unmounted.
Diffstat (limited to 'sys/dev/atapi/acd.c')
-rw-r--r--sys/dev/atapi/acd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c
index 8d7b862550c..702d39d11cd 100644
--- a/sys/dev/atapi/acd.c
+++ b/sys/dev/atapi/acd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acd.c,v 1.3 1996/06/09 18:42:46 downsj Exp $ */
+/* $OpenBSD: acd.c,v 1.4 1996/06/10 00:43:56 downsj Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@@ -37,6 +37,7 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/mtio.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -350,6 +351,12 @@ acdclose(dev, flag, fmt)
atapi_prevent(acd->ad_link, PR_ALLOW);
acd->ad_link->flags &= ~ADEV_OPEN;
+
+ if (acd->ad_link->flags & ADEV_EJECTING) {
+ atapi_start_stop(acd->ad_link, SSS_STOP|SSS_LOEJ, 0);
+
+ acd->ad_link->flags &= ~ADEV_EJECTING;
+ }
}
acdunlock(acd);
@@ -873,9 +880,14 @@ acdioctl(dev, cmd, addr, flag, p)
case CDIOCSTOP:
return atapi_start_stop(acd->ad_link, SSS_STOP, 0);
- case CDIOCEJECT:
+ case MTIOCTOP:
+ if (((struct mtop *)addr)->mt_op != MTOFFL)
+ return EIO;
+ /* FALLTHROUGH */
+ case CDIOCEJECT: /* FALLTHROUGH */
case DIOCEJECT:
- return atapi_start_stop(acd->ad_link, SSS_STOP|SSS_LOEJ, 0);
+ acd->ad_link->flags |= ADEV_EJECTING;
+ return 0;
case CDIOCALLOW:
return atapi_prevent(acd->ad_link, PR_ALLOW);