tag | line | file | source code |
STp | 199 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 202 | drivers/scsi/st.c | STp = &(scsi_tapes[st_nbr]); |
STp | 203 | drivers/scsi/st.c | if ((STp->buffer)->writing && |
STp | 215 | drivers/scsi/st.c | (STp->buffer)->last_result = SCpnt->result; /* Error */ |
STp | 217 | drivers/scsi/st.c | (STp->buffer)->last_result = INT_MAX; /* OK */ |
STp | 220 | drivers/scsi/st.c | (STp->buffer)->last_result = SCpnt->result; |
STp | 221 | drivers/scsi/st.c | if ((STp->buffer)->writing) { |
STp | 223 | drivers/scsi/st.c | (STp->buffer)->last_result_fatal = st_chk_result(SCpnt); |
STp | 230 | drivers/scsi/st.c | STp->write_pending = 0; |
STp | 243 | drivers/scsi/st.c | st_do_scsi(Scsi_Cmnd *SCpnt, Scsi_Tape *STp, unsigned char *cmd, int bytes, |
STp | 247 | drivers/scsi/st.c | if ((SCpnt = allocate_device(NULL, STp->device, 1)) == NULL) { |
STp | 248 | drivers/scsi/st.c | printk(KERN_ERR "st%d: Can't get SCSI request.\n", TAPE_NR(STp->devt)); |
STp | 253 | drivers/scsi/st.c | STp->sem = MUTEX_LOCKED; |
STp | 254 | drivers/scsi/st.c | SCpnt->request.sem = &(STp->sem); |
STp | 256 | drivers/scsi/st.c | SCpnt->request.rq_dev = STp->devt; |
STp | 258 | drivers/scsi/st.c | scsi_do_cmd(SCpnt, (void *)cmd, (STp->buffer)->b_data, bytes, |
STp | 263 | drivers/scsi/st.c | (STp->buffer)->last_result_fatal = st_chk_result(SCpnt); |
STp | 271 | drivers/scsi/st.c | write_behind_check(Scsi_Tape *STp) |
STp | 275 | drivers/scsi/st.c | STbuffer = STp->buffer; |
STp | 278 | drivers/scsi/st.c | if (STp->write_pending) |
STp | 279 | drivers/scsi/st.c | STp->nbr_waits++; |
STp | 281 | drivers/scsi/st.c | STp->nbr_finished++; |
STp | 284 | drivers/scsi/st.c | down(&(STp->sem)); |
STp | 291 | drivers/scsi/st.c | if (STp->drv_block >= 0) { |
STp | 292 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 293 | drivers/scsi/st.c | STp->drv_block++; |
STp | 295 | drivers/scsi/st.c | STp->drv_block += STbuffer->writing / STp->block_size; |
STp | 306 | drivers/scsi/st.c | back_over_eof(Scsi_Tape *STp) |
STp | 316 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, cmd, 0, ST_TIMEOUT, MAX_RETRIES); |
STp | 321 | drivers/scsi/st.c | if ((STp->buffer)->last_result != 0) { |
STp | 322 | drivers/scsi/st.c | printk(KERN_ERR "st%d: Backing over filemark failed.\n", TAPE_NR(STp->devt)); |
STp | 323 | drivers/scsi/st.c | if ((STp->mt_status)->mt_fileno >= 0) |
STp | 324 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno += 1; |
STp | 325 | drivers/scsi/st.c | (STp->mt_status)->mt_blkno = 0; |
STp | 328 | drivers/scsi/st.c | return (STp->buffer)->last_result_fatal; |
STp | 334 | drivers/scsi/st.c | flush_write_buffer(Scsi_Tape *STp) |
STp | 341 | drivers/scsi/st.c | if ((STp->buffer)->writing) { |
STp | 342 | drivers/scsi/st.c | write_behind_check(STp); |
STp | 343 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal) { |
STp | 347 | drivers/scsi/st.c | TAPE_NR(STp->devt), (STp->buffer)->last_result); |
STp | 349 | drivers/scsi/st.c | if ((STp->buffer)->last_result == INT_MAX) |
STp | 355 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 359 | drivers/scsi/st.c | if (STp->dirty == 1) { |
STp | 361 | drivers/scsi/st.c | offset = (STp->buffer)->buffer_bytes; |
STp | 362 | drivers/scsi/st.c | transfer = ((offset + STp->block_size - 1) / |
STp | 363 | drivers/scsi/st.c | STp->block_size) * STp->block_size; |
STp | 366 | drivers/scsi/st.c | printk(ST_DEB_MSG "st%d: Flushing %d bytes.\n", TAPE_NR(STp->devt), transfer); |
STp | 368 | drivers/scsi/st.c | memset((STp->buffer)->b_data + offset, 0, transfer - offset); |
STp | 373 | drivers/scsi/st.c | blks = transfer / STp->block_size; |
STp | 378 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, cmd, transfer, ST_TIMEOUT, MAX_WRITE_RETRIES); |
STp | 382 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 383 | drivers/scsi/st.c | printk(KERN_ERR "st%d: Error on flush.\n", TAPE_NR(STp->devt)); |
STp | 387 | drivers/scsi/st.c | STp->dirty = 0; |
STp | 388 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 393 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 396 | drivers/scsi/st.c | if (STp->drv_block >= 0) |
STp | 397 | drivers/scsi/st.c | STp->drv_block += blks; |
STp | 398 | drivers/scsi/st.c | STp->dirty = 0; |
STp | 399 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 413 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 417 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 418 | drivers/scsi/st.c | STbuffer = STp->buffer; |
STp | 424 | drivers/scsi/st.c | if( STp->device->was_reset ) |
STp | 427 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 430 | drivers/scsi/st.c | if (STp->ps[STp->partition].rw == ST_WRITING) /* Writing */ |
STp | 431 | drivers/scsi/st.c | return flush_write_buffer(STp); |
STp | 433 | drivers/scsi/st.c | if (STp->block_size == 0) { |
STp | 434 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 435 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 439 | drivers/scsi/st.c | backspace = ((STp->buffer)->buffer_bytes + |
STp | 440 | drivers/scsi/st.c | (STp->buffer)->read_pointer) / STp->block_size - |
STp | 441 | drivers/scsi/st.c | ((STp->buffer)->read_pointer + STp->block_size - 1) / |
STp | 442 | drivers/scsi/st.c | STp->block_size; |
STp | 443 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 444 | drivers/scsi/st.c | (STp->buffer)->read_pointer = 0; |
STp | 447 | drivers/scsi/st.c | if ((STp->eof == ST_FM) && !STp->eof_hit) { |
STp | 448 | drivers/scsi/st.c | result = back_over_eof(STp); /* Back over the EOF hit */ |
STp | 450 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 451 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 457 | drivers/scsi/st.c | else if ((STp->eof == ST_FM) && !STp->eof_hit) { |
STp | 458 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno++; |
STp | 459 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 468 | drivers/scsi/st.c | set_mode_densblk(struct inode * inode, Scsi_Tape *STp, ST_mode *STm) |
STp | 474 | drivers/scsi/st.c | if (!STp->density_changed && |
STp | 476 | drivers/scsi/st.c | STm->default_density != STp->density) { |
STp | 481 | drivers/scsi/st.c | arg = STp->density; |
STp | 483 | drivers/scsi/st.c | if (!STp->blksize_changed && |
STp | 485 | drivers/scsi/st.c | STm->default_blksize != STp->block_size) { |
STp | 490 | drivers/scsi/st.c | arg |= STp->block_size; |
STp | 511 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 518 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 519 | drivers/scsi/st.c | if (STp->in_use) { |
STp | 525 | drivers/scsi/st.c | STp->rew_at_close = (MINOR(inode->i_rdev) & 0x80) == 0; |
STp | 527 | drivers/scsi/st.c | if (mode != STp->current_mode) { |
STp | 531 | drivers/scsi/st.c | dev, STp->current_mode, mode); |
STp | 536 | drivers/scsi/st.c | STp->current_mode = mode; |
STp | 538 | drivers/scsi/st.c | STm = &(STp->modes[STp->current_mode]); |
STp | 541 | drivers/scsi/st.c | need_dma_buffer = STp->restr_dma; |
STp | 547 | drivers/scsi/st.c | STp->buffer = new_tape_buffer(FALSE, need_dma_buffer); |
STp | 548 | drivers/scsi/st.c | if (STp->buffer == NULL) { |
STp | 554 | drivers/scsi/st.c | STp->buffer = st_buffers[i]; |
STp | 555 | drivers/scsi/st.c | (STp->buffer)->in_use = 1; |
STp | 556 | drivers/scsi/st.c | (STp->buffer)->writing = 0; |
STp | 559 | drivers/scsi/st.c | STp->write_prot = ((flags & O_ACCMODE) == O_RDONLY); |
STp | 561 | drivers/scsi/st.c | STp->dirty = 0; |
STp | 563 | drivers/scsi/st.c | STp->ps[i].rw = ST_IDLE; |
STp | 564 | drivers/scsi/st.c | STp->ready = ST_READY; |
STp | 565 | drivers/scsi/st.c | if (STp->eof != ST_EOD) /* Save EOD across opens */ |
STp | 566 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 567 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 568 | drivers/scsi/st.c | STp->recover_count = 0; |
STp | 570 | drivers/scsi/st.c | STp->nbr_waits = STp->nbr_finished = 0; |
STp | 576 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, cmd, 0, ST_LONG_TIMEOUT, MAX_READY_RETRIES); |
STp | 582 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = 0 ; |
STp | 586 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, 0, ST_LONG_TIMEOUT, MAX_READY_RETRIES); |
STp | 588 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = STp->drv_block = 0; |
STp | 589 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 590 | drivers/scsi/st.c | (STp->device)->was_reset = 0; |
STp | 591 | drivers/scsi/st.c | STp->partition = STp->new_partition = 0; |
STp | 592 | drivers/scsi/st.c | if (STp->can_partitions) |
STp | 593 | drivers/scsi/st.c | STp->nbr_partitions = 1; /* This guess will be updated later if necessary */ |
STp | 595 | drivers/scsi/st.c | STp->ps[i].rw = ST_IDLE; |
STp | 596 | drivers/scsi/st.c | STp->ps[i].moves_after_eof = 1; |
STp | 597 | drivers/scsi/st.c | STp->ps[i].at_sm = 0; |
STp | 598 | drivers/scsi/st.c | STp->ps[i].last_block_valid = FALSE; |
STp | 603 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 606 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = STp->drv_block = 0 ; |
STp | 608 | drivers/scsi/st.c | STp->ready = ST_NO_TAPE; |
STp | 610 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = STp->drv_block = (-1); |
STp | 611 | drivers/scsi/st.c | STp->ready = ST_NOT_READY; |
STp | 614 | drivers/scsi/st.c | STp->density = 0; /* Clear the erroneous "residue" */ |
STp | 615 | drivers/scsi/st.c | STp->write_prot = 0; |
STp | 616 | drivers/scsi/st.c | STp->block_size = 0; |
STp | 617 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 618 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = STp->drv_block = 0; |
STp | 619 | drivers/scsi/st.c | STp->partition = STp->new_partition = 0; |
STp | 620 | drivers/scsi/st.c | STp->door_locked = ST_UNLOCKED; |
STp | 621 | drivers/scsi/st.c | STp->in_use = 1; |
STp | 628 | drivers/scsi/st.c | if (STp->omit_blklims) |
STp | 629 | drivers/scsi/st.c | STp->min_block = STp->max_block = (-1); |
STp | 634 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, 6, ST_TIMEOUT, MAX_READY_RETRIES); |
STp | 637 | drivers/scsi/st.c | STp->max_block = ((STp->buffer)->b_data[1] << 16) | |
STp | 638 | drivers/scsi/st.c | ((STp->buffer)->b_data[2] << 8) | (STp->buffer)->b_data[3]; |
STp | 639 | drivers/scsi/st.c | STp->min_block = ((STp->buffer)->b_data[4] << 8) | |
STp | 640 | drivers/scsi/st.c | (STp->buffer)->b_data[5]; |
STp | 643 | drivers/scsi/st.c | printk(ST_DEB_MSG "st%d: Block limits %d - %d bytes.\n", dev, STp->min_block, |
STp | 644 | drivers/scsi/st.c | STp->max_block); |
STp | 648 | drivers/scsi/st.c | STp->min_block = STp->max_block = (-1); |
STp | 660 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, 12, ST_TIMEOUT, MAX_READY_RETRIES); |
STp | 662 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 667 | drivers/scsi/st.c | STp->block_size = ST_DEFAULT_BLOCK; /* Educated guess (?) */ |
STp | 668 | drivers/scsi/st.c | (STp->buffer)->last_result_fatal = 0; /* Prevent error propagation */ |
STp | 669 | drivers/scsi/st.c | STp->drv_write_prot = 0; |
STp | 677 | drivers/scsi/st.c | (STp->buffer)->b_data[0], (STp->buffer)->b_data[1], |
STp | 678 | drivers/scsi/st.c | (STp->buffer)->b_data[2], (STp->buffer)->b_data[3]); |
STp | 681 | drivers/scsi/st.c | if ((STp->buffer)->b_data[3] >= 8) { |
STp | 682 | drivers/scsi/st.c | STp->drv_buffer = ((STp->buffer)->b_data[2] >> 4) & 7; |
STp | 683 | drivers/scsi/st.c | STp->density = (STp->buffer)->b_data[4]; |
STp | 684 | drivers/scsi/st.c | STp->block_size = (STp->buffer)->b_data[9] * 65536 + |
STp | 685 | drivers/scsi/st.c | (STp->buffer)->b_data[10] * 256 + (STp->buffer)->b_data[11]; |
STp | 689 | drivers/scsi/st.c | dev, STp->density, (STp->buffer)->b_data[5] * 65536 + |
STp | 690 | drivers/scsi/st.c | (STp->buffer)->b_data[6] * 256 + (STp->buffer)->b_data[7], |
STp | 691 | drivers/scsi/st.c | STp->drv_buffer); |
STp | 695 | drivers/scsi/st.c | if (STp->block_size > (STp->buffer)->buffer_size && |
STp | 696 | drivers/scsi/st.c | !enlarge_buffer(STp->buffer, STp->block_size, STp->restr_dma)) { |
STp | 698 | drivers/scsi/st.c | STp->block_size); |
STp | 699 | drivers/scsi/st.c | (STp->buffer)->in_use = 0; |
STp | 700 | drivers/scsi/st.c | STp->buffer = NULL; |
STp | 703 | drivers/scsi/st.c | STp->drv_write_prot = ((STp->buffer)->b_data[2] & 0x80) != 0; |
STp | 707 | drivers/scsi/st.c | if (STp->block_size > 0) |
STp | 708 | drivers/scsi/st.c | (STp->buffer)->buffer_blocks = st_buffer_size / STp->block_size; |
STp | 710 | drivers/scsi/st.c | (STp->buffer)->buffer_blocks = 1; |
STp | 711 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0; |
STp | 716 | drivers/scsi/st.c | STp->block_size, (STp->buffer)->buffer_size, |
STp | 717 | drivers/scsi/st.c | (STp->buffer)->buffer_blocks); |
STp | 720 | drivers/scsi/st.c | if (STp->drv_write_prot) { |
STp | 721 | drivers/scsi/st.c | STp->write_prot = 1; |
STp | 727 | drivers/scsi/st.c | (STp->buffer)->in_use = 0; |
STp | 728 | drivers/scsi/st.c | STp->buffer = NULL; |
STp | 733 | drivers/scsi/st.c | if (STp->can_partitions && STp->nbr_partitions < 1) { |
STp | 741 | drivers/scsi/st.c | if ((STp->partition = find_partition(inode)) < 0) { |
STp | 742 | drivers/scsi/st.c | (STp->buffer)->in_use = 0; |
STp | 743 | drivers/scsi/st.c | STp->buffer = NULL; |
STp | 744 | drivers/scsi/st.c | return STp->partition; |
STp | 746 | drivers/scsi/st.c | STp->new_partition = STp->partition; |
STp | 747 | drivers/scsi/st.c | STp->nbr_partitions = 1; /* This guess will be updated when necessary */ |
STp | 751 | drivers/scsi/st.c | STp->density_changed = STp->blksize_changed = FALSE; |
STp | 752 | drivers/scsi/st.c | STp->compression_changed = FALSE; |
STp | 754 | drivers/scsi/st.c | (i = set_mode_densblk(inode, STp, STm)) < 0) { |
STp | 755 | drivers/scsi/st.c | (STp->buffer)->in_use = 0; |
STp | 756 | drivers/scsi/st.c | STp->buffer = NULL; |
STp | 759 | drivers/scsi/st.c | if (STp->default_drvbuffer != 0xff) { |
STp | 760 | drivers/scsi/st.c | if (st_int_ioctl(inode, MTSETDRVBUFFER, STp->default_drvbuffer)) |
STp | 762 | drivers/scsi/st.c | dev, STp->default_drvbuffer); |
STp | 766 | drivers/scsi/st.c | STp->in_use = 1; |
STp | 782 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 787 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 789 | drivers/scsi/st.c | if (STp->can_partitions && |
STp | 798 | drivers/scsi/st.c | if ( STp->ps[STp->partition].rw == ST_WRITING && !(STp->device)->was_reset) { |
STp | 800 | drivers/scsi/st.c | result = flush_write_buffer(STp); |
STp | 807 | drivers/scsi/st.c | dev, STp->nbr_waits, STp->nbr_finished); |
STp | 815 | drivers/scsi/st.c | cmd[4] = 1 + STp->two_fm; |
STp | 817 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, cmd, 0, ST_TIMEOUT, MAX_WRITE_RETRIES); |
STp | 823 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) |
STp | 826 | drivers/scsi/st.c | if ((STp->mt_status)->mt_fileno >= 0) |
STp | 827 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno++ ; |
STp | 828 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 829 | drivers/scsi/st.c | if (STp->two_fm) |
STp | 830 | drivers/scsi/st.c | back_over_eof(STp); |
STp | 840 | drivers/scsi/st.c | else if (!STp->rew_at_close) { |
STp | 841 | drivers/scsi/st.c | if (STp->can_bsr) |
STp | 843 | drivers/scsi/st.c | else if ((STp->eof == ST_FM) && !STp->eof_hit) |
STp | 844 | drivers/scsi/st.c | back_over_eof(STp); |
STp | 848 | drivers/scsi/st.c | if (STp->rew_at_close) |
STp | 851 | drivers/scsi/st.c | if (STp->door_locked == ST_LOCKED_AUTO) |
STp | 854 | drivers/scsi/st.c | if (STp->buffer != NULL) { |
STp | 855 | drivers/scsi/st.c | normalize_buffer(STp->buffer); |
STp | 856 | drivers/scsi/st.c | (STp->buffer)->in_use = 0; |
STp | 859 | drivers/scsi/st.c | STp->in_use = 0; |
STp | 878 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 883 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 884 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 886 | drivers/scsi/st.c | STm = &(STp->modes[STp->current_mode]); |
STp | 894 | drivers/scsi/st.c | if( STp->device->was_reset ) |
STp | 898 | drivers/scsi/st.c | if (!STp->in_use) { |
STp | 904 | drivers/scsi/st.c | if (STp->can_partitions && |
STp | 907 | drivers/scsi/st.c | STps = &(STp->ps[STp->partition]); |
STp | 909 | drivers/scsi/st.c | if (STp->write_prot) |
STp | 912 | drivers/scsi/st.c | if (STp->block_size == 0 && |
STp | 913 | drivers/scsi/st.c | count > (STp->buffer)->buffer_size && |
STp | 914 | drivers/scsi/st.c | !enlarge_buffer(STp->buffer, count, STp->restr_dma)) |
STp | 917 | drivers/scsi/st.c | if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && |
STp | 919 | drivers/scsi/st.c | STp->door_locked = ST_LOCKED_AUTO; |
STp | 928 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno == 0 && STp->drv_block == 0) { |
STp | 929 | drivers/scsi/st.c | if ((retval = set_mode_densblk(inode, STp, STm)) < 0) |
STp | 932 | drivers/scsi/st.c | !(STp->compression_changed)) { |
STp | 933 | drivers/scsi/st.c | if (st_compression(STp, (STm->default_compression == ST_YES))) { |
STp | 945 | drivers/scsi/st.c | if ((STp->buffer)->writing) { |
STp | 946 | drivers/scsi/st.c | write_behind_check(STp); |
STp | 947 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal) { |
STp | 951 | drivers/scsi/st.c | (STp->buffer)->last_result); |
STp | 953 | drivers/scsi/st.c | if ((STp->buffer)->last_result == INT_MAX) { |
STp | 955 | drivers/scsi/st.c | STp->eof = ST_EOM_OK; |
STp | 962 | drivers/scsi/st.c | if (STp->eof == ST_EOM_OK) |
STp | 964 | drivers/scsi/st.c | else if (STp->eof == ST_EOM_ERROR) |
STp | 968 | drivers/scsi/st.c | if (STp->block_size != 0 && (count % STp->block_size) != 0) |
STp | 973 | drivers/scsi/st.c | write_threshold = (STp->buffer)->buffer_blocks * STp->block_size; |
STp | 981 | drivers/scsi/st.c | cmd[1] = (STp->block_size != 0); |
STp | 986 | drivers/scsi/st.c | while((STp->block_size == 0 && !STm->do_async_writes && count > 0) || |
STp | 987 | drivers/scsi/st.c | (STp->block_size != 0 && |
STp | 988 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes + count > write_threshold)) |
STp | 991 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 994 | drivers/scsi/st.c | do_count = (STp->buffer)->buffer_blocks * STp->block_size - |
STp | 995 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes; |
STp | 999 | drivers/scsi/st.c | memcpy_fromfs((STp->buffer)->b_data + |
STp | 1000 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes, b_point, do_count); |
STp | 1002 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1005 | drivers/scsi/st.c | blks = ((STp->buffer)->buffer_bytes + do_count) / |
STp | 1006 | drivers/scsi/st.c | STp->block_size; |
STp | 1007 | drivers/scsi/st.c | transfer = blks * STp->block_size; |
STp | 1013 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, transfer, ST_TIMEOUT, MAX_WRITE_RETRIES); |
STp | 1017 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 1024 | drivers/scsi/st.c | if (STp->block_size != 0 && (SCpnt->sense_buffer[0] & 0x80) != 0) |
STp | 1028 | drivers/scsi/st.c | else if (STp->block_size == 0 && |
STp | 1033 | drivers/scsi/st.c | if (STp->block_size != 0) |
STp | 1034 | drivers/scsi/st.c | transfer *= STp->block_size; |
STp | 1038 | drivers/scsi/st.c | if (STp->drv_block >= 0) { |
STp | 1039 | drivers/scsi/st.c | if (STp->block_size == 0 && transfer < do_count) |
STp | 1040 | drivers/scsi/st.c | STp->drv_block++; |
STp | 1041 | drivers/scsi/st.c | else if (STp->block_size != 0) |
STp | 1042 | drivers/scsi/st.c | STp->drv_block += (do_count - transfer) / STp->block_size; |
STp | 1044 | drivers/scsi/st.c | STp->eof = ST_EOM_OK; |
STp | 1053 | drivers/scsi/st.c | STp->eof = ST_EOM_ERROR; |
STp | 1054 | drivers/scsi/st.c | STp->drv_block = (-1); /* Too cautious? */ |
STp | 1063 | drivers/scsi/st.c | STp->drv_block = (-1); /* Too cautious? */ |
STp | 1068 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 1069 | drivers/scsi/st.c | STp->dirty = 0; |
STp | 1078 | drivers/scsi/st.c | if (STp->drv_block >= 0) { |
STp | 1079 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1080 | drivers/scsi/st.c | STp->drv_block++; |
STp | 1082 | drivers/scsi/st.c | STp->drv_block += blks; |
STp | 1084 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 1085 | drivers/scsi/st.c | STp->dirty = 0; |
STp | 1088 | drivers/scsi/st.c | STp->dirty = 1; |
STp | 1089 | drivers/scsi/st.c | memcpy_fromfs((STp->buffer)->b_data + |
STp | 1090 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes,b_point,count); |
STp | 1092 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes += count; |
STp | 1096 | drivers/scsi/st.c | if (doing_write && (STp->buffer)->last_result_fatal != 0) { |
STp | 1098 | drivers/scsi/st.c | return (STp->buffer)->last_result_fatal; |
STp | 1102 | drivers/scsi/st.c | ((STp->buffer)->buffer_bytes >= STp->write_threshold || |
STp | 1103 | drivers/scsi/st.c | STp->block_size == 0) ) { |
STp | 1106 | drivers/scsi/st.c | SCpnt = allocate_device(NULL, STp->device, 1); |
STp | 1110 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1111 | drivers/scsi/st.c | (STp->buffer)->writing = (STp->buffer)->buffer_bytes; |
STp | 1113 | drivers/scsi/st.c | (STp->buffer)->writing = ((STp->buffer)->buffer_bytes / |
STp | 1114 | drivers/scsi/st.c | STp->block_size) * STp->block_size; |
STp | 1115 | drivers/scsi/st.c | STp->dirty = !((STp->buffer)->writing == |
STp | 1116 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes); |
STp | 1118 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1119 | drivers/scsi/st.c | blks = (STp->buffer)->writing; |
STp | 1121 | drivers/scsi/st.c | blks = (STp->buffer)->writing / STp->block_size; |
STp | 1125 | drivers/scsi/st.c | STp->sem = MUTEX_LOCKED; |
STp | 1126 | drivers/scsi/st.c | SCpnt->request.sem = &(STp->sem); |
STp | 1128 | drivers/scsi/st.c | SCpnt->request.rq_dev = STp->devt; |
STp | 1130 | drivers/scsi/st.c | STp->write_pending = 1; |
STp | 1134 | drivers/scsi/st.c | (void *) cmd, (STp->buffer)->b_data, |
STp | 1135 | drivers/scsi/st.c | (STp->buffer)->writing, |
STp | 1154 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 1159 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 1160 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 1162 | drivers/scsi/st.c | STm = &(STp->modes[STp->current_mode]); |
STp | 1166 | drivers/scsi/st.c | if (!STp->in_use) { |
STp | 1172 | drivers/scsi/st.c | if (STp->can_partitions && |
STp | 1175 | drivers/scsi/st.c | STps = &(STp->ps[STp->partition]); |
STp | 1177 | drivers/scsi/st.c | if (STp->block_size == 0 && |
STp | 1178 | drivers/scsi/st.c | count > (STp->buffer)->buffer_size && |
STp | 1179 | drivers/scsi/st.c | !enlarge_buffer(STp->buffer, count, STp->restr_dma)) |
STp | 1182 | drivers/scsi/st.c | if (!(STm->do_read_ahead) && STp->block_size != 0 && |
STp | 1183 | drivers/scsi/st.c | (count % STp->block_size) != 0) |
STp | 1186 | drivers/scsi/st.c | if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && |
STp | 1188 | drivers/scsi/st.c | STp->door_locked = ST_LOCKED_AUTO; |
STp | 1200 | drivers/scsi/st.c | if (debugging && STp->eof != ST_NOEOF) |
STp | 1202 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes); |
STp | 1204 | drivers/scsi/st.c | if (((STp->buffer)->buffer_bytes == 0) && |
STp | 1205 | drivers/scsi/st.c | (STp->eof == ST_EOM_OK || STp->eof == ST_EOD)) |
STp | 1212 | drivers/scsi/st.c | if ((STp->buffer)->buffer_bytes == 0 && |
STp | 1213 | drivers/scsi/st.c | STp->eof == ST_NOEOF) { |
STp | 1217 | drivers/scsi/st.c | cmd[1] = (STp->block_size != 0); |
STp | 1218 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1222 | drivers/scsi/st.c | blks = (STp->buffer)->buffer_blocks; |
STp | 1223 | drivers/scsi/st.c | bytes = blks * STp->block_size; |
STp | 1227 | drivers/scsi/st.c | if (bytes > (STp->buffer)->buffer_size) |
STp | 1228 | drivers/scsi/st.c | bytes = (STp->buffer)->buffer_size; |
STp | 1229 | drivers/scsi/st.c | blks = bytes / STp->block_size; |
STp | 1230 | drivers/scsi/st.c | bytes = blks * STp->block_size; |
STp | 1237 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, bytes, ST_TIMEOUT, MAX_RETRIES); |
STp | 1241 | drivers/scsi/st.c | (STp->buffer)->read_pointer = 0; |
STp | 1242 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 1245 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal) { |
STp | 1265 | drivers/scsi/st.c | if (STp->block_size == 0 && |
STp | 1270 | drivers/scsi/st.c | if (STp->block_size == 0) { |
STp | 1273 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = bytes - transfer; |
STp | 1279 | drivers/scsi/st.c | if (STp->drv_block >= 0) |
STp | 1280 | drivers/scsi/st.c | STp->drv_block += blks - transfer + 1; |
STp | 1285 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = (blks - transfer) * STp->block_size; |
STp | 1289 | drivers/scsi/st.c | dev, count - total, (STp->buffer)->buffer_bytes); |
STp | 1291 | drivers/scsi/st.c | if (count - total > (STp->buffer)->buffer_bytes) |
STp | 1292 | drivers/scsi/st.c | count = total + (STp->buffer)->buffer_bytes; |
STp | 1293 | drivers/scsi/st.c | if (STp->drv_block >= 0) |
STp | 1294 | drivers/scsi/st.c | STp->drv_block += 1; |
STp | 1301 | drivers/scsi/st.c | STp->eof = ST_EOM_OK; |
STp | 1302 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1303 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = bytes - transfer; |
STp | 1305 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = |
STp | 1306 | drivers/scsi/st.c | bytes - transfer * STp->block_size; |
STp | 1310 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes); |
STp | 1314 | drivers/scsi/st.c | STp->eof = ST_FM; |
STp | 1315 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1316 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = 0; |
STp | 1318 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = |
STp | 1319 | drivers/scsi/st.c | bytes - transfer * STp->block_size; |
STp | 1324 | drivers/scsi/st.c | dev, (STp->buffer)->buffer_bytes, total); |
STp | 1334 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 1345 | drivers/scsi/st.c | STp->eof = ST_EOD; |
STp | 1353 | drivers/scsi/st.c | transfer = (STp->buffer)->last_result_fatal; |
STp | 1359 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = bytes; |
STp | 1361 | drivers/scsi/st.c | if (STp->drv_block >= 0) { |
STp | 1362 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1363 | drivers/scsi/st.c | STp->drv_block++; |
STp | 1365 | drivers/scsi/st.c | STp->drv_block += (STp->buffer)->buffer_bytes / STp->block_size; |
STp | 1371 | drivers/scsi/st.c | if ((STp->buffer)->buffer_bytes > 0) { |
STp | 1373 | drivers/scsi/st.c | if (debugging && STp->eof != ST_NOEOF) |
STp | 1375 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes, count - total); |
STp | 1377 | drivers/scsi/st.c | transfer = (STp->buffer)->buffer_bytes < count - total ? |
STp | 1378 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes : count - total; |
STp | 1379 | drivers/scsi/st.c | memcpy_tofs(buf, (STp->buffer)->b_data + |
STp | 1380 | drivers/scsi/st.c | (STp->buffer)->read_pointer,transfer); |
STp | 1384 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes -= transfer; |
STp | 1385 | drivers/scsi/st.c | (STp->buffer)->read_pointer += transfer; |
STp | 1387 | drivers/scsi/st.c | else if (STp->eof != ST_NOEOF) { |
STp | 1388 | drivers/scsi/st.c | STp->eof_hit = 1; |
STp | 1391 | drivers/scsi/st.c | if (total == 0 && STp->eof == ST_FM) { |
STp | 1392 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 1393 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 1396 | drivers/scsi/st.c | if ((STp->mt_status)->mt_fileno >= 0) |
STp | 1397 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno++; |
STp | 1399 | drivers/scsi/st.c | if (total == 0 && STp->eof == ST_EOM_OK) |
STp | 1404 | drivers/scsi/st.c | if (STp->block_size == 0) |
STp | 1419 | drivers/scsi/st.c | st_log_options(Scsi_Tape *STp, ST_mode *STm, int dev) |
STp | 1423 | drivers/scsi/st.c | dev, STp->current_mode, STm->do_buffer_writes, STm->do_async_writes, |
STp | 1427 | drivers/scsi/st.c | dev, STp->can_bsr, STp->two_fm, STp->fast_mteom, STp->do_auto_lock); |
STp | 1430 | drivers/scsi/st.c | dev, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions, |
STp | 1431 | drivers/scsi/st.c | STp->scsi2_logical); |
STp | 1445 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 1449 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 1450 | drivers/scsi/st.c | STm = &(STp->modes[STp->current_mode]); |
STp | 1452 | drivers/scsi/st.c | memcpy(STm, &(STp->modes[0]), sizeof(ST_mode)); |
STp | 1457 | drivers/scsi/st.c | dev, STp->current_mode); |
STp | 1467 | drivers/scsi/st.c | STp->two_fm = (options & MT_ST_TWO_FM) != 0; |
STp | 1468 | drivers/scsi/st.c | STp->fast_mteom = (options & MT_ST_FAST_MTEOM) != 0; |
STp | 1469 | drivers/scsi/st.c | STp->do_auto_lock = (options & MT_ST_AUTO_LOCK) != 0; |
STp | 1470 | drivers/scsi/st.c | STp->can_bsr = (options & MT_ST_CAN_BSR) != 0; |
STp | 1471 | drivers/scsi/st.c | STp->omit_blklims = (options & MT_ST_NO_BLKLIMS) != 0; |
STp | 1472 | drivers/scsi/st.c | if ((STp->device)->scsi_level >= SCSI_2) |
STp | 1473 | drivers/scsi/st.c | STp->can_partitions = (options & MT_ST_CAN_PARTITIONS) != 0; |
STp | 1474 | drivers/scsi/st.c | STp->scsi2_logical = (options & MT_ST_SCSI2LOGICAL) != 0; |
STp | 1478 | drivers/scsi/st.c | st_log_options(STp, STm, dev); |
STp | 1491 | drivers/scsi/st.c | STp->two_fm = value; |
STp | 1493 | drivers/scsi/st.c | STp->fast_mteom = value; |
STp | 1495 | drivers/scsi/st.c | STp->do_auto_lock = value; |
STp | 1497 | drivers/scsi/st.c | STp->can_bsr = value; |
STp | 1499 | drivers/scsi/st.c | STp->omit_blklims = value; |
STp | 1500 | drivers/scsi/st.c | if ((STp->device)->scsi_level >= SCSI_2 && |
STp | 1502 | drivers/scsi/st.c | STp->can_partitions = value; |
STp | 1504 | drivers/scsi/st.c | STp->scsi2_logical = value; |
STp | 1509 | drivers/scsi/st.c | st_log_options(STp, STm, dev); |
STp | 1518 | drivers/scsi/st.c | STp->write_threshold = value; |
STp | 1550 | drivers/scsi/st.c | STp->default_drvbuffer = 0xff; |
STp | 1554 | drivers/scsi/st.c | STp->default_drvbuffer = value & 7; |
STp | 1556 | drivers/scsi/st.c | dev, STp->default_drvbuffer); |
STp | 1590 | drivers/scsi/st.c | st_compression(Scsi_Tape * STp, int state) |
STp | 1596 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 1606 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, cmd[4], ST_TIMEOUT, 0); |
STp | 1611 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 1622 | drivers/scsi/st.c | ((STp->buffer)->b_data[MODE_HEADER_LENGTH + 2] & DCE_MASK ? 1 : 0)); |
STp | 1626 | drivers/scsi/st.c | if (((STp->buffer)->b_data[MODE_HEADER_LENGTH + 2] & DCC_MASK) == 0) { |
STp | 1637 | drivers/scsi/st.c | (STp->buffer)->b_data[MODE_HEADER_LENGTH + 2] |= DCE_MASK; |
STp | 1639 | drivers/scsi/st.c | (STp->buffer)->b_data[MODE_HEADER_LENGTH + 2] &= ~DCE_MASK; |
STp | 1646 | drivers/scsi/st.c | (STp->buffer)->b_data[0] = 0; /* Reserved data length */ |
STp | 1647 | drivers/scsi/st.c | (STp->buffer)->b_data[1] = 0; /* Reserved media type byte */ |
STp | 1648 | drivers/scsi/st.c | (STp->buffer)->b_data[MODE_HEADER_LENGTH] &= 0x3f; |
STp | 1649 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, cmd[4], ST_TIMEOUT, 0); |
STp | 1651 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 1667 | drivers/scsi/st.c | STp->compression_changed = TRUE; |
STp | 1682 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 1687 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 1688 | drivers/scsi/st.c | if (STp->ready != ST_READY && cmd_in != MTLOAD) |
STp | 1690 | drivers/scsi/st.c | STps = &(STp->ps[STp->partition]); |
STp | 1691 | drivers/scsi/st.c | fileno = (STp->mt_status)->mt_fileno ; |
STp | 1692 | drivers/scsi/st.c | blkno = STp->drv_block; |
STp | 1810 | drivers/scsi/st.c | if (STp->write_prot) |
STp | 1889 | drivers/scsi/st.c | if (!STp->fast_mteom) { |
STp | 1892 | drivers/scsi/st.c | fileno = (STp->mt_status)->mt_fileno ; |
STp | 1893 | drivers/scsi/st.c | if (STp->eof == ST_EOD || STp->eof == ST_EOM_OK) |
STp | 1912 | drivers/scsi/st.c | if (STp->write_prot) |
STp | 1948 | drivers/scsi/st.c | if (STp->dirty || (STp->buffer)->buffer_bytes != 0) |
STp | 1952 | drivers/scsi/st.c | ((arg & MT_ST_BLKSIZE_MASK) < STp->min_block || |
STp | 1953 | drivers/scsi/st.c | (arg & MT_ST_BLKSIZE_MASK) > STp->max_block || |
STp | 1961 | drivers/scsi/st.c | memset((STp->buffer)->b_data, 0, 12); |
STp | 1963 | drivers/scsi/st.c | (STp->buffer)->b_data[2] = (arg & 7) << 4; |
STp | 1965 | drivers/scsi/st.c | (STp->buffer)->b_data[2] = |
STp | 1966 | drivers/scsi/st.c | STp->drv_buffer << 4; |
STp | 1967 | drivers/scsi/st.c | (STp->buffer)->b_data[3] = 8; /* block descriptor length */ |
STp | 1969 | drivers/scsi/st.c | (STp->buffer)->b_data[4] = arg; |
STp | 1970 | drivers/scsi/st.c | STp->density_changed = TRUE; /* At least we tried ;-) */ |
STp | 1973 | drivers/scsi/st.c | (STp->buffer)->b_data[4] = arg >> 24; |
STp | 1975 | drivers/scsi/st.c | (STp->buffer)->b_data[4] = STp->density; |
STp | 1979 | drivers/scsi/st.c | STp->blksize_changed = TRUE; /* At least we tried ;-) */ |
STp | 1982 | drivers/scsi/st.c | ltmp = STp->block_size; |
STp | 1983 | drivers/scsi/st.c | (STp->buffer)->b_data[9] = (ltmp >> 16); |
STp | 1984 | drivers/scsi/st.c | (STp->buffer)->b_data[10] = (ltmp >> 8); |
STp | 1985 | drivers/scsi/st.c | (STp->buffer)->b_data[11] = ltmp; |
STp | 1991 | drivers/scsi/st.c | (STp->buffer)->b_data[9] * 65536 + |
STp | 1992 | drivers/scsi/st.c | (STp->buffer)->b_data[10] * 256 + |
STp | 1993 | drivers/scsi/st.c | (STp->buffer)->b_data[11]); |
STp | 1996 | drivers/scsi/st.c | (STp->buffer)->b_data[4]); |
STp | 1999 | drivers/scsi/st.c | ((STp->buffer)->b_data[2] >> 4) & 7); |
STp | 2007 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, cmd, datalen, timeout, MAX_RETRIES); |
STp | 2011 | drivers/scsi/st.c | ioctl_result = (STp->buffer)->last_result_fatal; |
STp | 2020 | drivers/scsi/st.c | STp->drv_block = blkno; |
STp | 2021 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = fileno; |
STp | 2024 | drivers/scsi/st.c | STp->door_locked = ST_LOCKED_EXPLICIT; |
STp | 2026 | drivers/scsi/st.c | STp->door_locked = ST_UNLOCKED; |
STp | 2032 | drivers/scsi/st.c | STp->block_size = arg & MT_ST_BLKSIZE_MASK; |
STp | 2033 | drivers/scsi/st.c | if (STp->block_size != 0) |
STp | 2034 | drivers/scsi/st.c | (STp->buffer)->buffer_blocks = |
STp | 2035 | drivers/scsi/st.c | (STp->buffer)->buffer_size / STp->block_size; |
STp | 2036 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes = (STp->buffer)->read_pointer = 0; |
STp | 2039 | drivers/scsi/st.c | STp->drv_buffer = (arg & 7); |
STp | 2041 | drivers/scsi/st.c | STp->density = arg; |
STp | 2043 | drivers/scsi/st.c | STp->eof = ST_EOD; |
STp | 2044 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 2047 | drivers/scsi/st.c | STp->eof = ST_NOEOF; |
STp | 2048 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 2051 | drivers/scsi/st.c | STp->density = arg >> MT_ST_DENSITY_SHIFT; |
STp | 2053 | drivers/scsi/st.c | STp->rew_at_close = 0; |
STp | 2055 | drivers/scsi/st.c | STp->rew_at_close = (MINOR(inode->i_rdev) & 0x80) == 0; |
STp | 2057 | drivers/scsi/st.c | STp->ps[i].rw = ST_IDLE; |
STp | 2058 | drivers/scsi/st.c | STp->ps[i].moves_after_eof = 1; |
STp | 2059 | drivers/scsi/st.c | STp->ps[i].last_block_valid = FALSE; |
STp | 2061 | drivers/scsi/st.c | STp->partition = 0; |
STp | 2067 | drivers/scsi/st.c | STp->eof = ST_EOM_OK; |
STp | 2068 | drivers/scsi/st.c | STp->eof_hit = 0; |
STp | 2069 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 2078 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = fileno - undone ; |
STp | 2080 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = fileno; |
STp | 2081 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 2084 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = fileno + undone ; |
STp | 2085 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 2089 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno++; |
STp | 2090 | drivers/scsi/st.c | STp->drv_block = 0; |
STp | 2094 | drivers/scsi/st.c | STp->drv_block = blkno - undone; |
STp | 2096 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 2101 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno--; |
STp | 2102 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 2106 | drivers/scsi/st.c | STp->drv_block = blkno + undone; |
STp | 2108 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 2112 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno = (-1); |
STp | 2113 | drivers/scsi/st.c | STp->drv_block = (-1); |
STp | 2115 | drivers/scsi/st.c | if (STp->eof == ST_NOEOF && |
STp | 2117 | drivers/scsi/st.c | STp->eof = ST_EOD; |
STp | 2119 | drivers/scsi/st.c | STp->door_locked = ST_LOCK_FAILS; |
STp | 2133 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2139 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2140 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 2144 | drivers/scsi/st.c | if ((STp->device)->scsi_level < SCSI_2) { |
STp | 2150 | drivers/scsi/st.c | if (!logical && !STp->scsi2_logical) |
STp | 2153 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, scmd, 20, ST_TIMEOUT, MAX_READY_RETRIES); |
STp | 2157 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0 || |
STp | 2158 | drivers/scsi/st.c | ((STp->buffer)->b_data[0] & 4)) { |
STp | 2168 | drivers/scsi/st.c | if ((STp->device)->scsi_level < SCSI_2) { |
STp | 2169 | drivers/scsi/st.c | *block = ((STp->buffer)->b_data[0] << 16) |
STp | 2170 | drivers/scsi/st.c | + ((STp->buffer)->b_data[1] << 8) |
STp | 2171 | drivers/scsi/st.c | + (STp->buffer)->b_data[2]; |
STp | 2175 | drivers/scsi/st.c | *block = ((STp->buffer)->b_data[4] << 24) |
STp | 2176 | drivers/scsi/st.c | + ((STp->buffer)->b_data[5] << 16) |
STp | 2177 | drivers/scsi/st.c | + ((STp->buffer)->b_data[6] << 8) |
STp | 2178 | drivers/scsi/st.c | + (STp->buffer)->b_data[7]; |
STp | 2179 | drivers/scsi/st.c | *partition = (STp->buffer)->b_data[1]; |
STp | 2180 | drivers/scsi/st.c | if (((STp->buffer)->b_data[0] & 0x80) && |
STp | 2181 | drivers/scsi/st.c | (STp->buffer)->b_data[1] == 0) /* BOP of partition 0 */ |
STp | 2182 | drivers/scsi/st.c | STp->drv_block = (STp->mt_status)->mt_fileno = 0; |
STp | 2203 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2212 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2213 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 2215 | drivers/scsi/st.c | STps = &(STp->ps[STp->partition]); |
STp | 2226 | drivers/scsi/st.c | if ((!STp->can_partitions && partition != 0) || |
STp | 2229 | drivers/scsi/st.c | if (partition != STp->partition) { |
STp | 2238 | drivers/scsi/st.c | dev, blk, STp->partition); |
STp | 2244 | drivers/scsi/st.c | if ((STp->device)->scsi_level < SCSI_2) { |
STp | 2257 | drivers/scsi/st.c | if (!logical && !STp->scsi2_logical) |
STp | 2259 | drivers/scsi/st.c | if (STp->partition != partition) { |
STp | 2265 | drivers/scsi/st.c | dev, STp->partition, partition); |
STp | 2274 | drivers/scsi/st.c | SCpnt = st_do_scsi(NULL, STp, scmd, 20, timeout, MAX_READY_RETRIES); |
STp | 2278 | drivers/scsi/st.c | STp->drv_block = (STp->mt_status)->mt_fileno = (-1); |
STp | 2279 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 2281 | drivers/scsi/st.c | if (STp->can_partitions && |
STp | 2282 | drivers/scsi/st.c | (STp->device)->scsi_level >= SCSI_2 && |
STp | 2284 | drivers/scsi/st.c | STp->partition = p; |
STp | 2287 | drivers/scsi/st.c | if (STp->can_partitions) { |
STp | 2288 | drivers/scsi/st.c | STp->partition = partition; |
STp | 2289 | drivers/scsi/st.c | STps = &(STp->ps[partition]); |
STp | 2300 | drivers/scsi/st.c | STp->drv_block = (STp->mt_status)->mt_fileno = 0; |
STp | 2330 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2333 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2334 | drivers/scsi/st.c | if (STp->partition == STp->new_partition) |
STp | 2336 | drivers/scsi/st.c | STps = &(STp->ps[STp->new_partition]); |
STp | 2339 | drivers/scsi/st.c | return set_location(inode, STps->last_block_visited, STp->new_partition, 1); |
STp | 2354 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2358 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2359 | drivers/scsi/st.c | if (STp->ready != ST_READY) |
STp | 2368 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, 200, ST_TIMEOUT, MAX_READY_RETRIES); |
STp | 2373 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 2381 | drivers/scsi/st.c | result = (STp->buffer)->b_data[MODE_HEADER_LENGTH + 3] + 1; |
STp | 2399 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2405 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2408 | drivers/scsi/st.c | bp = &((STp->buffer)->b_data[0]); |
STp | 2442 | drivers/scsi/st.c | SCpnt = st_do_scsi(SCpnt, STp, cmd, cmd[4], ST_LONG_TIMEOUT, MAX_READY_RETRIES); |
STp | 2447 | drivers/scsi/st.c | if ((STp->buffer)->last_result_fatal != 0) { |
STp | 2468 | drivers/scsi/st.c | Scsi_Tape *STp; |
STp | 2473 | drivers/scsi/st.c | STp = &(scsi_tapes[dev]); |
STp | 2475 | drivers/scsi/st.c | if (debugging && !STp->in_use) { |
STp | 2480 | drivers/scsi/st.c | STm = &(STp->modes[STp->current_mode]); |
STp | 2481 | drivers/scsi/st.c | STps = &(STp->ps[STp->partition]); |
STp | 2504 | drivers/scsi/st.c | if (!(STp->device)->was_reset) { |
STp | 2506 | drivers/scsi/st.c | if (STp->eof_hit) { |
STp | 2509 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno += 1; |
STp | 2513 | drivers/scsi/st.c | (STp->mt_status)->mt_fileno += 1; |
STp | 2538 | drivers/scsi/st.c | STp->device->was_reset = 0; |
STp | 2539 | drivers/scsi/st.c | if (STp->door_locked != ST_UNLOCKED && |
STp | 2540 | drivers/scsi/st.c | STp->door_locked != ST_LOCK_FAILS) { |
STp | 2544 | drivers/scsi/st.c | STp->door_locked = ST_UNLOCKED; |
STp | 2555 | drivers/scsi/st.c | if (mtc.mt_op == MTOFFL && STp->door_locked != ST_UNLOCKED) |
STp | 2562 | drivers/scsi/st.c | if (!STp->can_partitions || |
STp | 2565 | drivers/scsi/st.c | if (mtc.mt_count >= STp->nbr_partitions && |
STp | 2566 | drivers/scsi/st.c | (STp->nbr_partitions = nbr_partitions(inode)) < 0) |
STp | 2568 | drivers/scsi/st.c | if (mtc.mt_count >= STp->nbr_partitions) |
STp | 2570 | drivers/scsi/st.c | STp->new_partition = mtc.mt_count; |
STp | 2574 | drivers/scsi/st.c | if (!STp->can_partitions) |
STp | 2580 | drivers/scsi/st.c | STp->ps[i].rw = ST_IDLE; |
STp | 2581 | drivers/scsi/st.c | STp->ps[i].moves_after_eof = 1; |
STp | 2582 | drivers/scsi/st.c | STp->ps[i].at_sm = 0; |
STp | 2583 | drivers/scsi/st.c | STp->ps[i].last_block_valid = FALSE; |
STp | 2585 | drivers/scsi/st.c | STp->partition = STp->new_partition = 0; |
STp | 2586 | drivers/scsi/st.c | STp->nbr_partitions = 1; /* Bad guess ?-) */ |
STp | 2587 | drivers/scsi/st.c | STp->drv_block = (STp->mt_status)->mt_fileno = 0; |
STp | 2591 | drivers/scsi/st.c | i = set_location(inode, mtc.mt_count, STp->new_partition, 0); |
STp | 2592 | drivers/scsi/st.c | if (!STp->can_partitions) |
STp | 2593 | drivers/scsi/st.c | STp->ps[0].rw = ST_IDLE; |
STp | 2596 | drivers/scsi/st.c | if (STp->can_partitions && STp->ready == ST_READY && |
STp | 2600 | drivers/scsi/st.c | return st_compression(STp, (mtc.mt_count & 1)); |
STp | 2610 | drivers/scsi/st.c | if (STp->can_partitions && |
STp | 2622 | drivers/scsi/st.c | (STp->mt_status)->mt_dsreg = |
STp | 2623 | drivers/scsi/st.c | ((STp->block_size << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK) | |
STp | 2624 | drivers/scsi/st.c | ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK); |
STp | 2625 | drivers/scsi/st.c | (STp->mt_status)->mt_blkno = STp->drv_block; |
STp | 2626 | drivers/scsi/st.c | if (STp->block_size != 0) { |
STp | 2628 | drivers/scsi/st.c | (STp->mt_status)->mt_blkno += |
STp | 2629 | drivers/scsi/st.c | (STp->buffer)->buffer_bytes / STp->block_size; |
STp | 2631 | drivers/scsi/st.c | (STp->mt_status)->mt_blkno -= ((STp->buffer)->buffer_bytes + |
STp | 2632 | drivers/scsi/st.c | STp->block_size - 1) / STp->block_size; |
STp | 2635 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat = 0; |
STp | 2636 | drivers/scsi/st.c | if (STp->drv_write_prot) |
STp | 2637 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_WR_PROT(0xffffffff); |
STp | 2638 | drivers/scsi/st.c | if ((STp->mt_status)->mt_blkno == 0) { |
STp | 2639 | drivers/scsi/st.c | if ((STp->mt_status)->mt_fileno == 0) |
STp | 2640 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_BOT(0xffffffff); |
STp | 2642 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_EOF(0xffffffff); |
STp | 2644 | drivers/scsi/st.c | (STp->mt_status)->mt_resid = STp->partition; |
STp | 2645 | drivers/scsi/st.c | if (STp->eof == ST_EOM_OK || STp->eof == ST_EOM_ERROR) |
STp | 2646 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_EOT(0xffffffff); |
STp | 2647 | drivers/scsi/st.c | else if (STp->eof == ST_EOD) |
STp | 2648 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_EOD(0xffffffff); |
STp | 2649 | drivers/scsi/st.c | if (STp->density == 1) |
STp | 2650 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_D_800(0xffffffff); |
STp | 2651 | drivers/scsi/st.c | else if (STp->density == 2) |
STp | 2652 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_D_1600(0xffffffff); |
STp | 2653 | drivers/scsi/st.c | else if (STp->density == 3) |
STp | 2654 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_D_6250(0xffffffff); |
STp | 2655 | drivers/scsi/st.c | if (STp->ready == ST_READY) |
STp | 2656 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_ONLINE(0xffffffff); |
STp | 2657 | drivers/scsi/st.c | if (STp->ready == ST_NO_TAPE) |
STp | 2658 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_DR_OPEN(0xffffffff); |
STp | 2660 | drivers/scsi/st.c | (STp->mt_status)->mt_gstat |= GMT_SM(0xffffffff); |
STp | 2662 | drivers/scsi/st.c | memcpy_tofs((char *)arg, (char *)(STp->mt_status), |
STp | 2665 | drivers/scsi/st.c | (STp->mt_status)->mt_erreg = 0; /* Clear after read */ |
STp | 2682 | drivers/scsi/st.c | return scsi_ioctl(STp->device, cmd_in, (void *) arg); |
STp | 2915 | drivers/scsi/st.c | Scsi_Tape * STp; |
STp | 2952 | drivers/scsi/st.c | STp = &(scsi_tapes[i]); |
STp | 2953 | drivers/scsi/st.c | STp->capacity = 0xfffff; |
STp | 2954 | drivers/scsi/st.c | STp->mt_status = (struct mtget *) scsi_init_malloc(sizeof(struct mtget), |