ReactOS  0.4.14-dev-342-gdc047f9
iowork.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/io/iomgr/iowork.c
5  * PURPOSE: I/O Wrappers for the Executive Work Item Functions
6  * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7  * Robert Dickenson (odin@pnc.com.au)
8  */
9 
10 /* INCLUDES ******************************************************************/
11 
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* PRIVATE FUNCTIONS *********************************************************/
17 
18 VOID
19 NTAPI
21 {
23  PDEVICE_OBJECT DeviceObject = IoWorkItem->DeviceObject;
24  PAGED_CODE();
25 
26  /* Call the work routine */
27  IoWorkItem->WorkerRoutine(DeviceObject, IoWorkItem->Context);
28 
29  /* Dereference the device object */
31 }
32 
33 /* PUBLIC FUNCTIONS **********************************************************/
34 
35 /*
36  * @implemented
37  */
38 VOID
39 NTAPI
44 {
45  /* Make sure we're called at DISPATCH or lower */
47 
48  /* Reference the device object */
49  ObReferenceObject(IoWorkItem->DeviceObject);
50 
51  /* Setup the work item */
52  IoWorkItem->WorkerRoutine = WorkerRoutine;
53  IoWorkItem->Context = Context;
54 
55  /* Queue the work item */
57 }
58 
59 /*
60  * @implemented
61  */
62 VOID
63 NTAPI
65 {
66  /* Free the work item */
68 }
69 
70 /*
71  * @implemented
72  */
74 NTAPI
76 {
78 
79  /* Allocate the work item */
81  sizeof(IO_WORKITEM),
82  TAG_IOWI);
83  if (!IoWorkItem) return NULL;
84 
85  /* Initialize it */
86  IoWorkItem->DeviceObject = DeviceObject;
88 
89  /* Return it */
90  return IoWorkItem;
91 }
92 
93 /* EOF */
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define IN
Definition: typedefs.h:38
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
IO_WORKITEM_ROUTINE * PIO_WORKITEM_ROUTINE
Definition: iotypes.h:483
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine
Definition: fltkernel.h:1977
_In_opt_ PVOID _In_ PIO_WORKITEM IoWorkItem
Definition: iotypes.h:488
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_In_ PVOID Parameter
Definition: ldrtypes.h:241
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
smooth NULL
Definition: ftsmooth.c:416
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
enum _WORK_QUEUE_TYPE WORK_QUEUE_TYPE
#define TAG_IOWI
Definition: tag.h:76
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID NTAPI IopWorkItemCallback(IN PVOID Parameter)
Definition: iowork.c:20
#define ObReferenceObject
Definition: obfuncs.h:204
struct tagContext Context
Definition: acpixf.h:1030
struct _IO_WORKITEM * PIO_WORKITEM
Definition: iotypes.h:474
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_Must_inspect_result_ _In_ PFLT_CALLBACK_DATA _In_ PFLT_DEFERRED_IO_WORKITEM_ROUTINE _In_ WORK_QUEUE_TYPE QueueType
Definition: fltkernel.h:1977