|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1993 - Colorado Memory Systems, Inc. ! 4: All Rights Reserved ! 5: ! 6: Module Name: ! 7: ! 8: appvoltd.c ! 9: ! 10: Abstract: ! 11: ! 12: appends a volume entry to the qic-40 volume table ! 13: ! 14: Revision History: ! 15: ! 16: ! 17: ! 18: ! 19: --*/ ! 20: ! 21: // ! 22: // include files ! 23: // ! 24: ! 25: #include <ntddk.h> ! 26: #include <ntddtape.h> ! 27: #include "common.h" ! 28: #include "q117.h" ! 29: #include "protos.h" ! 30: ! 31: ! 32: STATUS ! 33: q117AppVolTD( ! 34: IN OUT PVOLUME_TABLE_ENTRY TheVolumeTable, ! 35: IN OUT PQ117_CONTEXT Context ! 36: ) ! 37: ! 38: /*++ ! 39: ! 40: Routine Description: ! 41: ! 42: Appends the VolDir to the tape directory. ! 43: ! 44: Arguments: ! 45: ! 46: TheVolumeTable - pointer to the volume directory to be added ! 47: ! 48: Context - ! 49: ! 50: Return Value: ! 51: ! 52: NoErr, any driver error ! 53: ! 54: --*/ ! 55: ! 56: { ! 57: LONG ret,i; ! 58: LONG tmpseqnum; ! 59: PIO_REQUEST ioreq; ! 60: VOLUME_TABLE_ENTRY scrvol; ! 61: PSEGMENT_BUFFER bufferInfo; ! 62: ! 63: ret =0; ! 64: ! 65: // ! 66: // Now compute the VolDir's checksum. ! 67: // ! 68: ! 69: TheVolumeTable->Signature=VolumeTableSig; ! 70: ! 71: // ! 72: // If we are updating a specific volume entry ! 73: // ! 74: ! 75: if (Context->ActiveVolumeNumber) { ! 76: ! 77: // ! 78: // must use temporary var because ReadVolumeEntry() updates ! 79: // ActiveVolumeNumber ! 80: // ! 81: ! 82: tmpseqnum = Context->ActiveVolumeNumber; ! 83: ret = q117SelectTD(Context); ! 84: ! 85: if (ret) { ! 86: ! 87: return(ret); ! 88: ! 89: } ! 90: ! 91: for (i=0;i<tmpseqnum;++i) { ! 92: ! 93: ret = q117ReadVolumeEntry(&scrvol,Context); ! 94: if (ret) { ! 95: ! 96: return(ret); ! 97: ! 98: } ! 99: ! 100: } ! 101: ! 102: // ! 103: // add in this volume table ! 104: // ! 105: ! 106: RtlMoveMemory(Context->CurrentOperation.SegmentPointer,TheVolumeTable,sizeof(*TheVolumeTable)); ! 107: Context->CurrentOperation.SegmentPointer=q117GetLastBuffer(Context); ! 108: ! 109: } else { ! 110: ! 111: if (!ret ) { ! 112: ! 113: Context->CurrentOperation.SegmentPointer=q117GetFreeBuffer(&bufferInfo,Context); ! 114: RtlZeroMemory( ! 115: Context->CurrentOperation.SegmentPointer, ! 116: q117GoodDataBytes(Context->CurrentTape.VolumeSegment,Context)); ! 117: ! 118: // ! 119: // add in this volume table ! 120: // ! 121: ! 122: RtlMoveMemory(Context->CurrentOperation.SegmentPointer,TheVolumeTable,sizeof(*TheVolumeTable)); ! 123: ! 124: } ! 125: } ! 126: ! 127: if (!ret) { ! 128: ! 129: // ! 130: // write out volume directory block ! 131: // ! 132: ! 133: if (!(ret = q117IssIOReq( ! 134: Context->CurrentOperation.SegmentPointer, ! 135: DWrite, ! 136: (LONG)Context->CurrentTape.VolumeSegment * BLOCKS_PER_SEGMENT, ! 137: bufferInfo, ! 138: Context))) { ! 139: ! 140: ioreq=q117Dequeue(WaitForItem, Context); ! 141: ret = ioreq->Status; ! 142: ! 143: } ! 144: } ! 145: ! 146: if (!ret) { ! 147: ! 148: ++Context->ActiveVolumeNumber; ! 149: ! 150: } ! 151: ! 152: return(ret); ! 153: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.