Annotation of ntddk/src/scsi/qic117/newtrkrc.c, revision 1.1

1.1     ! root        1: /*++
        !             2: 
        !             3: Copyright (c) 1993 - Colorado Memory Systems, Inc.
        !             4: All Rights Reserved
        !             5: 
        !             6: Module Name:
        !             7: 
        !             8:     newtrkrc.c
        !             9: 
        !            10: Abstract:
        !            11: 
        !            12:     These routines handle streaming during reads.
        !            13: 
        !            14: Revision History:
        !            15: 
        !            16: 
        !            17: 
        !            18: 
        !            19: --*/
        !            20: 
        !            21: #include <ntddk.h>
        !            22: #include <ntddtape.h>
        !            23: #include "common.h"
        !            24: #include "q117.h"
        !            25: #include "protos.h"
        !            26: 
        !            27: 
        !            28: STATUS
        !            29: q117NewTrkRC(
        !            30:     IN OUT PQ117_CONTEXT Context
        !            31:     )
        !            32: 
        !            33: /*++
        !            34: 
        !            35: Routine Description:
        !            36: 
        !            37:     This routine queues up all segment buffers for reading and waits
        !            38:     on the first to be complete.  Then it calles ReconstructSegment to reconstruct
        !            39:     the segment with Reed-Solomon and heroic retries.
        !            40: 
        !            41: Arguments:
        !            42: 
        !            43:     Context -
        !            44: 
        !            45: Return Value:
        !            46: 
        !            47:     Error
        !            48: 
        !            49: 
        !            50: --*/
        !            51: 
        !            52: {
        !            53:     STATUS ret;         // Return value from other routines called.
        !            54:     PIO_REQUEST ioreq;     // iorequest struct just finished.
        !            55: 
        !            56:     //
        !            57:     // if we processed the last block then try to link
        !            58:     //
        !            59:     if (Context->CurrentOperation.LastSegmentRead ==
        !            60:         Context->CurrentOperation.LastSegment &&
        !            61:         q117QueueEmpty(Context)) {
        !            62:         ret = EndTapeErr;
        !            63:     }
        !            64: 
        !            65:     //
        !            66:     // make sure the queue is full
        !            67:     //
        !            68:     while ( Context->CurrentOperation.CurrentSegment <=
        !            69:         Context->CurrentOperation.LastSegment &&
        !            70:         !q117QueueFull(Context) ) {
        !            71: 
        !            72:         //
        !            73:         // We need to skip segments with less than
        !            74:         // ECC_BLOCKS_PER_SEGMENT+1 sectors (QIC40 spec)
        !            75:         //
        !            76:         if ( q117GoodDataBytes(Context->CurrentOperation.CurrentSegment,
        !            77:                 Context) ) {
        !            78: 
        !            79:             if ( ret = q117IssIOReq(
        !            80:                         (PVOID)NULL,
        !            81:                         DRead,
        !            82:                         (LONG)Context->CurrentOperation.CurrentSegment *
        !            83:                             BLOCKS_PER_SEGMENT,
        !            84:                         NULL,
        !            85:                         Context)) {
        !            86:                 return(ret);
        !            87:             }
        !            88:         }
        !            89:         ++Context->CurrentOperation.CurrentSegment;
        !            90:     }
        !            91: 
        !            92:     //
        !            93:     // now get current request
        !            94:     //
        !            95:     ioreq = q117Dequeue(WaitForItem,Context);
        !            96: 
        !            97:     Context->CurrentOperation.LastSegmentRead =
        !            98:         (SEGMENT)(ioreq->Block/BLOCKS_PER_SEGMENT);
        !            99: 
        !           100:     if (ioreq->Status != BadBlk && ioreq->Status) {
        !           101:         return(ioreq->Status);
        !           102:     }
        !           103: 
        !           104:     //
        !           105:     // correct data segment with Reed-Solomon and Heroic retries
        !           106:     //
        !           107:     ret = q117ReconstructSegment(ioreq,Context);
        !           108: 
        !           109:     //
        !           110:     // setup current segment information (used in ReadTape,
        !           111:     // SkipBlock and ReqRB)
        !           112:     //
        !           113:     Context->CurrentOperation.SegmentBytesRemaining =
        !           114:         q117GoodDataBytes(Context->CurrentOperation.LastSegmentRead,
        !           115:             Context);
        !           116: 
        !           117:     Context->CurrentOperation.SegmentPointer = ioreq->Data;
        !           118: 
        !           119:     Context->CurrentOperation.SegmentStatus = ret;
        !           120: 
        !           121:     return(ret);
        !           122: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.