STp 1964 drivers/scsi/53c700.c NCR_700_set_period(struct scsi_target *STp, int period) STp 1966 drivers/scsi/53c700.c struct Scsi_Host *SHp = dev_to_shost(STp->dev.parent); STp 1976 drivers/scsi/53c700.c spi_period(STp) = period; STp 1977 drivers/scsi/53c700.c spi_flags(STp) &= ~(NCR_700_DEV_NEGOTIATED_SYNC | STp 1979 drivers/scsi/53c700.c spi_flags(STp) |= NCR_700_DEV_PRINT_SYNC_NEGOTIATION; STp 1983 drivers/scsi/53c700.c NCR_700_set_offset(struct scsi_target *STp, int offset) STp 1985 drivers/scsi/53c700.c struct Scsi_Host *SHp = dev_to_shost(STp->dev.parent); STp 1998 drivers/scsi/53c700.c if(spi_offset(STp) == 0 && (spi_period(STp) < hostdata->min_period || STp 1999 drivers/scsi/53c700.c spi_period(STp) > 0xff)) STp 2000 drivers/scsi/53c700.c spi_period(STp) = hostdata->min_period; STp 2002 drivers/scsi/53c700.c spi_offset(STp) = offset; STp 2003 drivers/scsi/53c700.c spi_flags(STp) &= ~(NCR_700_DEV_NEGOTIATED_SYNC | STp 2005 drivers/scsi/53c700.c spi_flags(STp) |= NCR_700_DEV_PRINT_SYNC_NEGOTIATION; STp 242 drivers/scsi/st.c struct scsi_tape *STp = NULL; STp 247 drivers/scsi/st.c STp = idr_find(&st_index_idr, dev); STp 248 drivers/scsi/st.c if (!STp) goto out; STp 250 drivers/scsi/st.c kref_get(&STp->kref); STp 252 drivers/scsi/st.c if (!STp->device) STp 255 drivers/scsi/st.c if (scsi_device_get(STp->device)) STp 261 drivers/scsi/st.c kref_put(&STp->kref, scsi_tape_release); STp 262 drivers/scsi/st.c STp = NULL; STp 266 drivers/scsi/st.c return STp; STp 269 drivers/scsi/st.c static void scsi_tape_put(struct scsi_tape *STp) STp 271 drivers/scsi/st.c struct scsi_device *sdev = STp->device; STp 274 drivers/scsi/st.c kref_put(&STp->kref, scsi_tape_release); STp 359 drivers/scsi/st.c static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) STp 364 drivers/scsi/st.c char *name = tape_name(STp); STp 370 drivers/scsi/st.c cmdstatp = &STp->buffer->cmdstat; STp 374 drivers/scsi/st.c scode = STp->buffer->cmdstat.sense_hdr.sense_key; STp 380 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 385 drivers/scsi/st.c __scsi_print_sense(STp->device, name, STp 390 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 402 drivers/scsi/st.c __scsi_print_sense(STp->device, name, STp 408 drivers/scsi/st.c STp->cln_mode >= EXTENDED_SENSE_START) { /* Only fixed format sense */ STp 409 drivers/scsi/st.c if (STp->cln_sense_value) STp 410 drivers/scsi/st.c STp->cleaning_req |= ((SRpnt->sense[STp->cln_mode] & STp 411 drivers/scsi/st.c STp->cln_sense_mask) == STp->cln_sense_value); STp 413 drivers/scsi/st.c STp->cleaning_req |= ((SRpnt->sense[STp->cln_mode] & STp 414 drivers/scsi/st.c STp->cln_sense_mask) != 0); STp 418 drivers/scsi/st.c STp->cleaning_req = 1; /* ASC and ASCQ => cleaning requested */ STp 420 drivers/scsi/st.c STp->pos_unknown |= STp->device->was_reset; STp 429 drivers/scsi/st.c STp->recover_count++; STp 430 drivers/scsi/st.c STp->recover_reg++; STp 440 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 442 drivers/scsi/st.c stp, STp->recover_count); STp 475 drivers/scsi/st.c static void st_do_stats(struct scsi_tape *STp, struct request *req) STp 481 drivers/scsi/st.c now = ktime_sub(now, STp->stats->write_time); STp 482 drivers/scsi/st.c atomic64_add(ktime_to_ns(now), &STp->stats->tot_write_time); STp 483 drivers/scsi/st.c atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); STp 484 drivers/scsi/st.c atomic64_inc(&STp->stats->write_cnt); STp 486 drivers/scsi/st.c atomic64_add(atomic_read(&STp->stats->last_write_size) STp 487 drivers/scsi/st.c - STp->buffer->cmdstat.residual, STp 488 drivers/scsi/st.c &STp->stats->write_byte_cnt); STp 489 drivers/scsi/st.c if (STp->buffer->cmdstat.residual > 0) STp 490 drivers/scsi/st.c atomic64_inc(&STp->stats->resid_cnt); STp 492 drivers/scsi/st.c atomic64_add(atomic_read(&STp->stats->last_write_size), STp 493 drivers/scsi/st.c &STp->stats->write_byte_cnt); STp 495 drivers/scsi/st.c now = ktime_sub(now, STp->stats->read_time); STp 496 drivers/scsi/st.c atomic64_add(ktime_to_ns(now), &STp->stats->tot_read_time); STp 497 drivers/scsi/st.c atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); STp 498 drivers/scsi/st.c atomic64_inc(&STp->stats->read_cnt); STp 500 drivers/scsi/st.c atomic64_add(atomic_read(&STp->stats->last_read_size) STp 501 drivers/scsi/st.c - STp->buffer->cmdstat.residual, STp 502 drivers/scsi/st.c &STp->stats->read_byte_cnt); STp 503 drivers/scsi/st.c if (STp->buffer->cmdstat.residual > 0) STp 504 drivers/scsi/st.c atomic64_inc(&STp->stats->resid_cnt); STp 506 drivers/scsi/st.c atomic64_add(atomic_read(&STp->stats->last_read_size), STp 507 drivers/scsi/st.c &STp->stats->read_byte_cnt); STp 509 drivers/scsi/st.c now = ktime_sub(now, STp->stats->other_time); STp 510 drivers/scsi/st.c atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); STp 511 drivers/scsi/st.c atomic64_inc(&STp->stats->other_cnt); STp 513 drivers/scsi/st.c atomic64_dec(&STp->stats->in_flight); STp 520 drivers/scsi/st.c struct scsi_tape *STp = SRpnt->stp; STp 523 drivers/scsi/st.c STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result; STp 524 drivers/scsi/st.c STp->buffer->cmdstat.residual = rq->resid_len; STp 526 drivers/scsi/st.c st_do_stats(STp, req); STp 546 drivers/scsi/st.c struct scsi_tape *STp = SRpnt->stp; STp 567 drivers/scsi/st.c atomic64_inc(&STp->stats->in_flight); STp 569 drivers/scsi/st.c atomic_set(&STp->stats->last_write_size, bufflen); STp 570 drivers/scsi/st.c STp->stats->write_time = ktime_get(); STp 572 drivers/scsi/st.c atomic_set(&STp->stats->last_read_size, bufflen); STp 573 drivers/scsi/st.c STp->stats->read_time = ktime_get(); STp 575 drivers/scsi/st.c STp->stats->other_time = ktime_get(); STp 594 drivers/scsi/st.c st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd, STp 598 drivers/scsi/st.c struct rq_map_data *mdata = &STp->buffer->map_data; STp 602 drivers/scsi/st.c if (!do_wait && ((STp->buffer)->last_SRpnt)) { STp 603 drivers/scsi/st.c st_printk(KERN_ERR, STp, STp 606 drivers/scsi/st.c (STp->buffer)->syscall_result = (-EINTR); STp 608 drivers/scsi/st.c (STp->buffer)->syscall_result = (-EBUSY); STp 613 drivers/scsi/st.c SRpnt = st_allocate_request(STp); STp 621 drivers/scsi/st.c (STp->buffer)->last_SRpnt = SRpnt; STp 623 drivers/scsi/st.c waiting = &STp->wait; STp 627 drivers/scsi/st.c if (STp->buffer->do_dio) { STp 629 drivers/scsi/st.c mdata->nr_entries = STp->buffer->sg_segs; STp 630 drivers/scsi/st.c mdata->pages = STp->buffer->mapped_pages; STp 632 drivers/scsi/st.c mdata->page_order = STp->buffer->reserved_page_order; STp 635 drivers/scsi/st.c mdata->pages = STp->buffer->reserved_pages; STp 640 drivers/scsi/st.c STp->buffer->cmdstat.have_sense = 0; STp 641 drivers/scsi/st.c STp->buffer->syscall_result = 0; STp 647 drivers/scsi/st.c (STp->buffer)->syscall_result = (-EBUSY); STp 648 drivers/scsi/st.c (STp->buffer)->last_SRpnt = NULL; STp 652 drivers/scsi/st.c (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt); STp 663 drivers/scsi/st.c static int write_behind_check(struct scsi_tape * STp) STp 671 drivers/scsi/st.c STbuffer = STp->buffer; STp 676 drivers/scsi/st.c if (STp->write_pending) STp 677 drivers/scsi/st.c STp->nbr_waits++; STp 679 drivers/scsi/st.c STp->nbr_finished++; STp 682 drivers/scsi/st.c wait_for_completion(&(STp->wait)); STp 687 drivers/scsi/st.c (STp->buffer)->syscall_result = st_chk_result(STp, SRpnt); STp 691 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 693 drivers/scsi/st.c if (STp->block_size == 0) STp 696 drivers/scsi/st.c STps->drv_block += STbuffer->writing / STp->block_size; STp 717 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 727 drivers/scsi/st.c static int cross_eof(struct scsi_tape * STp, int forward) STp 741 drivers/scsi/st.c DEBC_printk(STp, "Stepping over filemark %s.\n", STp 744 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, STp 745 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 748 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 753 drivers/scsi/st.c if ((STp->buffer)->cmdstat.midlevel_result != 0) STp 754 drivers/scsi/st.c st_printk(KERN_ERR, STp, STp 758 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 763 drivers/scsi/st.c static int st_flush_write_buffer(struct scsi_tape * STp) STp 771 drivers/scsi/st.c result = write_behind_check(STp); STp 776 drivers/scsi/st.c if (STp->dirty == 1) { STp 778 drivers/scsi/st.c transfer = STp->buffer->buffer_bytes; STp 779 drivers/scsi/st.c DEBC_printk(STp, "Flushing %d bytes.\n", transfer); STp 784 drivers/scsi/st.c blks = transfer / STp->block_size; STp 789 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, transfer, DMA_TO_DEVICE, STp 790 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 793 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 795 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 796 drivers/scsi/st.c if ((STp->buffer)->syscall_result != 0) { STp 797 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 805 drivers/scsi/st.c STp->dirty = 0; STp 806 drivers/scsi/st.c (STp->buffer)->buffer_bytes = 0; STp 811 drivers/scsi/st.c st_printk(KERN_ERR, STp, "Error on flush.\n"); STp 818 drivers/scsi/st.c STp->dirty = 0; STp 819 drivers/scsi/st.c (STp->buffer)->buffer_bytes = 0; STp 830 drivers/scsi/st.c static int flush_buffer(struct scsi_tape *STp, int seek_next) STp 839 drivers/scsi/st.c if (STp->pos_unknown) STp 842 drivers/scsi/st.c if (STp->ready != ST_READY) STp 844 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 846 drivers/scsi/st.c return st_flush_write_buffer(STp); STp 848 drivers/scsi/st.c if (STp->block_size == 0) STp 851 drivers/scsi/st.c backspace = ((STp->buffer)->buffer_bytes + STp 852 drivers/scsi/st.c (STp->buffer)->read_pointer) / STp->block_size - STp 853 drivers/scsi/st.c ((STp->buffer)->read_pointer + STp->block_size - 1) / STp 854 drivers/scsi/st.c STp->block_size; STp 855 drivers/scsi/st.c (STp->buffer)->buffer_bytes = 0; STp 856 drivers/scsi/st.c (STp->buffer)->read_pointer = 0; STp 860 drivers/scsi/st.c result = cross_eof(STp, 0); /* Back over the EOF hit */ STp 870 drivers/scsi/st.c result = st_int_ioctl(STp, MTBSR, backspace); STp 882 drivers/scsi/st.c static int set_mode_densblk(struct scsi_tape * STp, struct st_modedef * STm) STp 887 drivers/scsi/st.c if (!STp->density_changed && STp 889 drivers/scsi/st.c STm->default_density != STp->density) { STp 893 drivers/scsi/st.c arg = STp->density; STp 895 drivers/scsi/st.c if (!STp->blksize_changed && STp 897 drivers/scsi/st.c STm->default_blksize != STp->block_size) { STp 901 drivers/scsi/st.c arg |= STp->block_size; STp 903 drivers/scsi/st.c st_int_ioctl(STp, SET_DENS_AND_BLK, arg)) { STp 904 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 916 drivers/scsi/st.c static int do_door_lock(struct scsi_tape * STp, int do_lock) STp 920 drivers/scsi/st.c DEBC_printk(STp, "%socking drive door.\n", do_lock ? "L" : "Unl"); STp 922 drivers/scsi/st.c retval = scsi_set_medium_removal(STp->device, STp 925 drivers/scsi/st.c STp->door_locked = do_lock ? ST_LOCKED_EXPLICIT : ST_UNLOCKED; STp 927 drivers/scsi/st.c STp->door_locked = ST_LOCK_FAILS; STp 933 drivers/scsi/st.c static void reset_state(struct scsi_tape *STp) STp 938 drivers/scsi/st.c STp->pos_unknown = 0; STp 940 drivers/scsi/st.c STps = &(STp->ps[i]); STp 948 drivers/scsi/st.c if (STp->can_partitions) { STp 949 drivers/scsi/st.c STp->partition = find_partition(STp); STp 950 drivers/scsi/st.c if (STp->partition < 0) STp 951 drivers/scsi/st.c STp->partition = 0; STp 952 drivers/scsi/st.c STp->new_partition = STp->partition; STp 965 drivers/scsi/st.c static int test_ready(struct scsi_tape *STp, int do_wait) STp 971 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 978 drivers/scsi/st.c SRpnt = st_do_scsi(SRpnt, STp, cmd, 0, DMA_NONE, STp 979 drivers/scsi/st.c STp->long_timeout, MAX_READY_RETRIES, 1); STp 982 drivers/scsi/st.c retval = (STp->buffer)->syscall_result; STp 1012 drivers/scsi/st.c if ((STp->device)->scsi_level >= SCSI_2 && STp 1022 drivers/scsi/st.c retval = (STp->buffer)->syscall_result; STp 1039 drivers/scsi/st.c static int check_tape(struct scsi_tape *STp, struct file *filp) STp 1050 drivers/scsi/st.c STp->ready = ST_READY; STp 1052 drivers/scsi/st.c if (mode != STp->current_mode) { STp 1053 drivers/scsi/st.c DEBC_printk(STp, "Mode change from %d to %d.\n", STp 1054 drivers/scsi/st.c STp->current_mode, mode); STp 1056 drivers/scsi/st.c STp->current_mode = mode; STp 1058 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 1060 drivers/scsi/st.c saved_cleaning = STp->cleaning_req; STp 1061 drivers/scsi/st.c STp->cleaning_req = 0; STp 1064 drivers/scsi/st.c retval = test_ready(STp, do_wait); STp 1070 drivers/scsi/st.c STp->pos_unknown = 0; STp 1071 drivers/scsi/st.c STp->partition = STp->new_partition = 0; STp 1072 drivers/scsi/st.c if (STp->can_partitions) STp 1073 drivers/scsi/st.c STp->nbr_partitions = 1; /* This guess will be updated later STp 1076 drivers/scsi/st.c STps = &(STp->ps[i]); STp 1087 drivers/scsi/st.c STp->cleaning_req |= saved_cleaning; STp 1091 drivers/scsi/st.c STp->ready = ST_NO_TAPE; STp 1093 drivers/scsi/st.c STp->ready = ST_NOT_READY; STp 1095 drivers/scsi/st.c STp->density = 0; /* Clear the erroneous "residue" */ STp 1096 drivers/scsi/st.c STp->write_prot = 0; STp 1097 drivers/scsi/st.c STp->block_size = 0; STp 1098 drivers/scsi/st.c STp->ps[0].drv_file = STp->ps[0].drv_block = (-1); STp 1099 drivers/scsi/st.c STp->partition = STp->new_partition = 0; STp 1100 drivers/scsi/st.c STp->door_locked = ST_UNLOCKED; STp 1105 drivers/scsi/st.c if (STp->omit_blklims) STp 1106 drivers/scsi/st.c STp->min_block = STp->max_block = (-1); STp 1111 drivers/scsi/st.c SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE, STp 1112 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 1115 drivers/scsi/st.c retval = (STp->buffer)->syscall_result; STp 1119 drivers/scsi/st.c if (!SRpnt->result && !STp->buffer->cmdstat.have_sense) { STp 1120 drivers/scsi/st.c STp->max_block = ((STp->buffer)->b_data[1] << 16) | STp 1121 drivers/scsi/st.c ((STp->buffer)->b_data[2] << 8) | (STp->buffer)->b_data[3]; STp 1122 drivers/scsi/st.c STp->min_block = ((STp->buffer)->b_data[4] << 8) | STp 1123 drivers/scsi/st.c (STp->buffer)->b_data[5]; STp 1124 drivers/scsi/st.c if ( DEB( debugging || ) !STp->inited) STp 1125 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 1127 drivers/scsi/st.c STp->min_block, STp->max_block); STp 1129 drivers/scsi/st.c STp->min_block = STp->max_block = (-1); STp 1130 drivers/scsi/st.c DEBC_printk(STp, "Can't read block limits.\n"); STp 1138 drivers/scsi/st.c SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, DMA_FROM_DEVICE, STp 1139 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 1142 drivers/scsi/st.c retval = (STp->buffer)->syscall_result; STp 1146 drivers/scsi/st.c if ((STp->buffer)->syscall_result != 0) { STp 1147 drivers/scsi/st.c DEBC_printk(STp, "No Mode Sense.\n"); STp 1148 drivers/scsi/st.c STp->block_size = ST_DEFAULT_BLOCK; /* Educated guess (?) */ STp 1149 drivers/scsi/st.c (STp->buffer)->syscall_result = 0; /* Prevent error propagation */ STp 1150 drivers/scsi/st.c STp->drv_write_prot = 0; STp 1152 drivers/scsi/st.c DEBC_printk(STp,"Mode sense. Length %d, " STp 1154 drivers/scsi/st.c (STp->buffer)->b_data[0], STp 1155 drivers/scsi/st.c (STp->buffer)->b_data[1], STp 1156 drivers/scsi/st.c (STp->buffer)->b_data[2], STp 1157 drivers/scsi/st.c (STp->buffer)->b_data[3]); STp 1159 drivers/scsi/st.c if ((STp->buffer)->b_data[3] >= 8) { STp 1160 drivers/scsi/st.c STp->drv_buffer = ((STp->buffer)->b_data[2] >> 4) & 7; STp 1161 drivers/scsi/st.c STp->density = (STp->buffer)->b_data[4]; STp 1162 drivers/scsi/st.c STp->block_size = (STp->buffer)->b_data[9] * 65536 + STp 1163 drivers/scsi/st.c (STp->buffer)->b_data[10] * 256 + (STp->buffer)->b_data[11]; STp 1164 drivers/scsi/st.c DEBC_printk(STp, "Density %x, tape length: %x, " STp 1166 drivers/scsi/st.c STp->density, STp 1167 drivers/scsi/st.c (STp->buffer)->b_data[5] * 65536 + STp 1168 drivers/scsi/st.c (STp->buffer)->b_data[6] * 256 + STp 1169 drivers/scsi/st.c (STp->buffer)->b_data[7], STp 1170 drivers/scsi/st.c STp->drv_buffer); STp 1172 drivers/scsi/st.c STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0; STp 1173 drivers/scsi/st.c if (!STp->drv_buffer && STp->immediate_filemark) { STp 1174 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1177 drivers/scsi/st.c STp->immediate_filemark = 0; STp 1182 drivers/scsi/st.c STp->inited = 1; STp 1184 drivers/scsi/st.c if (STp->block_size > 0) STp 1185 drivers/scsi/st.c (STp->buffer)->buffer_blocks = STp 1186 drivers/scsi/st.c (STp->buffer)->buffer_size / STp->block_size; STp 1188 drivers/scsi/st.c (STp->buffer)->buffer_blocks = 1; STp 1189 drivers/scsi/st.c (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0; STp 1191 drivers/scsi/st.c DEBC_printk(STp, "Block size: %d, buffer size: %d (%d blocks).\n", STp 1192 drivers/scsi/st.c STp->block_size, (STp->buffer)->buffer_size, STp 1193 drivers/scsi/st.c (STp->buffer)->buffer_blocks); STp 1195 drivers/scsi/st.c if (STp->drv_write_prot) { STp 1196 drivers/scsi/st.c STp->write_prot = 1; STp 1198 drivers/scsi/st.c DEBC_printk(STp, "Write protected\n"); STp 1208 drivers/scsi/st.c if (STp->can_partitions && STp->nbr_partitions < 1) { STp 1212 drivers/scsi/st.c DEBC_printk(STp, "Updating partition number in status.\n"); STp 1213 drivers/scsi/st.c if ((STp->partition = find_partition(STp)) < 0) { STp 1214 drivers/scsi/st.c retval = STp->partition; STp 1217 drivers/scsi/st.c STp->new_partition = STp->partition; STp 1218 drivers/scsi/st.c STp->nbr_partitions = 1; /* This guess will be updated when necessary */ STp 1222 drivers/scsi/st.c STp->density_changed = STp->blksize_changed = 0; STp 1223 drivers/scsi/st.c STp->compression_changed = 0; STp 1225 drivers/scsi/st.c (retval = set_mode_densblk(STp, STm)) < 0) STp 1228 drivers/scsi/st.c if (STp->default_drvbuffer != 0xff) { STp 1229 drivers/scsi/st.c if (st_int_ioctl(STp, MTSETDRVBUFFER, STp->default_drvbuffer)) STp 1230 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1233 drivers/scsi/st.c STp->default_drvbuffer); STp 1250 drivers/scsi/st.c struct scsi_tape *STp; STp 1261 drivers/scsi/st.c if (!(STp = scsi_tape_get(dev))) { STp 1265 drivers/scsi/st.c filp->private_data = STp; STp 1268 drivers/scsi/st.c if (STp->in_use) { STp 1270 drivers/scsi/st.c scsi_tape_put(STp); STp 1271 drivers/scsi/st.c DEBC_printk(STp, "Device already in use.\n"); STp 1275 drivers/scsi/st.c STp->in_use = 1; STp 1277 drivers/scsi/st.c STp->rew_at_close = STp->autorew_dev = (iminor(inode) & 0x80) == 0; STp 1279 drivers/scsi/st.c if (scsi_autopm_get_device(STp->device) < 0) { STp 1284 drivers/scsi/st.c if (!scsi_block_when_processing_errors(STp->device)) { STp 1290 drivers/scsi/st.c if (!enlarge_buffer(STp->buffer, PAGE_SIZE, STp->restr_dma)) { STp 1291 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1297 drivers/scsi/st.c (STp->buffer)->cleared = 0; STp 1298 drivers/scsi/st.c (STp->buffer)->writing = 0; STp 1299 drivers/scsi/st.c (STp->buffer)->syscall_result = 0; STp 1301 drivers/scsi/st.c STp->write_prot = ((filp->f_flags & O_ACCMODE) == O_RDONLY); STp 1303 drivers/scsi/st.c STp->dirty = 0; STp 1305 drivers/scsi/st.c STps = &(STp->ps[i]); STp 1308 drivers/scsi/st.c STp->try_dio_now = STp->try_dio; STp 1309 drivers/scsi/st.c STp->recover_count = 0; STp 1310 drivers/scsi/st.c DEB( STp->nbr_waits = STp->nbr_finished = 0; STp 1311 drivers/scsi/st.c STp->nbr_requests = STp->nbr_dio = STp->nbr_pages = 0; ) STp 1313 drivers/scsi/st.c retval = check_tape(STp, filp); STp 1318 drivers/scsi/st.c if (STp->ready == NO_TAPE) STp 1327 drivers/scsi/st.c normalize_buffer(STp->buffer); STp 1329 drivers/scsi/st.c STp->in_use = 0; STp 1332 drivers/scsi/st.c scsi_autopm_put_device(STp->device); STp 1333 drivers/scsi/st.c scsi_tape_put(STp); STp 1345 drivers/scsi/st.c struct scsi_tape *STp = filp->private_data; STp 1346 drivers/scsi/st.c struct st_modedef *STm = &(STp->modes[STp->current_mode]); STp 1347 drivers/scsi/st.c struct st_partstat *STps = &(STp->ps[STp->partition]); STp 1352 drivers/scsi/st.c if (STps->rw == ST_WRITING && !STp->pos_unknown) { STp 1353 drivers/scsi/st.c result = st_flush_write_buffer(STp); STp 1358 drivers/scsi/st.c if (STp->can_partitions && STp 1359 drivers/scsi/st.c (result2 = switch_partition(STp)) < 0) { STp 1360 drivers/scsi/st.c DEBC_printk(STp, "switch_partition at close failed.\n"); STp 1366 drivers/scsi/st.c DEBC( if (STp->nbr_requests) STp 1367 drivers/scsi/st.c st_printk(KERN_DEBUG, STp, STp 1369 drivers/scsi/st.c "pages %d.\n", STp->nbr_requests, STp->nbr_dio, STp 1370 drivers/scsi/st.c STp->nbr_pages)); STp 1372 drivers/scsi/st.c if (STps->rw == ST_WRITING && !STp->pos_unknown) { STp 1373 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 1376 drivers/scsi/st.c DEBC_printk(STp, "Async write waits %d, finished %d.\n", STp 1377 drivers/scsi/st.c STp->nbr_waits, STp->nbr_finished); STp 1381 drivers/scsi/st.c if (STp->immediate_filemark) STp 1383 drivers/scsi/st.c cmd[4] = 1 + STp->two_fm; STp 1385 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, STp 1386 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 1389 drivers/scsi/st.c result = (STp->buffer)->syscall_result; STp 1393 drivers/scsi/st.c if (STp->buffer->syscall_result == 0 || STp 1405 drivers/scsi/st.c if (STp->two_fm) STp 1406 drivers/scsi/st.c cross_eof(STp, 0); STp 1412 drivers/scsi/st.c st_printk(KERN_ERR, STp, STp 1418 drivers/scsi/st.c DEBC_printk(STp, "Buffer flushed, %d EOF(s) written\n", cmd[4]); STp 1419 drivers/scsi/st.c } else if (!STp->rew_at_close) { STp 1420 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 1422 drivers/scsi/st.c if (STp->can_bsr) STp 1423 drivers/scsi/st.c result = flush_buffer(STp, 0); STp 1425 drivers/scsi/st.c result = cross_eof(STp, 0); STp 1435 drivers/scsi/st.c !(result = cross_eof(STp, 1))) || STp 1445 drivers/scsi/st.c if (STp->rew_at_close) { STp 1446 drivers/scsi/st.c result2 = st_int_ioctl(STp, MTREW, 1); STp 1459 drivers/scsi/st.c struct scsi_tape *STp = filp->private_data; STp 1461 drivers/scsi/st.c if (STp->door_locked == ST_LOCKED_AUTO) STp 1462 drivers/scsi/st.c do_door_lock(STp, 0); STp 1464 drivers/scsi/st.c normalize_buffer(STp->buffer); STp 1466 drivers/scsi/st.c STp->in_use = 0; STp 1468 drivers/scsi/st.c scsi_autopm_put_device(STp->device); STp 1469 drivers/scsi/st.c scsi_tape_put(STp); STp 1475 drivers/scsi/st.c static ssize_t rw_checks(struct scsi_tape *STp, struct file *filp, size_t count) STp 1485 drivers/scsi/st.c if (!scsi_block_when_processing_errors(STp->device)) { STp 1490 drivers/scsi/st.c if (STp->ready != ST_READY) { STp 1491 drivers/scsi/st.c if (STp->ready == ST_NO_TAPE) STp 1498 drivers/scsi/st.c if (! STp->modes[STp->current_mode].defined) { STp 1508 drivers/scsi/st.c if (STp->pos_unknown) { STp 1517 drivers/scsi/st.c if (!STp->in_use) { STp 1518 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 1524 drivers/scsi/st.c if (STp->can_partitions && STp 1525 drivers/scsi/st.c (retval = switch_partition(STp)) < 0) STp 1528 drivers/scsi/st.c if (STp->block_size == 0 && STp->max_block > 0 && STp 1529 drivers/scsi/st.c (count < STp->min_block || count > STp->max_block)) { STp 1534 drivers/scsi/st.c if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && STp 1535 drivers/scsi/st.c !do_door_lock(STp, 1)) STp 1536 drivers/scsi/st.c STp->door_locked = ST_LOCKED_AUTO; STp 1543 drivers/scsi/st.c static int setup_buffering(struct scsi_tape *STp, const char __user *buf, STp 1547 drivers/scsi/st.c struct st_buffer *STbp = STp->buffer; STp 1550 drivers/scsi/st.c i = STp->try_dio_now && try_rdio; STp 1552 drivers/scsi/st.c i = STp->try_dio_now && try_wdio; STp 1555 drivers/scsi/st.c STp->device->request_queue)) == 0) { STp 1567 drivers/scsi/st.c STp->nbr_dio++; STp 1568 drivers/scsi/st.c STp->nbr_pages += STbp->do_dio; STp 1573 drivers/scsi/st.c DEB( STp->nbr_requests++; ) STp 1576 drivers/scsi/st.c if (STp->block_size) STp 1577 drivers/scsi/st.c bufsize = STp->block_size > st_fixed_buffer_size ? STp 1578 drivers/scsi/st.c STp->block_size : st_fixed_buffer_size; STp 1583 drivers/scsi/st.c if (is_read && STp->sili && !STbp->cleared) STp 1588 drivers/scsi/st.c !enlarge_buffer(STbp, bufsize, STp->restr_dma)) { STp 1589 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1595 drivers/scsi/st.c if (STp->block_size) STp 1596 drivers/scsi/st.c STbp->buffer_blocks = bufsize / STp->block_size; STp 1605 drivers/scsi/st.c static void release_buffering(struct scsi_tape *STp, int is_read) STp 1609 drivers/scsi/st.c STbp = STp->buffer; STp 1630 drivers/scsi/st.c struct scsi_tape *STp = filp->private_data; STp 1635 drivers/scsi/st.c if (mutex_lock_interruptible(&STp->lock)) STp 1638 drivers/scsi/st.c retval = rw_checks(STp, filp, count); STp 1643 drivers/scsi/st.c if (STp->block_size != 0 && (count % STp->block_size) != 0) { STp 1644 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1650 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 1651 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 1653 drivers/scsi/st.c if (STp->write_prot) { STp 1660 drivers/scsi/st.c retval = flush_buffer(STp, 0); STp 1666 drivers/scsi/st.c if ((retval = set_mode_densblk(STp, STm)) < 0) STp 1669 drivers/scsi/st.c !(STp->compression_changed)) { STp 1670 drivers/scsi/st.c if (st_compression(STp, (STm->default_compression == ST_YES))) { STp 1671 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 1681 drivers/scsi/st.c STbp = STp->buffer; STp 1682 drivers/scsi/st.c i = write_behind_check(STp); STp 1702 drivers/scsi/st.c if (STp->block_size != 0 && STp 1710 drivers/scsi/st.c retval = setup_buffering(STp, buf, count, 0); STp 1718 drivers/scsi/st.c cmd[1] = (STp->block_size != 0); STp 1729 drivers/scsi/st.c if (STp->block_size == 0) STp 1732 drivers/scsi/st.c do_count = STbp->buffer_blocks * STp->block_size - STp 1747 drivers/scsi/st.c async_write = STp->block_size == 0 && !STbp->do_dio && STp 1750 drivers/scsi/st.c if (STp->block_size != 0 && STm->do_buffer_writes && STp 1751 drivers/scsi/st.c !(STp->try_dio_now && try_wdio) && STps->eof < ST_EOM_OK && STp 1753 drivers/scsi/st.c STp->dirty = 1; STp 1760 drivers/scsi/st.c if (STp->block_size == 0) STp 1767 drivers/scsi/st.c blks /= STp->block_size; STp 1768 drivers/scsi/st.c transfer = blks * STp->block_size; STp 1774 drivers/scsi/st.c SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, DMA_TO_DEVICE, STp 1775 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 1783 drivers/scsi/st.c STp->dirty = !(STbp->writing == STp 1786 drivers/scsi/st.c DEB( STp->write_pending = 1; ) STp 1791 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 1793 drivers/scsi/st.c DEBC_printk(STp, "Error on write:\n"); STp 1798 drivers/scsi/st.c else if (STp->block_size == 0 && STp 1803 drivers/scsi/st.c if (STp->block_size != 0) STp 1804 drivers/scsi/st.c undone *= STp->block_size; STp 1810 drivers/scsi/st.c if (STp->block_size) STp 1811 drivers/scsi/st.c blks = (transfer - undone) / STp->block_size; STp 1817 drivers/scsi/st.c if (STp->block_size == 0 || STp 1820 drivers/scsi/st.c DEBC_printk(STp, "EOM with %d " STp 1828 drivers/scsi/st.c move_buffer_data(STp->buffer, transfer - undone); STp 1832 drivers/scsi/st.c STp->block_size; STp 1835 drivers/scsi/st.c DEBC_printk(STp, "Retry " STp 1838 drivers/scsi/st.c STp->buffer->buffer_bytes); STp 1849 drivers/scsi/st.c DEBC_printk(STp, "EOM with " STp 1862 drivers/scsi/st.c if (STp->block_size == 0) STp 1869 drivers/scsi/st.c STp->dirty = 0; STp 1887 drivers/scsi/st.c release_buffering(STp, 0); STp 1888 drivers/scsi/st.c mutex_unlock(&STp->lock); STp 1899 drivers/scsi/st.c static long read_tape(struct scsi_tape *STp, long count, STp 1913 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 1914 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 1917 drivers/scsi/st.c STbp = STp->buffer; STp 1919 drivers/scsi/st.c if (STp->block_size == 0) STp 1922 drivers/scsi/st.c if (!(STp->try_dio_now && try_rdio) && STm->do_read_ahead) { STp 1923 drivers/scsi/st.c blks = (STp->buffer)->buffer_blocks; STp 1924 drivers/scsi/st.c bytes = blks * STp->block_size; STp 1927 drivers/scsi/st.c if (!STbp->do_dio && bytes > (STp->buffer)->buffer_size) STp 1928 drivers/scsi/st.c bytes = (STp->buffer)->buffer_size; STp 1929 drivers/scsi/st.c blks = bytes / STp->block_size; STp 1930 drivers/scsi/st.c bytes = blks * STp->block_size; STp 1936 drivers/scsi/st.c cmd[1] = (STp->block_size != 0); STp 1937 drivers/scsi/st.c if (!cmd[1] && STp->sili) STp 1944 drivers/scsi/st.c SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, DMA_FROM_DEVICE, STp 1945 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 1947 drivers/scsi/st.c release_buffering(STp, 1); STp 1957 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 1960 drivers/scsi/st.c DEBC_printk(STp, STp 1978 drivers/scsi/st.c if (STp->block_size == 0) STp 1985 drivers/scsi/st.c if (STp->block_size == 0 && STp 1987 drivers/scsi/st.c st_printk(KERN_NOTICE, STp, STp 1997 drivers/scsi/st.c } else if (STp->block_size == 0) { STp 2003 drivers/scsi/st.c st_printk(KERN_NOTICE, STp, STp 2008 drivers/scsi/st.c st_int_ioctl(STp, MTBSR, 1); STp 2013 drivers/scsi/st.c STp->block_size; STp 2014 drivers/scsi/st.c DEBC_printk(STp, "ILI but " STp 2021 drivers/scsi/st.c if (st_int_ioctl(STp, MTBSR, 1)) STp 2029 drivers/scsi/st.c if (STp->block_size == 0) STp 2033 drivers/scsi/st.c bytes - transfer * STp->block_size; STp 2034 drivers/scsi/st.c DEBC_printk(STp, "EOF detected (%d " STp 2042 drivers/scsi/st.c if (STp->block_size == 0) STp 2046 drivers/scsi/st.c bytes - transfer * STp->block_size; STp 2048 drivers/scsi/st.c DEBC_printk(STp, "EOM detected (%d " STp 2055 drivers/scsi/st.c DEBC_printk(STp, "Tape error while reading.\n"); STp 2059 drivers/scsi/st.c DEBC_printk(STp, "Zero returned for " STp 2079 drivers/scsi/st.c if (STp->sili) /* In fixed block mode residual is always zero here */ STp 2080 drivers/scsi/st.c STbp->buffer_bytes -= STp->buffer->cmdstat.residual; STp 2084 drivers/scsi/st.c if (STp->block_size == 0) STp 2087 drivers/scsi/st.c STps->drv_block += STbp->buffer_bytes / STp->block_size; STp 2102 drivers/scsi/st.c struct scsi_tape *STp = filp->private_data; STp 2105 drivers/scsi/st.c struct st_buffer *STbp = STp->buffer; STp 2107 drivers/scsi/st.c if (mutex_lock_interruptible(&STp->lock)) STp 2110 drivers/scsi/st.c retval = rw_checks(STp, filp, count); STp 2114 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 2115 drivers/scsi/st.c if (STp->block_size != 0 && (count % STp->block_size) != 0) { STp 2120 drivers/scsi/st.c STp->try_dio_now = 0; /* Direct i/o can't handle split blocks */ STp 2123 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 2125 drivers/scsi/st.c retval = flush_buffer(STp, 0); STp 2132 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2137 drivers/scsi/st.c retval = setup_buffering(STp, buf, count, 1); STp 2173 drivers/scsi/st.c special = read_tape(STp, count - total, &SRpnt); STp 2184 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2202 drivers/scsi/st.c if (STp->block_size == 0) STp 2232 drivers/scsi/st.c release_buffering(STp, 1); STp 2235 drivers/scsi/st.c mutex_unlock(&STp->lock); STp 2244 drivers/scsi/st.c static void st_log_options(struct scsi_tape * STp, struct st_modedef * STm) STp 2247 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 2250 drivers/scsi/st.c STp->current_mode, STm->do_buffer_writes, STp 2252 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 2255 drivers/scsi/st.c STp->can_bsr, STp->two_fm, STp->fast_mteom, STp 2256 drivers/scsi/st.c STp->do_auto_lock); STp 2257 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 2260 drivers/scsi/st.c STm->defaults_for_writes, STp->omit_blklims, STp 2261 drivers/scsi/st.c STp->can_partitions, STp->scsi2_logical); STp 2262 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 2265 drivers/scsi/st.c STm->sysv, STp->immediate, STp->sili, STp 2266 drivers/scsi/st.c STp->immediate_filemark); STp 2267 drivers/scsi/st.c st_printk(KERN_INFO, STp, " debugging: %d\n", debugging); STp 2273 drivers/scsi/st.c static int st_set_options(struct scsi_tape *STp, long options) STp 2281 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 2287 drivers/scsi/st.c memcpy(STm, &(STp->modes[0]), sizeof(struct st_modedef)); STp 2293 drivers/scsi/st.c DEBC_printk(STp, "Initialized mode %d definition from mode 0\n", STp 2294 drivers/scsi/st.c STp->current_mode); STp 2303 drivers/scsi/st.c STp->two_fm = (options & MT_ST_TWO_FM) != 0; STp 2304 drivers/scsi/st.c STp->fast_mteom = (options & MT_ST_FAST_MTEOM) != 0; STp 2305 drivers/scsi/st.c STp->do_auto_lock = (options & MT_ST_AUTO_LOCK) != 0; STp 2306 drivers/scsi/st.c STp->can_bsr = (options & MT_ST_CAN_BSR) != 0; STp 2307 drivers/scsi/st.c STp->omit_blklims = (options & MT_ST_NO_BLKLIMS) != 0; STp 2308 drivers/scsi/st.c if ((STp->device)->scsi_level >= SCSI_2) STp 2309 drivers/scsi/st.c STp->can_partitions = (options & MT_ST_CAN_PARTITIONS) != 0; STp 2310 drivers/scsi/st.c STp->scsi2_logical = (options & MT_ST_SCSI2LOGICAL) != 0; STp 2311 drivers/scsi/st.c STp->immediate = (options & MT_ST_NOWAIT) != 0; STp 2312 drivers/scsi/st.c STp->immediate_filemark = (options & MT_ST_NOWAIT_EOF) != 0; STp 2314 drivers/scsi/st.c STp->sili = (options & MT_ST_SILI) != 0; STp 2316 drivers/scsi/st.c st_log_options(STp, STm); ) STp 2328 drivers/scsi/st.c STp->two_fm = value; STp 2330 drivers/scsi/st.c STp->fast_mteom = value; STp 2332 drivers/scsi/st.c STp->do_auto_lock = value; STp 2334 drivers/scsi/st.c STp->can_bsr = value; STp 2336 drivers/scsi/st.c STp->omit_blklims = value; STp 2337 drivers/scsi/st.c if ((STp->device)->scsi_level >= SCSI_2 && STp 2339 drivers/scsi/st.c STp->can_partitions = value; STp 2341 drivers/scsi/st.c STp->scsi2_logical = value; STp 2343 drivers/scsi/st.c STp->immediate = value; STp 2345 drivers/scsi/st.c STp->immediate_filemark = value; STp 2349 drivers/scsi/st.c STp->sili = value; STp 2353 drivers/scsi/st.c st_log_options(STp, STm); ) STp 2360 drivers/scsi/st.c DEBC_printk(STp, "Default block size disabled.\n"); STp 2363 drivers/scsi/st.c DEBC_printk(STp,"Default block size set to " STp 2365 drivers/scsi/st.c if (STp->ready == ST_READY) { STp 2366 drivers/scsi/st.c STp->blksize_changed = 0; STp 2367 drivers/scsi/st.c set_mode_densblk(STp, STm); STp 2373 drivers/scsi/st.c STp->long_timeout = (value & ~MT_ST_SET_LONG_TIMEOUT) * HZ; STp 2374 drivers/scsi/st.c DEBC_printk(STp, "Long timeout set to %d seconds.\n", STp 2377 drivers/scsi/st.c blk_queue_rq_timeout(STp->device->request_queue, STp 2379 drivers/scsi/st.c DEBC_printk(STp, "Normal timeout set to %d seconds.\n", STp 2388 drivers/scsi/st.c STp->cln_mode = value; STp 2389 drivers/scsi/st.c STp->cln_sense_mask = (options >> 8) & 0xff; STp 2390 drivers/scsi/st.c STp->cln_sense_value = (options >> 16) & 0xff; STp 2391 drivers/scsi/st.c st_printk(KERN_INFO, STp, STp 2393 drivers/scsi/st.c value, STp->cln_sense_mask, STp->cln_sense_value); STp 2400 drivers/scsi/st.c DEBC_printk(STp, STp 2404 drivers/scsi/st.c DEBC_printk(STp, "Density default set to %x\n", STp 2406 drivers/scsi/st.c if (STp->ready == ST_READY) { STp 2407 drivers/scsi/st.c STp->density_changed = 0; STp 2408 drivers/scsi/st.c set_mode_densblk(STp, STm); STp 2413 drivers/scsi/st.c STp->default_drvbuffer = 0xff; STp 2414 drivers/scsi/st.c DEBC_printk(STp, STp 2417 drivers/scsi/st.c STp->default_drvbuffer = value & 7; STp 2418 drivers/scsi/st.c DEBC_printk(STp, STp 2420 drivers/scsi/st.c STp->default_drvbuffer); STp 2421 drivers/scsi/st.c if (STp->ready == ST_READY) STp 2422 drivers/scsi/st.c st_int_ioctl(STp, MTSETDRVBUFFER, STp->default_drvbuffer); STp 2427 drivers/scsi/st.c DEBC_printk(STp, STp 2431 drivers/scsi/st.c STp->c_algo = (value & 0xff00) >> 8; STp 2432 drivers/scsi/st.c DEBC_printk(STp, "Compression " STp 2434 drivers/scsi/st.c STp->c_algo); STp 2438 drivers/scsi/st.c DEBC_printk(STp, "Compression default " STp 2441 drivers/scsi/st.c if (STp->ready == ST_READY) { STp 2442 drivers/scsi/st.c STp->compression_changed = 0; STp 2443 drivers/scsi/st.c st_compression(STp, (STm->default_compression == ST_YES)); STp 2476 drivers/scsi/st.c static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) STp 2488 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, cmd[4], DMA_FROM_DEVICE, STp 2489 drivers/scsi/st.c STp->device->request_queue->rq_timeout, 0, 1); STp 2491 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 2495 drivers/scsi/st.c return STp->buffer->syscall_result; STp 2501 drivers/scsi/st.c static int write_mode_page(struct scsi_tape *STp, int page, int slow) STp 2511 drivers/scsi/st.c pgo = MODE_HEADER_LENGTH + (STp->buffer)->b_data[MH_OFF_BDESCS_LENGTH]; STp 2512 drivers/scsi/st.c cmd[4] = pgo + (STp->buffer)->b_data[pgo + MP_OFF_PAGE_LENGTH] + 2; STp 2515 drivers/scsi/st.c (STp->buffer)->b_data[MH_OFF_DATA_LENGTH] = 0; STp 2516 drivers/scsi/st.c (STp->buffer)->b_data[MH_OFF_MEDIUM_TYPE] = 0; STp 2517 drivers/scsi/st.c (STp->buffer)->b_data[MH_OFF_DEV_SPECIFIC] &= ~MH_BIT_WP; STp 2518 drivers/scsi/st.c (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR; STp 2521 drivers/scsi/st.c STp->long_timeout : STp->device->request_queue->rq_timeout; STp 2522 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, cmd[4], DMA_TO_DEVICE, STp 2525 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 2529 drivers/scsi/st.c return STp->buffer->syscall_result; STp 2550 drivers/scsi/st.c static int st_compression(struct scsi_tape * STp, int state) STp 2554 drivers/scsi/st.c unsigned char *b_data = (STp->buffer)->b_data; STp 2556 drivers/scsi/st.c if (STp->ready != ST_READY) STp 2560 drivers/scsi/st.c retval = read_mode_page(STp, COMPRESSION_PAGE, 0); STp 2562 drivers/scsi/st.c DEBC_printk(STp, "Compression mode page not supported.\n"); STp 2567 drivers/scsi/st.c DEBC_printk(STp, "Compression state is %d.\n", STp 2572 drivers/scsi/st.c DEBC_printk(STp, "Compression not supported.\n"); STp 2579 drivers/scsi/st.c if (STp->c_algo != 0) STp 2580 drivers/scsi/st.c b_data[mpoffs + CP_OFF_C_ALGO] = STp->c_algo; STp 2584 drivers/scsi/st.c if (STp->c_algo != 0) STp 2588 drivers/scsi/st.c retval = write_mode_page(STp, COMPRESSION_PAGE, 0); STp 2590 drivers/scsi/st.c DEBC_printk(STp, "Compression change failed.\n"); STp 2593 drivers/scsi/st.c DEBC_printk(STp, "Compression state changed to %d.\n", state); STp 2595 drivers/scsi/st.c STp->compression_changed = 1; STp 2601 drivers/scsi/st.c static int do_load_unload(struct scsi_tape *STp, struct file *filp, int load_code) STp 2608 drivers/scsi/st.c if (STp->ready != ST_READY && !load_code) { STp 2609 drivers/scsi/st.c if (STp->ready == ST_NO_TAPE) STp 2624 drivers/scsi/st.c DEBC_printk(STp, " Enhanced %sload slot %2d.\n", STp 2629 drivers/scsi/st.c if (STp->immediate) { STp 2631 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2634 drivers/scsi/st.c timeout = STp->long_timeout; STp 2638 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, "Unloading tape.\n"); STp 2640 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, "Loading tape.\n"); STp 2643 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, STp 2646 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 2648 drivers/scsi/st.c retval = (STp->buffer)->syscall_result; STp 2654 drivers/scsi/st.c STp->rew_at_close = 0; STp 2655 drivers/scsi/st.c STp->ready = ST_NO_TAPE; STp 2658 drivers/scsi/st.c STp->rew_at_close = STp->autorew_dev; STp 2659 drivers/scsi/st.c retval = check_tape(STp, filp); STp 2665 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 2675 drivers/scsi/st.c static void deb_space_print(struct scsi_tape *STp, int direction, char *units, unsigned char *cmd) STp 2686 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, "Spacing tape %s over %d %s.\n", STp 2692 drivers/scsi/st.c static void deb_space_print(struct scsi_tape *STp, int direction, char *units, unsigned char *cmd) {} STp 2697 drivers/scsi/st.c static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned long arg) STp 2709 drivers/scsi/st.c WARN_ON(STp->buffer->do_dio != 0); STp 2710 drivers/scsi/st.c if (STp->ready != ST_READY) { STp 2711 drivers/scsi/st.c if (STp->ready == ST_NO_TAPE) STp 2716 drivers/scsi/st.c timeout = STp->long_timeout; STp 2717 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 2733 drivers/scsi/st.c deb_space_print(STp, ST_DEB_FORWARD, "filemarks", cmd); STp 2749 drivers/scsi/st.c deb_space_print(STp, ST_DEB_BACKWARD, "filemarks", cmd); STp 2761 drivers/scsi/st.c deb_space_print(STp, ST_DEB_FORWARD, "blocks", cmd); STp 2773 drivers/scsi/st.c deb_space_print(STp, ST_DEB_BACKWARD, "blocks", cmd); STp 2784 drivers/scsi/st.c deb_space_print(STp, ST_DEB_FORWARD, "setmarks", cmd); STp 2797 drivers/scsi/st.c deb_space_print(STp, ST_DEB_BACKWARD, "setmarks", cmd); STp 2806 drivers/scsi/st.c if (STp->write_prot) STp 2812 drivers/scsi/st.c (cmd_in == MTWEOF && STp->immediate_filemark)) STp 2817 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2820 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2826 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2839 drivers/scsi/st.c if (STp->immediate) { STp 2841 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2843 drivers/scsi/st.c DEBC_printk(STp, "Rewinding tape.\n"); STp 2847 drivers/scsi/st.c DEBC_printk(STp, "No op on tape.\n"); STp 2852 drivers/scsi/st.c if (STp->immediate) { STp 2854 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2857 drivers/scsi/st.c DEBC_printk(STp, "Retensioning tape.\n"); STp 2861 drivers/scsi/st.c if (!STp->fast_mteom) { STp 2863 drivers/scsi/st.c ioctl_result = st_int_ioctl(STp, MTFSF, 0x7fffff); STp 2875 drivers/scsi/st.c DEBC_printk(STp, "Spacing to end of recorded medium.\n"); STp 2880 drivers/scsi/st.c if (STp->write_prot) STp 2884 drivers/scsi/st.c if (STp->immediate) { STp 2886 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2889 drivers/scsi/st.c timeout = STp->long_timeout * 8; STp 2891 drivers/scsi/st.c DEBC_printk(STp, "Erasing tape.\n"); STp 2899 drivers/scsi/st.c if (STp->dirty || (STp->buffer)->buffer_bytes != 0) STp 2903 drivers/scsi/st.c STp->max_block > 0 && STp 2904 drivers/scsi/st.c ((arg & MT_ST_BLKSIZE_MASK) < STp->min_block || STp 2905 drivers/scsi/st.c (arg & MT_ST_BLKSIZE_MASK) > STp->max_block)) { STp 2906 drivers/scsi/st.c st_printk(KERN_WARNING, STp, "Illegal block size.\n"); STp 2910 drivers/scsi/st.c if ((STp->use_pf & USE_PF)) STp 2915 drivers/scsi/st.c memset((STp->buffer)->b_data, 0, 12); STp 2917 drivers/scsi/st.c (STp->buffer)->b_data[2] = (arg & 7) << 4; STp 2919 drivers/scsi/st.c (STp->buffer)->b_data[2] = STp 2920 drivers/scsi/st.c STp->drv_buffer << 4; STp 2921 drivers/scsi/st.c (STp->buffer)->b_data[3] = 8; /* block descriptor length */ STp 2923 drivers/scsi/st.c (STp->buffer)->b_data[4] = arg; STp 2924 drivers/scsi/st.c STp->density_changed = 1; /* At least we tried ;-) */ STp 2926 drivers/scsi/st.c (STp->buffer)->b_data[4] = arg >> 24; STp 2928 drivers/scsi/st.c (STp->buffer)->b_data[4] = STp->density; STp 2932 drivers/scsi/st.c STp->blksize_changed = 1; /* At least we tried ;-) */ STp 2934 drivers/scsi/st.c ltmp = STp->block_size; STp 2935 drivers/scsi/st.c (STp->buffer)->b_data[9] = (ltmp >> 16); STp 2936 drivers/scsi/st.c (STp->buffer)->b_data[10] = (ltmp >> 8); STp 2937 drivers/scsi/st.c (STp->buffer)->b_data[11] = ltmp; STp 2938 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 2941 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2943 drivers/scsi/st.c (STp->buffer)->b_data[9] * 65536 + STp 2944 drivers/scsi/st.c (STp->buffer)->b_data[10] * 256 + STp 2945 drivers/scsi/st.c (STp->buffer)->b_data[11]); STp 2947 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2949 drivers/scsi/st.c (STp->buffer)->b_data[4]); STp 2951 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, STp 2953 drivers/scsi/st.c ((STp->buffer)->b_data[2] >> 4) & 7); STp 2960 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, cmd, datalen, direction, STp 2963 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 2965 drivers/scsi/st.c ioctl_result = (STp->buffer)->syscall_result; STp 2975 drivers/scsi/st.c ioctl_result = st_int_ioctl(STp, MTFSF, 1); STp 2977 drivers/scsi/st.c ioctl_result = st_int_ioctl(STp, MTBSF, 1); STp 2980 drivers/scsi/st.c STp->block_size = arg & MT_ST_BLKSIZE_MASK; STp 2981 drivers/scsi/st.c if (STp->block_size != 0) { STp 2982 drivers/scsi/st.c (STp->buffer)->buffer_blocks = STp 2983 drivers/scsi/st.c (STp->buffer)->buffer_size / STp->block_size; STp 2985 drivers/scsi/st.c (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0; STp 2987 drivers/scsi/st.c STp->density = arg >> MT_ST_DENSITY_SHIFT; STp 2989 drivers/scsi/st.c STp->drv_buffer = (arg & 7); STp 2991 drivers/scsi/st.c STp->density = arg; STp 3004 drivers/scsi/st.c struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; STp 3079 drivers/scsi/st.c !(STp->use_pf & PF_TESTED)) { STp 3082 drivers/scsi/st.c STp->use_pf = (STp->use_pf ^ USE_PF) | PF_TESTED; STp 3085 drivers/scsi/st.c return st_int_ioctl(STp, cmd_in, arg); STp 3104 drivers/scsi/st.c static int get_location(struct scsi_tape *STp, unsigned int *block, int *partition, STp 3111 drivers/scsi/st.c if (STp->ready != ST_READY) STp 3115 drivers/scsi/st.c if ((STp->device)->scsi_level < SCSI_2) { STp 3120 drivers/scsi/st.c if (!logical && !STp->scsi2_logical) STp 3123 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, scmd, 20, DMA_FROM_DEVICE, STp 3124 drivers/scsi/st.c STp->device->request_queue->rq_timeout, STp 3127 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 3129 drivers/scsi/st.c if ((STp->buffer)->syscall_result != 0 || STp 3130 drivers/scsi/st.c (STp->device->scsi_level >= SCSI_2 && STp 3131 drivers/scsi/st.c ((STp->buffer)->b_data[0] & 4) != 0)) { STp 3133 drivers/scsi/st.c DEBC_printk(STp, " Can't read tape position.\n"); STp 3137 drivers/scsi/st.c if ((STp->device)->scsi_level < SCSI_2) { STp 3138 drivers/scsi/st.c *block = ((STp->buffer)->b_data[0] << 16) STp 3139 drivers/scsi/st.c + ((STp->buffer)->b_data[1] << 8) STp 3140 drivers/scsi/st.c + (STp->buffer)->b_data[2]; STp 3143 drivers/scsi/st.c *block = ((STp->buffer)->b_data[4] << 24) STp 3144 drivers/scsi/st.c + ((STp->buffer)->b_data[5] << 16) STp 3145 drivers/scsi/st.c + ((STp->buffer)->b_data[6] << 8) STp 3146 drivers/scsi/st.c + (STp->buffer)->b_data[7]; STp 3147 drivers/scsi/st.c *partition = (STp->buffer)->b_data[1]; STp 3148 drivers/scsi/st.c if (((STp->buffer)->b_data[0] & 0x80) && STp 3149 drivers/scsi/st.c (STp->buffer)->b_data[1] == 0) /* BOP of partition 0 */ STp 3150 drivers/scsi/st.c STp->ps[0].drv_block = STp->ps[0].drv_file = 0; STp 3152 drivers/scsi/st.c DEBC_printk(STp, "Got tape pos. blk %d part %d.\n", STp 3164 drivers/scsi/st.c static int set_location(struct scsi_tape *STp, unsigned int block, int partition, STp 3174 drivers/scsi/st.c if (STp->ready != ST_READY) STp 3176 drivers/scsi/st.c timeout = STp->long_timeout; STp 3177 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 3179 drivers/scsi/st.c DEBC_printk(STp, "Setting block to %d and partition to %d.\n", STp 3185 drivers/scsi/st.c if ((!STp->can_partitions && partition != 0) || STp 3188 drivers/scsi/st.c if (partition != STp->partition) { STp 3189 drivers/scsi/st.c if (get_location(STp, &blk, &p, 1)) STp 3194 drivers/scsi/st.c DEBC_printk(STp, "Visited block %d for " STp 3196 drivers/scsi/st.c blk, STp->partition); STp 3201 drivers/scsi/st.c if ((STp->device)->scsi_level < SCSI_2) { STp 3213 drivers/scsi/st.c if (!logical && !STp->scsi2_logical) STp 3215 drivers/scsi/st.c if (STp->partition != partition) { STp 3218 drivers/scsi/st.c DEBC_printk(STp, "Trying to change partition " STp 3219 drivers/scsi/st.c "from %d to %d\n", STp->partition, STp 3223 drivers/scsi/st.c if (STp->immediate) { STp 3225 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 3228 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE, STp 3231 drivers/scsi/st.c return (STp->buffer)->syscall_result; STp 3235 drivers/scsi/st.c if ((STp->buffer)->syscall_result != 0) { STp 3237 drivers/scsi/st.c if (STp->can_partitions && STp 3238 drivers/scsi/st.c (STp->device)->scsi_level >= SCSI_2 && STp 3239 drivers/scsi/st.c (p = find_partition(STp)) >= 0) STp 3240 drivers/scsi/st.c STp->partition = p; STp 3242 drivers/scsi/st.c if (STp->can_partitions) { STp 3243 drivers/scsi/st.c STp->partition = partition; STp 3244 drivers/scsi/st.c STps = &(STp->ps[partition]); STp 3266 drivers/scsi/st.c static int find_partition(struct scsi_tape *STp) STp 3271 drivers/scsi/st.c if ((i = get_location(STp, &block, &partition, 1)) < 0) STp 3280 drivers/scsi/st.c static int switch_partition(struct scsi_tape *STp) STp 3284 drivers/scsi/st.c if (STp->partition == STp->new_partition) STp 3286 drivers/scsi/st.c STps = &(STp->ps[STp->new_partition]); STp 3289 drivers/scsi/st.c return set_location(STp, STps->last_block_visited, STp->new_partition, 1); STp 3311 drivers/scsi/st.c static int nbr_partitions(struct scsi_tape *STp) STp 3315 drivers/scsi/st.c if (STp->ready != ST_READY) STp 3318 drivers/scsi/st.c result = read_mode_page(STp, PART_PAGE, 1); STp 3321 drivers/scsi/st.c DEBC_printk(STp, "Can't read medium partition page.\n"); STp 3324 drivers/scsi/st.c result = (STp->buffer)->b_data[MODE_HEADER_LENGTH + STp 3326 drivers/scsi/st.c DEBC_printk(STp, "Number of partitions %d.\n", result); STp 3333 drivers/scsi/st.c static int format_medium(struct scsi_tape *STp, int format) STp 3336 drivers/scsi/st.c int timeout = STp->long_timeout; STp 3343 drivers/scsi/st.c if (STp->immediate) { STp 3345 drivers/scsi/st.c timeout = STp->device->request_queue->rq_timeout; STp 3347 drivers/scsi/st.c DEBC_printk(STp, "Sending FORMAT MEDIUM\n"); STp 3348 drivers/scsi/st.c SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE, STp 3351 drivers/scsi/st.c result = STp->buffer->syscall_result; STp 3377 drivers/scsi/st.c static int partition_tape(struct scsi_tape *STp, int size) STp 3381 drivers/scsi/st.c bool scsi3 = STp->device->scsi_level >= SCSI_3, needs_format = false; STp 3386 drivers/scsi/st.c result = read_mode_page(STp, PART_PAGE, 0); STp 3388 drivers/scsi/st.c DEBC_printk(STp, "Can't read partition mode page.\n"); STp 3398 drivers/scsi/st.c bp = (STp->buffer)->b_data; STp 3400 drivers/scsi/st.c DEBC_printk(STp, "Partition page length is %d bytes.\n", STp 3411 drivers/scsi/st.c DEBC_printk(STp, "Formatting tape with one partition.\n"); STp 3412 drivers/scsi/st.c result = format_medium(STp, 0); STp 3454 drivers/scsi/st.c DEBC_printk(STp, "psd_cnt %d, max.parts %d, nbr_parts %d\n", STp 3462 drivers/scsi/st.c DEBC_printk(STp, "Formatting tape with one partition.\n"); STp 3471 drivers/scsi/st.c DEBC_printk(STp, STp 3486 drivers/scsi/st.c result = write_mode_page(STp, PART_PAGE, 1); STp 3489 drivers/scsi/st.c result = format_medium(STp, 1); STp 3492 drivers/scsi/st.c st_printk(KERN_INFO, STp, "Partitioning of tape failed.\n"); STp 3508 drivers/scsi/st.c struct scsi_tape *STp = file->private_data; STp 3513 drivers/scsi/st.c if (mutex_lock_interruptible(&STp->lock)) STp 3517 drivers/scsi/st.c if (debugging && !STp->in_use) { STp 3518 drivers/scsi/st.c st_printk(ST_DEB_MSG, STp, "Incorrect device.\n"); STp 3523 drivers/scsi/st.c STm = &(STp->modes[STp->current_mode]); STp 3524 drivers/scsi/st.c STps = &(STp->ps[STp->partition]); STp 3532 drivers/scsi/st.c retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in, STp 3555 drivers/scsi/st.c st_printk(KERN_WARNING, STp, STp 3567 drivers/scsi/st.c if (!STp->pos_unknown) { STp 3585 drivers/scsi/st.c i = !STp->can_partitions || STp 3586 drivers/scsi/st.c (STp->new_partition != STp->partition); STp 3595 drivers/scsi/st.c i = flush_buffer(STp, i); STp 3604 drivers/scsi/st.c i = st_int_ioctl(STp, MTWEOF, 1); STp 3629 drivers/scsi/st.c reset_state(STp); STp 3631 drivers/scsi/st.c STp->device->was_reset = 0; STp 3639 drivers/scsi/st.c if (mtc.mt_op == MTOFFL && STp->door_locked != ST_UNLOCKED) STp 3640 drivers/scsi/st.c do_door_lock(STp, 0); /* Ignore result! */ STp 3644 drivers/scsi/st.c retval = st_set_options(STp, mtc.mt_count); STp 3649 drivers/scsi/st.c if (!STp->can_partitions || STp 3654 drivers/scsi/st.c if (mtc.mt_count >= STp->nbr_partitions && STp 3655 drivers/scsi/st.c (STp->nbr_partitions = nbr_partitions(STp)) < 0) { STp 3659 drivers/scsi/st.c if (mtc.mt_count >= STp->nbr_partitions) { STp 3663 drivers/scsi/st.c STp->new_partition = mtc.mt_count; STp 3669 drivers/scsi/st.c if (!STp->can_partitions) { STp 3673 drivers/scsi/st.c i = do_load_unload(STp, file, 1); STp 3678 drivers/scsi/st.c i = partition_tape(STp, mtc.mt_count); STp 3684 drivers/scsi/st.c STp->ps[i].rw = ST_IDLE; STp 3685 drivers/scsi/st.c STp->ps[i].at_sm = 0; STp 3686 drivers/scsi/st.c STp->ps[i].last_block_valid = 0; STp 3688 drivers/scsi/st.c STp->partition = STp->new_partition = 0; STp 3689 drivers/scsi/st.c STp->nbr_partitions = mtc.mt_count != 0 ? 2 : 1; STp 3696 drivers/scsi/st.c i = set_location(STp, mtc.mt_count, STp->new_partition, 0); STp 3697 drivers/scsi/st.c if (!STp->can_partitions) STp 3698 drivers/scsi/st.c STp->ps[0].rw = ST_IDLE; STp 3704 drivers/scsi/st.c retval = do_load_unload(STp, file, 0); STp 3709 drivers/scsi/st.c retval = do_load_unload(STp, file, max(1, mtc.mt_count)); STp 3714 drivers/scsi/st.c retval = do_door_lock(STp, (mtc.mt_op == MTLOCK)); STp 3718 drivers/scsi/st.c if (STp->can_partitions && STp->ready == ST_READY && STp 3719 drivers/scsi/st.c (i = switch_partition(STp)) < 0) { STp 3725 drivers/scsi/st.c retval = st_compression(STp, (mtc.mt_count & 1)); STp 3727 drivers/scsi/st.c retval = st_int_ioctl(STp, mtc.mt_op, mtc.mt_count); STp 3735 drivers/scsi/st.c if ((i = flush_buffer(STp, 0)) < 0) { STp 3739 drivers/scsi/st.c if (STp->can_partitions && STp 3740 drivers/scsi/st.c (i = switch_partition(STp)) < 0) { STp 3753 drivers/scsi/st.c mt_status.mt_type = STp->tape_type; STp 3755 drivers/scsi/st.c ((STp->block_size << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK) | STp 3756 drivers/scsi/st.c ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK); STp 3759 drivers/scsi/st.c if (STp->block_size != 0) { STp 3762 drivers/scsi/st.c (STp->buffer)->buffer_bytes / STp->block_size; STp 3765 drivers/scsi/st.c ((STp->buffer)->buffer_bytes + STp 3766 drivers/scsi/st.c STp->block_size - 1) / STp->block_size; STp 3770 drivers/scsi/st.c if (STp->drv_write_prot) STp 3778 drivers/scsi/st.c mt_status.mt_erreg = (STp->recover_reg << MT_ST_SOFTERR_SHIFT); STp 3779 drivers/scsi/st.c mt_status.mt_resid = STp->partition; STp 3784 drivers/scsi/st.c if (STp->density == 1) STp 3786 drivers/scsi/st.c else if (STp->density == 2) STp 3788 drivers/scsi/st.c else if (STp->density == 3) STp 3790 drivers/scsi/st.c if (STp->ready == ST_READY) STp 3792 drivers/scsi/st.c if (STp->ready == ST_NO_TAPE) STp 3797 drivers/scsi/st.c (STm->do_buffer_writes && STp->block_size != 0) || STp 3798 drivers/scsi/st.c STp->drv_buffer != 0) STp 3800 drivers/scsi/st.c if (STp->cleaning_req) STp 3809 drivers/scsi/st.c STp->recover_reg = 0; /* Clear after read */ STp 3819 drivers/scsi/st.c if ((i = get_location(STp, &blk, &bt, 0)) < 0) { STp 3829 drivers/scsi/st.c mutex_unlock(&STp->lock); STp 3841 drivers/scsi/st.c i = scsi_cmd_ioctl(STp->disk->queue, STp->disk, STp 3847 drivers/scsi/st.c retval = scsi_ioctl(STp->device, cmd_in, p); STp 3849 drivers/scsi/st.c STp->rew_at_close = 0; STp 3850 drivers/scsi/st.c STp->ready = ST_NO_TAPE; STp 3855 drivers/scsi/st.c mutex_unlock(&STp->lock); STp 3862 drivers/scsi/st.c struct scsi_tape *STp = file->private_data; STp 3863 drivers/scsi/st.c struct scsi_device *sdev = STp->device; STp 4655 drivers/scsi/st.c struct scsi_tape *STp = STm->tape; STp 4663 drivers/scsi/st.c options |= STp->two_fm ? MT_ST_TWO_FM : 0; STp 4664 drivers/scsi/st.c options |= STp->fast_mteom ? MT_ST_FAST_MTEOM : 0; STp 4666 drivers/scsi/st.c options |= STp->can_bsr ? MT_ST_CAN_BSR : 0; STp 4667 drivers/scsi/st.c options |= STp->omit_blklims ? MT_ST_NO_BLKLIMS : 0; STp 4668 drivers/scsi/st.c options |= STp->can_partitions ? MT_ST_CAN_PARTITIONS : 0; STp 4669 drivers/scsi/st.c options |= STp->scsi2_logical ? MT_ST_SCSI2LOGICAL : 0; STp 4671 drivers/scsi/st.c options |= STp->immediate ? MT_ST_NOWAIT : 0; STp 4672 drivers/scsi/st.c options |= STp->immediate_filemark ? MT_ST_NOWAIT_EOF : 0; STp 4673 drivers/scsi/st.c options |= STp->sili ? MT_ST_SILI : 0;