summaryrefslogtreecommitdiff
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/atapi/acd.c18
-rw-r--r--sys/dev/atapi/atapilink.h19
2 files changed, 25 insertions, 12 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);
diff --git a/sys/dev/atapi/atapilink.h b/sys/dev/atapi/atapilink.h
index 22a5d880dee..d8791f97ce3 100644
--- a/sys/dev/atapi/atapilink.h
+++ b/sys/dev/atapi/atapilink.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapilink.h,v 1.2 1996/06/09 08:59:50 downsj Exp $ */
+/* $OpenBSD: atapilink.h,v 1.3 1996/06/10 00:43:57 downsj Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@@ -140,14 +140,15 @@ struct at_dev_link {
struct atapi_identify id;
struct bus_link *bus;
u_int16_t flags;
-#define ADEV_REMOVABLE 0x001 /* media is removable */
-#define ADEV_MEDIA_LOADED 0x002 /* device figures are still valid */
-#define ADEV_WAITING 0x004 /* a process is waiting for this */
-#define ADEV_OPEN 0x008 /* at least 1 open session */
-#define ACAP_DRQ_MPROC 0x000 /* microprocessor DRQ */
-#define ACAP_DRQ_INTR 0x100 /* interrupt DRQ */
-#define ACAP_DRQ_ACCEL 0x200 /* accelerated DRQ */
-#define ACAP_LEN 0x400 /* 16 bit commands */
+#define ADEV_REMOVABLE 0x0001 /* media is removable */
+#define ADEV_MEDIA_LOADED 0x0002 /* device figures are still valid */
+#define ADEV_WAITING 0x0004 /* a process is waiting for this */
+#define ADEV_OPEN 0x0008 /* at least 1 open session */
+#define ADEV_EJECTING 0x0010 /* eject on close */
+#define ACAP_DRQ_MPROC 0x0000 /* microprocessor DRQ */
+#define ACAP_DRQ_INTR 0x0100 /* interrupt DRQ */
+#define ACAP_DRQ_ACCEL 0x0200 /* accelerated DRQ */
+#define ACAP_LEN 0x0400 /* 16 bit commands */
void (*start)(); /* device start routine */
int (*done)(); /* device done routine */
};