Date: Tue, 1 Sep 1998 16:58:55 -0700 (PDT) From: Matthew Dillon <dillon@backplane.com> To: committers@FreeBSD.ORG Subject: SCSI tape compression support patch Message-ID: <199809012358.QAA02648@apollo.backplane.com>
next in thread | raw e-mail | index | archive | help
Any SCSI experts want to check this diff for /usr/src/sys/scsi/st.c ?
(this particular diff is relative to FreeBSD-stable. If nobody finds
any problems with it, I would like to commit it for FreeBSD-current
w/ appropriate changes, if any, and also commit it for -stable).
We've been using this code on a -stable machine for months. It fixes
the 'comp' option to the mt program.
I also have sys/scsi/ch.c diffs to handle tape library barcoded volume
labels, but I think the author of the tape changer may already have
committed something of his own, so I need to do a little research first.
-Matt
Matthew Dillon Engineering, HiWay Technologies, Inc. & BEST Internet
Communications
<dillon@backplane.com> (Please include original email in any response)
*** LINK/st.c Mon May 11 20:02:38 1998
--- st.c Fri May 15 21:21:47 1998
***************
*** 81,87 ****
static errval st_write_filemarks __P((u_int32_t unit, int32_t number, u_int32_t flags));
static errval st_load __P((u_int32_t unit, u_int32_t type, u_int32_t flags));
static errval st_mode_select __P((u_int32_t unit, u_int32_t flags, \
! struct tape_pages *page, u_int32_t pagelen));
static errval st_comp __P((u_int32_t unit, u_int32_t mode));
static int32_t st_chkeod __P((u_int32_t unit, boolean position, int32_t *nmarks,
u_int32_t flags));
--- 81,87 ----
static errval st_write_filemarks __P((u_int32_t unit, int32_t number, u_int32_t flags));
static errval st_load __P((u_int32_t unit, u_int32_t type, u_int32_t flags));
static errval st_mode_select __P((u_int32_t unit, u_int32_t flags, \
! struct tape_pages *page, u_int32_t pagelen, u_int32_t byte2));
static errval st_comp __P((u_int32_t unit, u_int32_t mode));
static int32_t st_chkeod __P((u_int32_t unit, boolean position, int32_t *nmarks,
u_int32_t flags));
***************
*** 579,585 ****
return errno;
}
}
! if ( (errno = st_mode_select(unit, 0, NULL, 0)) ) {
printf("st%ld: Cannot set selected mode", unit);
return errno;
}
--- 579,585 ----
return errno;
}
}
! if ( (errno = st_mode_select(unit, 0, NULL, 0, 0)) ) {
printf("st%ld: Cannot set selected mode", unit);
return errno;
}
***************
*** 1148,1154 ****
* Check that the mode being asked for is aggreeable to the
* drive. If not, put it back the way it was.
*/
! if ( (errcode = st_mode_select(unit, 0, NULL, 0)) ) { /* put back as it was */
printf("st%ld: Cannot set selected mode", unit);
st->density = hold_density;
st->blksiz = hold_blksiz;
--- 1148,1154 ----
* Check that the mode being asked for is aggreeable to the
* drive. If not, put it back the way it was.
*/
! if ( (errcode = st_mode_select(unit, 0, NULL, 0, 0)) ) { /* put back as it was */
printf("st%ld: Cannot set selected mode", unit);
st->density = hold_density;
st->blksiz = hold_blksiz;
***************
*** 1371,1380 ****
* set it into the desire modes etc.
*/
static errval
! st_mode_select(unit, flags, page, pagelen)
u_int32_t unit, flags;
struct tape_pages *page;
u_int32_t pagelen;
{
u_int32_t dat_len;
struct scsi_mode_select scsi_cmd;
--- 1371,1381 ----
* set it into the desire modes etc.
*/
static errval
! st_mode_select(unit, flags, page, pagelen, byte2)
u_int32_t unit, flags;
struct tape_pages *page;
u_int32_t pagelen;
+ u_int32_t byte2;
{
u_int32_t dat_len;
struct scsi_mode_select scsi_cmd;
***************
*** 1407,1412 ****
--- 1408,1414 ----
bzero(&scsi_cmd, sizeof(scsi_cmd));
scsi_cmd.op_code = MODE_SELECT;
scsi_cmd.length = dat_len;
+ scsi_cmd.byte2 = (u_char)byte2;
dat.header.blk_desc_len = sizeof(struct blk_desc);
dat.header.dev_spec |= SMH_DSP_BUFF_MODE_ON;
dat.blk_desc.density = st->density;
***************
*** 1475,1481 ****
printf("st%ld: bad value for compression mode\n",unit);
return EINVAL;
}
! if ( (retval = st_mode_select(unit, 0, &page, pagesize)) )
{
printf("select returned an error of %d\n",retval);
return retval;
--- 1477,1489 ----
printf("st%ld: bad value for compression mode\n",unit);
return EINVAL;
}
!
! /*
! * send ST_PAGE_CONFIGURATION page as SCSI-II command because it
! * is a SCSI-II structure. This requires the PF bit (0x10) to be
! * set for byte2.
! */
! if ( (retval = st_mode_select(unit, 0, &page, pagesize, 0x10)) )
{
printf("select returned an error of %d\n",retval);
return retval;
***************
*** 1934,1940 ****
default:
readsiz = 1;
st->flags &= ~ST_FIXEDBLOCKS;
! } if ( (errno = st_mode_select(unit, 0, NULL, 0)) ) {
goto bad;
}
st_read(unit, buf, readsiz, SCSI_SILENT);
--- 1942,1948 ----
default:
readsiz = 1;
st->flags &= ~ST_FIXEDBLOCKS;
! } if ( (errno = st_mode_select(unit, 0, NULL, 0, 0)) ) {
goto bad;
}
st_read(unit, buf, readsiz, SCSI_SILENT);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809012358.QAA02648>
