diff options
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r-- | drivers/scsi/st.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index a15f691f9d34..e41998cb098e 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -1105,6 +1105,12 @@ static int check_tape(struct scsi_tape *STp, struct file *filp) | |||
1105 | STp->drv_buffer)); | 1105 | STp->drv_buffer)); |
1106 | } | 1106 | } |
1107 | STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0; | 1107 | STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0; |
1108 | if (!STp->drv_buffer && STp->immediate_filemark) { | ||
1109 | printk(KERN_WARNING | ||
1110 | "%s: non-buffered tape: disabling writing immediate filemarks\n", | ||
1111 | name); | ||
1112 | STp->immediate_filemark = 0; | ||
1113 | } | ||
1108 | } | 1114 | } |
1109 | st_release_request(SRpnt); | 1115 | st_release_request(SRpnt); |
1110 | SRpnt = NULL; | 1116 | SRpnt = NULL; |
@@ -1313,6 +1319,8 @@ static int st_flush(struct file *filp, fl_owner_t id) | |||
1313 | 1319 | ||
1314 | memset(cmd, 0, MAX_COMMAND_SIZE); | 1320 | memset(cmd, 0, MAX_COMMAND_SIZE); |
1315 | cmd[0] = WRITE_FILEMARKS; | 1321 | cmd[0] = WRITE_FILEMARKS; |
1322 | if (STp->immediate_filemark) | ||
1323 | cmd[1] = 1; | ||
1316 | cmd[4] = 1 + STp->two_fm; | 1324 | cmd[4] = 1 + STp->two_fm; |
1317 | 1325 | ||
1318 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, | 1326 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, |
@@ -2180,8 +2188,9 @@ static void st_log_options(struct scsi_tape * STp, struct st_modedef * STm, char | |||
2180 | name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions, | 2188 | name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions, |
2181 | STp->scsi2_logical); | 2189 | STp->scsi2_logical); |
2182 | printk(KERN_INFO | 2190 | printk(KERN_INFO |
2183 | "%s: sysv: %d nowait: %d sili: %d\n", name, STm->sysv, STp->immediate, | 2191 | "%s: sysv: %d nowait: %d sili: %d nowait_filemark: %d\n", |
2184 | STp->sili); | 2192 | name, STm->sysv, STp->immediate, STp->sili, |
2193 | STp->immediate_filemark); | ||
2185 | printk(KERN_INFO "%s: debugging: %d\n", | 2194 | printk(KERN_INFO "%s: debugging: %d\n", |
2186 | name, debugging); | 2195 | name, debugging); |
2187 | } | 2196 | } |
@@ -2223,6 +2232,7 @@ static int st_set_options(struct scsi_tape *STp, long options) | |||
2223 | STp->can_partitions = (options & MT_ST_CAN_PARTITIONS) != 0; | 2232 | STp->can_partitions = (options & MT_ST_CAN_PARTITIONS) != 0; |
2224 | STp->scsi2_logical = (options & MT_ST_SCSI2LOGICAL) != 0; | 2233 | STp->scsi2_logical = (options & MT_ST_SCSI2LOGICAL) != 0; |
2225 | STp->immediate = (options & MT_ST_NOWAIT) != 0; | 2234 | STp->immediate = (options & MT_ST_NOWAIT) != 0; |
2235 | STp->immediate_filemark = (options & MT_ST_NOWAIT_EOF) != 0; | ||
2226 | STm->sysv = (options & MT_ST_SYSV) != 0; | 2236 | STm->sysv = (options & MT_ST_SYSV) != 0; |
2227 | STp->sili = (options & MT_ST_SILI) != 0; | 2237 | STp->sili = (options & MT_ST_SILI) != 0; |
2228 | DEB( debugging = (options & MT_ST_DEBUGGING) != 0; | 2238 | DEB( debugging = (options & MT_ST_DEBUGGING) != 0; |
@@ -2254,6 +2264,8 @@ static int st_set_options(struct scsi_tape *STp, long options) | |||
2254 | STp->scsi2_logical = value; | 2264 | STp->scsi2_logical = value; |
2255 | if ((options & MT_ST_NOWAIT) != 0) | 2265 | if ((options & MT_ST_NOWAIT) != 0) |
2256 | STp->immediate = value; | 2266 | STp->immediate = value; |
2267 | if ((options & MT_ST_NOWAIT_EOF) != 0) | ||
2268 | STp->immediate_filemark = value; | ||
2257 | if ((options & MT_ST_SYSV) != 0) | 2269 | if ((options & MT_ST_SYSV) != 0) |
2258 | STm->sysv = value; | 2270 | STm->sysv = value; |
2259 | if ((options & MT_ST_SILI) != 0) | 2271 | if ((options & MT_ST_SILI) != 0) |
@@ -2713,7 +2725,8 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2713 | cmd[0] = WRITE_FILEMARKS; | 2725 | cmd[0] = WRITE_FILEMARKS; |
2714 | if (cmd_in == MTWSM) | 2726 | if (cmd_in == MTWSM) |
2715 | cmd[1] = 2; | 2727 | cmd[1] = 2; |
2716 | if (cmd_in == MTWEOFI) | 2728 | if (cmd_in == MTWEOFI || |
2729 | (cmd_in == MTWEOF && STp->immediate_filemark)) | ||
2717 | cmd[1] |= 1; | 2730 | cmd[1] |= 1; |
2718 | cmd[2] = (arg >> 16); | 2731 | cmd[2] = (arg >> 16); |
2719 | cmd[3] = (arg >> 8); | 2732 | cmd[3] = (arg >> 8); |
@@ -4092,6 +4105,7 @@ static int st_probe(struct device *dev) | |||
4092 | tpnt->scsi2_logical = ST_SCSI2LOGICAL; | 4105 | tpnt->scsi2_logical = ST_SCSI2LOGICAL; |
4093 | tpnt->sili = ST_SILI; | 4106 | tpnt->sili = ST_SILI; |
4094 | tpnt->immediate = ST_NOWAIT; | 4107 | tpnt->immediate = ST_NOWAIT; |
4108 | tpnt->immediate_filemark = 0; | ||
4095 | tpnt->default_drvbuffer = 0xff; /* No forced buffering */ | 4109 | tpnt->default_drvbuffer = 0xff; /* No forced buffering */ |
4096 | tpnt->partition = 0; | 4110 | tpnt->partition = 0; |
4097 | tpnt->new_partition = 0; | 4111 | tpnt->new_partition = 0; |
@@ -4477,6 +4491,7 @@ st_options_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
4477 | options |= STp->scsi2_logical ? MT_ST_SCSI2LOGICAL : 0; | 4491 | options |= STp->scsi2_logical ? MT_ST_SCSI2LOGICAL : 0; |
4478 | options |= STm->sysv ? MT_ST_SYSV : 0; | 4492 | options |= STm->sysv ? MT_ST_SYSV : 0; |
4479 | options |= STp->immediate ? MT_ST_NOWAIT : 0; | 4493 | options |= STp->immediate ? MT_ST_NOWAIT : 0; |
4494 | options |= STp->immediate_filemark ? MT_ST_NOWAIT_EOF : 0; | ||
4480 | options |= STp->sili ? MT_ST_SILI : 0; | 4495 | options |= STp->sili ? MT_ST_SILI : 0; |
4481 | 4496 | ||
4482 | l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); | 4497 | l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); |