Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygeniowork.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Kernel 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: ntoskrnl/io/iowork.c 00005 * PURPOSE: I/O Wrappers for the Executive Work Item Functions 00006 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 00007 * Robert Dickenson (odin@pnc.com.au) 00008 */ 00009 00010 /* INCLUDES ******************************************************************/ 00011 00012 #include <ntoskrnl.h> 00013 #define NDEBUG 00014 #include <debug.h> 00015 00016 /* PRIVATE FUNCTIONS *********************************************************/ 00017 00018 VOID 00019 NTAPI 00020 IopWorkItemCallback(IN PVOID Parameter) 00021 { 00022 PIO_WORKITEM IoWorkItem = (PIO_WORKITEM)Parameter; 00023 PDEVICE_OBJECT DeviceObject = IoWorkItem->DeviceObject; 00024 PAGED_CODE(); 00025 00026 /* Call the work routine */ 00027 IoWorkItem->WorkerRoutine(DeviceObject, IoWorkItem->Context); 00028 00029 /* Dereference the device object */ 00030 ObDereferenceObject(DeviceObject); 00031 } 00032 00033 /* PUBLIC FUNCTIONS **********************************************************/ 00034 00035 /* 00036 * @implemented 00037 */ 00038 VOID 00039 NTAPI 00040 IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, 00041 IN PIO_WORKITEM_ROUTINE WorkerRoutine, 00042 IN WORK_QUEUE_TYPE QueueType, 00043 IN PVOID Context) 00044 { 00045 /* Make sure we're called at DISPATCH or lower */ 00046 ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); 00047 00048 /* Reference the device object */ 00049 ObReferenceObject(IoWorkItem->DeviceObject); 00050 00051 /* Setup the work item */ 00052 IoWorkItem->WorkerRoutine = WorkerRoutine; 00053 IoWorkItem->Context = Context; 00054 00055 /* Queue the work item */ 00056 ExQueueWorkItem(&IoWorkItem->Item, QueueType); 00057 } 00058 00059 /* 00060 * @implemented 00061 */ 00062 VOID 00063 NTAPI 00064 IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem) 00065 { 00066 /* Free the work item */ 00067 ExFreePool(IoWorkItem); 00068 } 00069 00070 /* 00071 * @implemented 00072 */ 00073 PIO_WORKITEM 00074 NTAPI 00075 IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject) 00076 { 00077 PIO_WORKITEM IoWorkItem; 00078 00079 /* Allocate the work item */ 00080 IoWorkItem = ExAllocatePoolWithTag(NonPagedPool, 00081 sizeof(IO_WORKITEM), 00082 TAG_IOWI); 00083 if (!IoWorkItem) return NULL; 00084 00085 /* Initialize it */ 00086 IoWorkItem->DeviceObject = DeviceObject; 00087 ExInitializeWorkItem(&IoWorkItem->Item, IopWorkItemCallback, IoWorkItem); 00088 00089 /* Return it */ 00090 return IoWorkItem; 00091 } 00092 00093 /* EOF */ Generated on Mon May 28 2012 04:37:12 for ReactOS by
1.7.6.1
|