Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

queue.h

Go to the documentation of this file.
00001 /*
00002  *  This program is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU General Public License
00004  *  as published by the Free Software Foundation; either version
00005  *  2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 2004 Spiro Trikaliotis
00008  *
00009  */
00010 
00020 #ifndef SRT_QUEUE_H
00021 #define SRT_QUEUE_H
00022 
00023 #ifdef CSQ_STATIC
00024 #include <csq.h>
00025 #endif
00026 
00029 typedef NTSTATUS (*PCBMDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
00030 
00041 typedef
00042 struct QUEUE
00043 {
00045     IO_CSQ IrpQueue;
00046 
00048     LIST_ENTRY IrpListHead;
00049 
00051     KSPIN_LOCK IrpListSpinlock;
00052 
00054     KEVENT NotEmptyEvent;
00055 
00056 #ifdef USE_FAST_START_THREAD
00057 
00060     KEVENT BackSignalEvent;
00061 
00062 #endif // #ifdef USE_FAST_START_THREAD
00063 
00065     PCBMDRIVER_STARTIO DriverStartIo;
00066 
00069     LONG IsStalled;
00070 
00074     LONG IsDropping;
00075 
00078     NTSTATUS DroppingReturnStatus;
00079 
00081     PIRP CurrentIrp;
00082 
00083 } QUEUE, *PQUEUE;
00084 
00085 /* For performance reasons, these two functions are defined as macros
00086    in release builds of the driver.
00087    They do not need any protecting by synchronization primitives, as their
00088    state could have changed on return in either way. This, the caller has
00089    to make sure that is obtains exactly the state it wants to know.
00090 */
00091 #ifndef DBG
00092 
00094     #define QueueIsStalled(_Queue_) (_Queue_->IsStalled ? 1 : 0)
00095 
00097     #define QueueIsDropping(_Queue_) (_Queue_->IsDropping ? 1 : 0)
00098 
00099 #endif
00100 
00101 extern VOID
00102 QueueInit(PQUEUE Queue, PCBMDRIVER_STARTIO DriverStartIo);
00103 
00104 extern NTSTATUS
00105 QueueCompleteIrp(PQUEUE Queue, PIRP Irp, NTSTATUS StatusCode, ULONG_PTR Information);
00106 
00107 extern NTSTATUS
00108 QueueStartPacket(PQUEUE Queue, PIRP Irp, BOOLEAN FastStart, PDEVICE_OBJECT Fdo);
00109 
00110 extern NTSTATUS
00111 QueuePoll(PQUEUE Queue, PDEVICE_OBJECT Fdo);
00112 
00113 extern NTSTATUS
00114 QueueSignal(PQUEUE Queue);
00115 
00116 extern NTSTATUS
00117 QueueCleanup(PQUEUE Queue, PFILE_OBJECT FileObject);
00118 
00119 extern BOOLEAN
00120 QueueShouldCancelCurrentIrp(PQUEUE Queue);
00121 
00122 #endif /* #ifndef SRT_QUEUE_H */

Generated on Sun Apr 30 18:45:58 2006 for opencbm by  doxygen 1.4.2