* st_touch_tape(): start probing at the block size from the sense data if
we have it. * st_unmount(): reset density to the device default. This prevents using stale density values after changing to a medium with different density. Section 9.3.3 of the SCSI specs states that a device shall return the density value specified in the last succesfull MODE SELECT after an unload operation, in case it is not able to automatically determine the density of the new medium.
This commit is contained in:
parent
e3aaa6c1ab
commit
4c7351ec7d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: st.c,v 1.130 2000/11/03 10:22:02 pk Exp $ */
|
||||
/* $NetBSD: st.c,v 1.131 2000/11/03 10:46:18 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -969,6 +969,23 @@ st_unmount(st, eject)
|
|||
SC_DEBUG(sc_link, SDEV_DB1, ("unmounting\n"));
|
||||
st_check_eod(st, FALSE, &nmarks, XS_CTL_IGNORE_NOT_READY);
|
||||
st_rewind(st, 0, XS_CTL_IGNORE_NOT_READY);
|
||||
|
||||
/*
|
||||
* Section 9.3.3 of the SCSI specs states that a device shall return
|
||||
* the density value specified in the last succesfull MODE SELECT
|
||||
* after an unload operation, in case it is not able to
|
||||
* automatically determine the density of the new medium.
|
||||
*
|
||||
* So we instruct the device to use the default density, which will
|
||||
* prevent the use of stale density values (in particular,
|
||||
* in st_touch_tape().
|
||||
*/
|
||||
st->density = 0;
|
||||
if (st_mode_select(st, 0) != 0) {
|
||||
printf("%s: WARNING: cannot revert to default density\n",
|
||||
st->sc_dev.dv_xname);
|
||||
}
|
||||
|
||||
scsipi_prevent(sc_link, PR_ALLOW,
|
||||
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_NOT_READY);
|
||||
if (eject)
|
||||
|
@ -2545,7 +2562,16 @@ st_touch_tape(st)
|
|||
|
||||
if ((error = st_mode_sense(st, 0)) != 0)
|
||||
goto bad;
|
||||
|
||||
/*
|
||||
* If the block size is already known from the
|
||||
* sense data, use it. Else start probing at 1024.
|
||||
*/
|
||||
if (st->media_blksize > 0)
|
||||
st->blksize = st->media_blksize;
|
||||
else
|
||||
st->blksize = 1024;
|
||||
|
||||
do {
|
||||
switch (st->blksize) {
|
||||
case 512:
|
||||
|
|
Loading…
Reference in New Issue