/*
* Cancel-Safe Queue Library
- * Copyright (c) 2004, Vizzini (vizzini@plasmic.com)
- * Licensed under the GNU GPL for the ReactOS project
+ * Created in 2004 by Vizzini (vizzini@plasmic.com)
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAIMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
*
* This header defines the interface to the ReactOS Cancel-Safe Queue library.
* This interface is based on and is similar to the Microsoft Cancel-Safe
*
* USAGE
*
- * This library follows exactly the same interface as the Microsoft Cancel-Safe Queue
- * routines (IoCsqXxx()). As such, the authoritative reference is the
+ * This library follows exactly the same interface as the Microsoft Cancel-Safe
+ * Queue routines (IoCsqXxx()). As such, the authoritative reference is the
* current DDK. There is also a DDK sample called "cancel" that has an
* example of how to use this code. I have also provided a sample driver
* that makes use of this queue. Finally, please do read the header and the
#ifndef _REACTOS_CSQ_H
#define _REACTOS_CSQ_H
+/*
+ * Prevent including the CSQ definitions twice. They're present in NTDDK
+ * now too, except the *_EX versions.
+ */
+#ifndef IO_TYPE_CSQ_IRP_CONTEXT
+
struct _IO_CSQ;
* Function to insert an IRP in the queue. No need to worry about locking;
* just tack it onto your list or something.
*
- * Sample implementation:
+ * Sample implementation:
*
VOID NTAPI CsqInsertIrp(PIO_CSQ Csq, PIRP Irp)
{
PIRP Irp);
-/*
- * Function to insert an IRP into the queue with extended context information.
- * This is useful if you need to be able to de-queue particular IRPs more
- * easily in some cases.
- *
- * Same deal as above; sample implementation:
- *
- NTSTATUS NTAPI CsqInsertIrpEx(PIO_CSQ Csq, PIRP Irp, PVOID InsertContext)
- {
- CsqInsertIrp(Csq, Irp);
- return STATUS_PENDING;
- }
- *
- */
-typedef NTSTATUS (NTAPI *PIO_CSQ_INSERT_IRP_EX) (struct _IO_CSQ *Csq,
- PIRP Irp,
- PVOID InsertContext);
-
/*
* Function to remove an IRP from the queue.
*
/*
* Finally, this is called by the queue library when it wants to complete
* a canceled IRP.
- *
+ *
* Sample:
*
VOID NTAPI CsqCompleteCancelledIrp(PIO_CSQ Csq, PIRP Irp)
*/
#define IO_TYPE_CSQ_IRP_CONTEXT 1
#define IO_TYPE_CSQ 2
-#define IO_TYPE_CSQ_EX 3
/*
* IO_CSQ - Queue control structure
PIO_CSQ Csq;
} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
+#endif /* IO_TYPE_CSQ_IRP_CONTEXT */
+
+/* See IO_TYPE_CSQ_* above */
+#define IO_TYPE_CSQ_EX 3
+
+/*
+ * Function to insert an IRP into the queue with extended context information.
+ * This is useful if you need to be able to de-queue particular IRPs more
+ * easily in some cases.
+ *
+ * Same deal as above; sample implementation:
+ *
+ NTSTATUS NTAPI CsqInsertIrpEx(PIO_CSQ Csq, PIRP Irp, PVOID InsertContext)
+ {
+ CsqInsertIrp(Csq, Irp);
+ return STATUS_PENDING;
+ }
+ *
+ */
+typedef NTSTATUS (NTAPI *PIO_CSQ_INSERT_IRP_EX) (struct _IO_CSQ *Csq,
+ PIRP Irp,
+ PVOID InsertContext);
/*
* CANCEL-SAFE QUEUE DDIs
* As long as the Csq struct and the functions you pass in are resident,
* there are no IRQL restrictions.
*/
+NTKERNELAPI
NTSTATUS NTAPI IoCsqInitialize(PIO_CSQ Csq,
PIO_CSQ_INSERT_IRP CsqInsertIrp,
PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
* CsqInsertIrp. This eventually allows you to supply extra tracking
* information for use with the queue.
*/
+NTKERNELAPI
NTSTATUS NTAPI IoCsqInitializeEx(PIO_CSQ Csq,
PIO_CSQ_INSERT_IRP_EX CsqInsertIrpEx,
PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
/*
* Insert an IRP into the queue
*/
+NTKERNELAPI
VOID NTAPI IoCsqInsertIrp(PIO_CSQ Csq,
PIRP Irp,
PIO_CSQ_IRP_CONTEXT Context);
* Insert an IRP into the queue, with special context maintained that
* makes it easy to find IRPs in the queue
*/
+NTKERNELAPI
NTSTATUS NTAPI IoCsqInsertIrpEx(PIO_CSQ Csq,
PIRP Irp,
PIO_CSQ_IRP_CONTEXT Context,
/*
* Remove a particular IRP from the queue
*/
+NTKERNELAPI
PIRP NTAPI IoCsqRemoveIrp(PIO_CSQ Csq,
PIO_CSQ_IRP_CONTEXT Context);
/*
- * Remove the next IRP from the queue
+ * Remove the next IRP from the queue
*/
+NTKERNELAPI
PIRP NTAPI IoCsqRemoveNextIrp(PIO_CSQ Csq,
PVOID PeekContext);