scsi_sa.h

This commit is contained in:
Matt Jacob 2000-10-31 22:34:51 +00:00
parent 9629a4e92d
commit eab2467fc8
2 changed files with 40 additions and 15 deletions

View File

@ -344,6 +344,7 @@ static void sadone(struct cam_periph *periph,
union ccb *start_ccb);
static int saerror(union ccb *ccb, u_int32_t cam_flags,
u_int32_t sense_flags);
static int samarkswanted(struct cam_periph *);
static int sacheckeod(struct cam_periph *periph);
static int sagetparams(struct cam_periph *periph,
sa_params params_to_get,
@ -930,7 +931,12 @@ saioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p)
count = mt->mt_count;
switch (mt->mt_op) {
case MTWEOF: /* write an end-of-file marker */
/* XXXX: NEED TO CLEAR SA_TAPE_WRITTEN */
/*
* We don't need to clear the SA_FLAG_TAPE_WRITTEN
* flag because by keeping track of filemarks
* we have last written we know ehether or not
* we need to write more when we close the device.
*/
error = sawritefilemarks(periph, count, FALSE);
break;
case MTWSS: /* write a setmark */
@ -2167,6 +2173,28 @@ exit:
return (error);
}
/*
* How many filemarks do we need to write if we were to terminate the
* tape session right now? Note that this can be a negative number
*/
static int
samarkswanted(struct cam_periph *periph)
{
int markswanted;
struct sa_softc *softc;
softc = (struct sa_softc *)periph->softc;
markswanted = 0;
if ((softc->flags & SA_FLAG_TAPE_WRITTEN) != 0) {
markswanted++;
if (softc->quirks & SA_QUIRK_2FM)
markswanted++;
}
markswanted -= softc->filemarks;
return (markswanted);
}
static int
sacheckeod(struct cam_periph *periph)
{
@ -2175,16 +2203,9 @@ sacheckeod(struct cam_periph *periph)
struct sa_softc *softc;
softc = (struct sa_softc *)periph->softc;
markswanted = 0;
markswanted = samarkswanted(periph);
if ((softc->flags & SA_FLAG_TAPE_WRITTEN) != 0) {
markswanted++;
if (softc->quirks & SA_QUIRK_2FM)
markswanted++;
}
if (softc->filemarks < markswanted) {
markswanted -= softc->filemarks;
if (markswanted > 0) {
error = sawritefilemarks(periph, markswanted, FALSE);
} else {
error = 0;

View File

@ -170,7 +170,7 @@ struct scsi_erase
struct scsi_dev_conf_page {
u_int8_t pagecode; /* 0x10 */
u_int8_t pagelength; /* 0x0e */
u_int8_t byte2;
u_int8_t byte2; /* CAP, CAF, Active Format */
u_int8_t active_partition;
u_int8_t wb_full_ratio;
u_int8_t rb_empty_ratio;
@ -189,23 +189,27 @@ struct scsi_dev_conf_page {
u_int8_t sel_comp_alg;
#define SA_COMP_NONE 0x00
#define SA_COMP_DEFAULT 0x01
u_int8_t reserved;
/* the following is 'reserved' in SCSI-2 but is defined in SSC-r22 */
u_int8_t extra_wp;
#define SA_ASOC_WP 0x04 /* Associated Write Protect */
#define SA_PERS_WP 0x02 /* Persistent Write Protect */
#define SA_PERM_WP 0x01 /* Permanent Write Protect */
};
/* from SCSI-3: SSC-Rev10 (6/97) */
struct scsi_data_compression_page {
u_int8_t page_code; /* 0x0f */
u_int8_t page_length;
u_int8_t page_length; /* 0x0e */
u_int8_t dce_and_dcc;
#define SA_DCP_DCE 0x80 /* Data compression enable */
#define SA_DCP_DCC 0x40 /* Data compression capable */
u_int8_t dce_and_dcc;
u_int8_t dde_and_red;
#define SA_DCP_DDE 0x80 /* Data decompression enable */
#define SA_DCP_RED_MASK 0x60 /* Report Exception on Decomp. */
#define SA_DCP_RED_SHAMT 5
#define SA_DCP_RED_0 0x00
#define SA_DCP_RED_1 0x20
#define SA_DCP_RED_2 0x40
u_int8_t dde_and_red;
u_int8_t comp_algorithm[4];
u_int8_t decomp_algorithm[4];
u_int8_t reserved[4];