summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1996-01-29 03:19:23 +0000
committergibbs <gibbs@FreeBSD.org>1996-01-29 03:19:23 +0000
commitcab528dc9e181055b45685c22f46be08c3c594c5 (patch)
treed131160450cab5761e32848b553ca290199e4458 /sys/scsi
parent809a50d9aefedd7eada18d0e282a32c1d7898fe8 (diff)
downloadFreeBSD-src-cab528dc9e181055b45685c22f46be08c3c594c5.zip
FreeBSD-src-cab528dc9e181055b45685c22f46be08c3c594c5.tar.gz
Prevent media eject on first open and re-enable ejection on last close.
The previous behavior was based on the lifetime of a "mount session" which isn't very obvious.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/st.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 3cb2ffe..2c204cf 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.57 1996/01/08 12:25:06 joerg Exp $
+ * $Id: st.c,v 1.58 1996/01/14 16:29:01 joerg Exp $
*/
/*
@@ -519,6 +519,8 @@ struct scsi_link *sc_link)
if ((flags & O_ACCMODE) == FWRITE)
st->flags |= ST_WRITTEN;
+ scsi_prevent(sc_link, PR_PREVENT, 0); /* who cares if it fails? */
+
SC_DEBUG(sc_link, SDEV_DB2, ("Open complete\n"));
st->flags |= ST_OPEN;
@@ -556,8 +558,11 @@ st_close(dev_t dev, int flag, int fmt, struct proc *p,
st_unmount(unit, EJECT);
break;
}
+ scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT);
+
sc_link->flags &= ~SDEV_OPEN;
st->flags &= ~ST_OPEN;
+
return (0);
}
@@ -657,7 +662,6 @@ st_mount_tape(dev, flags)
printf("st%ld: Cannot set selected mode", unit);
return errno;
}
- scsi_prevent(sc_link, PR_PREVENT, 0); /* who cares if it fails? */
st->flags &= ~ST_NEW_MOUNT;
st->flags |= ST_MOUNTED;
sc_link->flags |= SDEV_MEDIA_LOADED;
@@ -683,7 +687,6 @@ st_unmount(int unit, boolean eject)
SC_DEBUG(sc_link, SDEV_DB1, ("unmounting\n"));
st_chkeod(unit, FALSE, &nmarks, SCSI_SILENT);
st_rewind(unit, FALSE, SCSI_SILENT);
- scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT);
if (eject) {
st_load(unit, LD_UNLOAD, SCSI_SILENT);
}
OpenPOWER on IntegriCloud