fix incorrect length of LOCATE CDB (reported in PR kern/5306 by

Dave Huang <khym@bga.com>)
This commit is contained in:
drochner 1998-08-06 10:20:38 +00:00
parent 62cff0207c
commit e2a2525203
2 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi_tape.h,v 1.14 1998/02/13 08:28:43 enami Exp $ */ /* $NetBSD: scsi_tape.h,v 1.15 1998/08/06 10:20:38 drochner Exp $ */
/* /*
* Copyright (c) 1994 Charles Hannum. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved.
@ -210,6 +210,15 @@ struct scsi_tape_read_position {
}; };
#define LOCATE 0x2B #define LOCATE 0x2B
struct scsi_tape_locate {
u_int8_t opcode;
u_int8_t byte2;
u_int8_t reserved1;
u_int8_t blkaddr[4];
u_int8_t reserved2;
u_int8_t partition;
u_int8_t control;
};
/********************************************************************** /**********************************************************************
from the scsi2 spec from the scsi2 spec

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.97 1998/07/31 17:25:55 mjacob Exp $ */ /* $NetBSD: st.c,v 1.98 1998/08/06 10:20:39 drochner Exp $ */
/* /*
* Copyright (c) 1994 Charles Hannum. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved.
@ -2060,7 +2060,7 @@ st_setpos(st, hard, blkptr)
u_int32_t *blkptr; u_int32_t *blkptr;
{ {
int error; int error;
struct scsipi_generic cmd; struct scsi_tape_locate cmd;
/* /*
* First flush any pending writes. Strictly speaking, * First flush any pending writes. Strictly speaking,
@ -2080,9 +2080,10 @@ st_setpos(st, hard, blkptr)
bzero(&cmd, sizeof(cmd)); bzero(&cmd, sizeof(cmd));
cmd.opcode = LOCATE; cmd.opcode = LOCATE;
if (hard) if (hard)
cmd.bytes[0] = 1 << 2; cmd.byte2 = 1 << 2;
_lto4b(*blkptr, &cmd.bytes[2]); _lto4b(*blkptr, cmd.blkaddr);
error = scsipi_command(st->sc_link, &cmd, sizeof(cmd), error = scsipi_command(st->sc_link,
(struct scsipi_generic *)&cmd, sizeof(cmd),
NULL, 0, ST_RETRIES, ST_SPC_TIME, NULL, 0); NULL, 0, ST_RETRIES, ST_SPC_TIME, NULL, 0);
/* /*
* XXX: Note file && block number position now unknown (if * XXX: Note file && block number position now unknown (if