Lines Matching refs:aSRpnt

176 static int osst_int_ioctl(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, unsigned int cmd_in,unsigned l…
178 static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int frame, int skip);
180 static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt);
182 static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt);
184 static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int pending);
606 static int osst_wait_ready(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned timeout, int initia… in osst_wait_ready() argument
626 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); in osst_wait_ready()
627 *aSRpnt = SRpnt; in osst_wait_ready()
650 *aSRpnt = SRpnt; in osst_wait_ready()
655 osst_write_error_recovery(STp, aSRpnt, 0) ) { in osst_wait_ready()
673 static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned timeout) in osst_wait_for_medium() argument
688 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); in osst_wait_for_medium()
689 *aSRpnt = SRpnt; in osst_wait_for_medium()
710 *aSRpnt = SRpnt; in osst_wait_for_medium()
730 static int osst_position_tape_and_confirm(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame) in osst_position_tape_and_confirm() argument
734 osst_wait_ready(STp, aSRpnt, 15 * 60, 0); /* TODO - can this catch a write error? */ in osst_position_tape_and_confirm()
735 retval = osst_set_frame_position(STp, aSRpnt, frame, 0); in osst_position_tape_and_confirm()
737 osst_wait_ready(STp, aSRpnt, 15 * 60, OSST_WAIT_POSITION_COMPLETE); in osst_position_tape_and_confirm()
738 return (osst_get_frame_position(STp, aSRpnt)); in osst_position_tape_and_confirm()
744 static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_flush_drive_buffer() argument
761 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_WRITE_RETRIES, TRUE); in osst_flush_drive_buffer()
762 *aSRpnt = SRpnt; in osst_flush_drive_buffer()
770 result = osst_write_error_recovery(STp, aSRpnt, 0); in osst_flush_drive_buffer()
772 result |= osst_wait_ready(STp, aSRpnt, 5 * 60, delay); in osst_flush_drive_buffer()
779 static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int t… in osst_wait_frame() argument
792 result = osst_get_frame_position (STp, aSRpnt); in osst_wait_frame()
794 if ((result = osst_write_error_recovery(STp, aSRpnt, 0)) == 0) in osst_wait_frame()
838 static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeout) in osst_read_frame() argument
850 retval = osst_wait_frame (STp, aSRpnt, STp->first_frame_position, 0, timeout); in osst_read_frame()
861 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_READ, in osst_read_frame()
863 *aSRpnt = SRpnt; in osst_read_frame()
907 static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_initiate_read() argument
920 osst_flush_write_buffer(STp, aSRpnt); in osst_initiate_read()
921 osst_flush_drive_buffer(STp, aSRpnt); in osst_initiate_read()
937 …SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READ_RETRIES, TRUE); in osst_initiate_read()
938 *aSRpnt = SRpnt; in osst_initiate_read()
945 static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame_seq_number,… in osst_get_logical_frame() argument
972 osst_set_frame_position(STp, aSRpnt, STp->read_error_frame, 0); in osst_get_logical_frame()
986 if ( osst_initiate_read(STp, aSRpnt) in osst_get_logical_frame()
987 || ( (!STp->frame_in_buffer) && osst_read_frame(STp, aSRpnt, 30) ) ) { in osst_get_logical_frame()
990 position = osst_get_frame_position(STp, aSRpnt); in osst_get_logical_frame()
1004 osst_set_frame_position(STp, aSRpnt, position, 0); in osst_get_logical_frame()
1025 position = osst_get_frame_position(STp, aSRpnt) in osst_get_logical_frame()
1037 osst_set_frame_position(STp, aSRpnt, position, 0); in osst_get_logical_frame()
1043 if (osst_get_frame_position(STp, aSRpnt) == 0xbaf) { in osst_get_logical_frame()
1047 osst_set_frame_position(STp, aSRpnt, 0xbb8, 0); in osst_get_logical_frame()
1071 static int osst_seek_logical_blk(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int logical_blk_num) in osst_seek_logical_blk() argument
1105 osst_set_frame_position(STp, aSRpnt, ppos_estimate, 0); in osst_seek_logical_blk()
1106 if (osst_get_logical_frame(STp, aSRpnt, frame_seq_estimate, 1) >= 0) { in osst_seek_logical_blk()
1152 if (osst_get_logical_frame(STp, aSRpnt, -1, 1) < 0) in osst_seek_logical_blk()
1180 static int osst_get_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_get_sector() argument
1203 sector = osst_get_frame_position(STp, aSRpnt); in osst_get_sector()
1210 static int osst_seek_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int sector) in osst_seek_sector() argument
1226 return (osst_set_frame_position(STp, aSRpnt, frame, 0)); in osst_seek_sector()
1228 r = osst_set_frame_position(STp, aSRpnt, offset?frame:frame-1, 0); in osst_seek_sector()
1231 r = osst_get_logical_frame(STp, aSRpnt, -1, 1); in osst_seek_sector()
1234 if (osst_get_frame_position(STp, aSRpnt) != (offset?frame+1:frame)) return (-EIO); in osst_seek_sector()
1273 static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in osst_read_back_buffer_and_rewrite() argument
1276 Scsi_Request * SRpnt = * aSRpnt; in osst_read_back_buffer_and_rewrite()
1320 *aSRpnt = SRpnt; in osst_read_back_buffer_and_rewrite()
1330 *aSRpnt = SRpnt; in osst_read_back_buffer_and_rewrite()
1331 osst_get_frame_position(STp, aSRpnt); in osst_read_back_buffer_and_rewrite()
1354 osst_set_frame_position(STp, aSRpnt, new_frame + i, 0); in osst_read_back_buffer_and_rewrite()
1355 osst_wait_ready(STp, aSRpnt, 60, OSST_WAIT_POSITION_COMPLETE); in osst_read_back_buffer_and_rewrite()
1356 osst_get_frame_position(STp, aSRpnt); in osst_read_back_buffer_and_rewrite()
1357 SRpnt = * aSRpnt; in osst_read_back_buffer_and_rewrite()
1437 *aSRpnt = SRpnt; in osst_read_back_buffer_and_rewrite()
1454 osst_get_frame_position(STp, aSRpnt); in osst_read_back_buffer_and_rewrite()
1467 static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in osst_reposition_and_retry() argument
1493 osst_set_frame_position(STp, aSRpnt, frame + skip, 1); in osst_reposition_and_retry()
1499 if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */ in osst_reposition_and_retry()
1519 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_WRITE, in osst_reposition_and_retry()
1521 *aSRpnt = SRpnt; in osst_reposition_and_retry()
1572 static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int pending) in osst_write_error_recovery() argument
1574 Scsi_Request * SRpnt = * aSRpnt; in osst_write_error_recovery()
1601 osst_get_frame_position(STp, aSRpnt); in osst_write_error_recovery()
1614 retval = osst_reposition_and_retry(STp, aSRpnt, frame, skip, pending); in osst_write_error_recovery()
1616 retval = osst_read_back_buffer_and_rewrite(STp, aSRpnt, frame, skip, pending); in osst_write_error_recovery()
1624 osst_set_frame_position(STp, aSRpnt, frame + STp->cur_frames + pending, 0); in osst_write_error_recovery()
1629 retval = osst_read_back_buffer_and_rewrite(STp, aSRpnt, frame, 1, pending); in osst_write_error_recovery()
1633 osst_set_frame_position(STp, aSRpnt, frame + STp->cur_frames + pending, 0); in osst_write_error_recovery()
1635 osst_get_frame_position(STp, aSRpnt); in osst_write_error_recovery()
1649 static int osst_space_over_filemarks_backward(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in osst_space_over_filemarks_backward() argument
1659 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_backward()
1691 osst_position_tape_and_confirm(STp, aSRpnt, last_mark_ppos); in osst_space_over_filemarks_backward()
1692 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_backward()
1718 osst_position_tape_and_confirm(STp, aSRpnt, last_mark_ppos); in osst_space_over_filemarks_backward()
1720 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_backward()
1748 static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in osst_space_over_filemarks_forward_slow() argument
1757 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_slow()
1764 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_slow()
1802 static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in osst_space_over_filemarks_forward_fast() argument
1812 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_fast()
1848 return osst_space_over_filemarks_forward_slow(STp, aSRpnt, mt_op, mt_count); in osst_space_over_filemarks_forward_fast()
1850 osst_position_tape_and_confirm(STp, aSRpnt, next_mark_ppos); in osst_space_over_filemarks_forward_fast()
1851 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_fast()
1888 return osst_space_over_filemarks_forward_slow(STp, aSRpnt, mt_op, mt_count); in osst_space_over_filemarks_forward_fast()
1890 osst_position_tape_and_confirm(STp, aSRpnt, STp->first_mark_ppos); in osst_space_over_filemarks_forward_fast()
1891 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_fast()
1905 if (osst_space_over_filemarks_backward(STp, aSRpnt, MTBSF, 1) < 0) in osst_space_over_filemarks_forward_fast()
1917 return osst_space_over_filemarks_forward_slow(STp, aSRpnt, mt_op, mt_count - cnt); in osst_space_over_filemarks_forward_fast()
1922 osst_position_tape_and_confirm(STp, aSRpnt, next_mark_ppos); in osst_space_over_filemarks_forward_fast()
1924 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_space_over_filemarks_forward_fast()
1953 static void osst_set_retries(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int retries) in osst_set_retries() argument
1956 Scsi_Request * SRpnt = * aSRpnt; in osst_set_retries()
1977 *aSRpnt = SRpnt; in osst_set_retries()
1985 static int osst_write_filemark(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_write_filemark() argument
2002 result = osst_flush_write_buffer(STp, aSRpnt); in osst_write_filemark()
2003 result |= osst_flush_drive_buffer(STp, aSRpnt); in osst_write_filemark()
2013 static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_write_eod() argument
2030 result = osst_flush_write_buffer(STp, aSRpnt); in osst_write_eod()
2031 result |= osst_flush_drive_buffer(STp, aSRpnt); in osst_write_eod()
2036 static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) in osst_write_filler() argument
2043 osst_wait_ready(STp, aSRpnt, 60 * 5, 0); in osst_write_filler()
2044 osst_set_frame_position(STp, aSRpnt, where, 0); in osst_write_filler()
2050 if (osst_flush_write_buffer(STp, aSRpnt)) { in osst_write_filler()
2058 return osst_flush_drive_buffer(STp, aSRpnt); in osst_write_filler()
2061 static int __osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) in __osst_write_header() argument
2069 osst_wait_ready(STp, aSRpnt, 60 * 5, 0); in __osst_write_header()
2070 osst_set_frame_position(STp, aSRpnt, where, 0); in __osst_write_header()
2076 if (osst_flush_write_buffer(STp, aSRpnt)) { in __osst_write_header()
2081 result = osst_flush_drive_buffer(STp, aSRpnt); in __osst_write_header()
2088 static int osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int locate_eod) in osst_write_header() argument
2140 result = __osst_write_header(STp, aSRpnt, 0xbae, 5); in osst_write_header()
2142 osst_write_filler(STp, aSRpnt, 0xbb3, 5); in osst_write_header()
2143 result &= __osst_write_header(STp, aSRpnt, 5, 5); in osst_write_header()
2149 osst_set_frame_position(STp, aSRpnt, STp->eod_frame_ppos, 0); in osst_write_header()
2162 static int osst_reset_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_reset_header() argument
2172 return osst_write_header(STp, aSRpnt, 1); in osst_reset_header()
2175 static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int ppos) in __osst_analyze_headers() argument
2188 if (osst_set_frame_position(STp, aSRpnt, ppos, 0)) in __osst_analyze_headers()
2190 osst_wait_ready(STp, aSRpnt, 60 * 15, 0); in __osst_analyze_headers()
2191 if (osst_initiate_read(STp, aSRpnt)) { in __osst_analyze_headers()
2196 if (osst_read_frame(STp, aSRpnt, 180)) { in __osst_analyze_headers()
2353 static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_analyze_headers() argument
2360 position = osst_get_frame_position(STp, aSRpnt); in osst_analyze_headers()
2382 if (__osst_analyze_headers(STp, aSRpnt, ppos)) in osst_analyze_headers()
2389 if (__osst_analyze_headers(STp, aSRpnt, ppos)) in osst_analyze_headers()
2395 osst_set_frame_position(STp, aSRpnt, 10, 0); in osst_analyze_headers()
2402 osst_set_frame_position(STp, aSRpnt, position, 0); in osst_analyze_headers()
2408 static int osst_verify_position(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) in osst_verify_position() argument
2425 if (!osst_analyze_headers(STp, aSRpnt) || in osst_verify_position()
2434 osst_set_frame_position(STp, aSRpnt, frame_position - 1, 0); in osst_verify_position()
2435 if (osst_get_logical_frame(STp, aSRpnt, -1, 0) < 0) { in osst_verify_position()
2463 osst_set_frame_position(STp, aSRpnt, frame_position - 1, 0); in osst_verify_position()
2497 static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) in osst_configure_onstream() argument
2501 Scsi_Request * SRpnt = * aSRpnt; in osst_configure_onstream()
2537 *aSRpnt = SRpnt; in osst_configure_onstream()
2568 *aSRpnt = SRpnt; in osst_configure_onstream()
2580 osst_set_retries(STp, aSRpnt, 0); in osst_configure_onstream()
2581 SRpnt = * aSRpnt; in osst_configure_onstream()
2608 *aSRpnt = SRpnt; in osst_configure_onstream()
2623 *aSRpnt = SRpnt; in osst_configure_onstream()
2643 *aSRpnt = SRpnt; in osst_configure_onstream()
2668 static int cross_eof(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int forward) in cross_eof() argument
2681 result = osst_space_over_filemarks_forward_slow(STp, aSRpnt, MTFSF, 1); in cross_eof()
2685 result = osst_seek_logical_blk(STp, aSRpnt, STp->logical_blk_num - 1); in cross_eof()
2697 static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) in osst_get_frame_position() argument
2716 SRpnt = osst_do_scsi(*aSRpnt, STp, scmd, 20, SCSI_DATA_READ, in osst_get_frame_position()
2722 *aSRpnt = SRpnt; in osst_get_frame_position()
2775 static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int ppos, int skip) in osst_set_frame_position() argument
2809 SRpnt = osst_do_scsi(*aSRpnt, STp, scmd, 0, SCSI_DATA_NONE, STp->long_timeout, in osst_set_frame_position()
2813 *aSRpnt = SRpnt; in osst_set_frame_position()
2823 osst_wait_ready(STp, aSRpnt, 5 * 60, OSST_WAIT_POSITION_COMPLETE); in osst_set_frame_position()
2833 static int osst_write_trailer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int leave_at_EOT) in osst_write_trailer() argument
2840 result = osst_flush_drive_buffer(STp, aSRpnt); in osst_write_trailer()
2842 result = osst_write_filemark(STp, aSRpnt); in osst_write_trailer()
2849 result = osst_write_eod(STp, aSRpnt); in osst_write_trailer()
2850 osst_write_header(STp, aSRpnt, leave_at_EOT); in osst_write_trailer()
2860 static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) in osst_flush_write_buffer() argument
2865 Scsi_Request * SRpnt = *aSRpnt; in osst_flush_write_buffer()
2875 *aSRpnt = SRpnt = NULL; in osst_flush_write_buffer()
2909 result = osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 120); in osst_flush_write_buffer()
2947 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, transfer, SCSI_DATA_WRITE, in osst_flush_write_buffer()
2949 *aSRpnt = SRpnt; in osst_flush_write_buffer()
2968 if (osst_write_error_recovery(STp, aSRpnt, 1)) { in osst_flush_write_buffer()
2990 static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int seek_next) in osst_flush_buffer() argument
3011 return osst_flush_write_buffer(STp, aSRpnt); in osst_flush_buffer()
3030 result = cross_eof(STp, aSRpnt, FALSE); /* Back over the EOF hit */ in osst_flush_buffer()
3040 result = osst_seek_logical_blk(STp, aSRpnt, STp->logical_blk_num - backspace); in osst_flush_buffer()
3052 static int osst_write_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int synchronous) in osst_write_frame() argument
3065 if (osst_flush_drive_buffer(STp, aSRpnt) < 0) { in osst_write_frame()
3069 if (osst_get_frame_position(STp, aSRpnt) < 0xbb8) { in osst_write_frame()
3073 osst_position_tape_and_confirm(STp, aSRpnt, 0xbb8); in osst_write_frame()
3078 osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 60); in osst_write_frame()
3103 SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_WRITE, STp->timeout, in osst_write_frame()
3107 *aSRpnt = SRpnt; in osst_write_frame()
3121 if (osst_write_error_recovery(STp, aSRpnt, 1)) in osst_write_frame()
3848 static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned int cmd_in, unsigned… in osst_int_ioctl() argument
3855 Scsi_Request * SRpnt = * aSRpnt; in osst_int_ioctl()
4254 *aSRpnt = SRpnt; in osst_int_ioctl()