|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1991, 1992, 1993 Microsoft Corporation ! 4: ! 5: Module Name: ! 6: ! 7: flush.c ! 8: ! 9: Abstract: ! 10: ! 11: This module contains the code that is very specific to flush ! 12: operations in the serial driver ! 13: ! 14: Author: ! 15: ! 16: Anthony V. Ercolano 26-Sep-1991 ! 17: ! 18: Environment: ! 19: ! 20: Kernel mode ! 21: ! 22: Revision History : ! 23: ! 24: --*/ ! 25: ! 26: #include <stddef.h> ! 27: #include "ntddk.h" ! 28: #include "ntddser.h" ! 29: #include "serial.h" ! 30: #include "serialp.h" ! 31: ! 32: ! 33: NTSTATUS ! 34: SerialStartFlush( ! 35: IN PSERIAL_DEVICE_EXTENSION Extension ! 36: ); ! 37: ! 38: ! 39: NTSTATUS ! 40: SerialFlush( ! 41: IN PDEVICE_OBJECT DeviceObject, ! 42: IN PIRP Irp ! 43: ) ! 44: ! 45: /*++ ! 46: ! 47: Routine Description: ! 48: ! 49: This is the dispatch routine for flush. Flushing works by placing ! 50: this request in the write queue. When this request reaches the ! 51: front of the write queue we simply complete it since this implies ! 52: that all previous writes have completed. ! 53: ! 54: Arguments: ! 55: ! 56: DeviceObject - Pointer to the device object for this device ! 57: ! 58: Irp - Pointer to the IRP for the current request ! 59: ! 60: Return Value: ! 61: ! 62: Could return status success, cancelled, or pending. ! 63: ! 64: --*/ ! 65: ! 66: { ! 67: ! 68: PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension; ! 69: ! 70: SerialDump( ! 71: SERIRPPATH, ! 72: ("SERIAL: Dispatch entry for: %x\n",Irp) ! 73: ); ! 74: Irp->IoStatus.Information = 0L; ! 75: ! 76: if (SerialCompleteIfError( ! 77: DeviceObject, ! 78: Irp ! 79: ) != STATUS_SUCCESS) { ! 80: ! 81: return STATUS_CANCELLED; ! 82: ! 83: } ! 84: ! 85: return SerialStartOrQueue( ! 86: Extension, ! 87: Irp, ! 88: &Extension->WriteQueue, ! 89: &Extension->CurrentWriteIrp, ! 90: SerialStartFlush ! 91: ); ! 92: ! 93: } ! 94: ! 95: NTSTATUS ! 96: SerialStartFlush( ! 97: IN PSERIAL_DEVICE_EXTENSION Extension ! 98: ) ! 99: ! 100: /*++ ! 101: ! 102: Routine Description: ! 103: ! 104: This routine is called if there were no writes in the queue. ! 105: The flush became the current write because there was nothing ! 106: in the queue. Note however that does not mean there is ! 107: nothing in the queue now! So, we will start off the write ! 108: that might follow us. ! 109: ! 110: Arguments: ! 111: ! 112: Extension - Points to the serial device extension ! 113: ! 114: Return Value: ! 115: ! 116: This will always return STATUS_SUCCESS. ! 117: ! 118: --*/ ! 119: ! 120: { ! 121: ! 122: PIRP NewIrp; ! 123: ! 124: Extension->CurrentWriteIrp->IoStatus.Status = STATUS_SUCCESS; ! 125: ! 126: // ! 127: // The following call will actually complete the flush. ! 128: // ! 129: ! 130: SerialGetNextWrite( ! 131: &Extension->CurrentWriteIrp, ! 132: &Extension->WriteQueue, ! 133: &NewIrp, ! 134: TRUE ! 135: ); ! 136: ! 137: if (NewIrp) { ! 138: ! 139: ASSERT(NewIrp == Extension->CurrentWriteIrp); ! 140: SerialStartWrite(Extension); ! 141: ! 142: } ! 143: ! 144: return STATUS_SUCCESS; ! 145: ! 146: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.