Use a MODE SELECT command to reset the block size, instead of calling the

prepare_track() function, which caused fixation problems with some drives.
This commit is contained in:
Jean-Marc Zucconi 1997-10-27 21:09:27 +00:00
parent efa4858705
commit 1f32911745

View File

@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: worm.c,v 1.45 1997/09/02 20:06:41 bde Exp $
* $Id: worm.c,v 1.46 1997/09/21 22:03:22 gibbs Exp $
*/
#include "opt_bounce.h"
@ -139,6 +139,7 @@ static errval worm_read_toc(struct scsi_link *sc_link,
static errval worm_rezero_unit(struct scsi_link *sc_link);
static errval worm_read_session_info(struct scsi_link *, struct wormio_session_info *);
static int worm_sense_handler(struct scsi_xfer *);
static errval worm_set_blksize(struct scsi_link *sc_link, int size);
/* XXX should be moved out to an LKM */
static errval rf4100_prepare_disk(struct scsi_link *, int dummy, int speed);
@ -957,6 +958,31 @@ worm_sense_handler(struct scsi_xfer *xs)
return SCSIRET_CONTINUE;
}
static errval
worm_set_blksize(struct scsi_link *sc_link, int size)
{
struct scsi_mode_select scsi_cmd;
struct {
struct scsi_mode_header header;
struct blk_desc desc;
} dat;
bzero(&scsi_cmd, sizeof(scsi_cmd));
bzero(&dat, sizeof(dat));
scsi_cmd.op_code = MODE_SELECT;
scsi_cmd.length = sizeof(dat);
dat.header.blk_desc_len = sizeof(struct blk_desc);
scsi_uto3b(size, dat.desc.blklen);
return scsi_scsi_cmd(sc_link,
(struct scsi_generic *) &scsi_cmd,
sizeof(scsi_cmd),
(u_char *) &dat,
sizeof(dat),
/*WORM_RETRIES*/ 4,
5000,
NULL,
SCSI_DATA_OUT);
}
static void
worm_drvinit(void *unused)
{
@ -1230,12 +1256,9 @@ rf4100_finalize_track(struct scsi_link *sc_link)
60000, /* this may take a while */
NULL,
0);
if (!error) {
struct wormio_prepare_track t;
bzero (&t, sizeof (t));
t.track_type = BLOCK_MODE_1;
error = rf4100_prepare_track(sc_link, &t);
}
if (!error)
error = worm_set_blksize(sc_link, 2048);
return error;
}
@ -1532,12 +1555,9 @@ hp4020i_finalize_track(struct scsi_link *sc_link)
60000, /* this may take a while */
NULL,
0);
if (!error) {
struct wormio_prepare_track t;
bzero (&t, sizeof (t));
t.track_type = BLOCK_MODE_1;
error = hp4020i_prepare_track(sc_link, &t);
}
if (!error)
error = worm_set_blksize(sc_link, 2048);
return error;
}