ReactOS 0.4.16-dev-329-g9223134
fxspinlockapi.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxSpinLockAPI.cpp
8
9Abstract:
10
11 This module implements external APIS to access FxSpinLock
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23--*/
24
25#include "fxsupportpch.hpp"
26#include "fxspinlock.hpp"
27
28extern "C" {
29// #include "FxSpinLockAPI.tmh"
30}
31
32//
33// Extern the entire file
34//
35extern "C" {
36
41WDFEXPORT(WdfSpinLockCreate)(
42 __in
46 __out
47 WDFSPINLOCK* SpinLock
48 )
49{
50 DDI_ENTRY();
51
55 WDFSPINLOCK lock;
57
59
60 //
61 // Get the parent's globals if it is present
62 //
66
68 SpinLockAttributes->ParentObject,
70 (PVOID*)&pParent,
72 }
73
75
78 return status;
79 }
80
83 }
84 else {
85 extra = 0;
86 }
87
88 *SpinLock = NULL;
89
92
93 if (pLock == NULL) {
95 }
96
98
100 *SpinLock = lock;
101 }
102 else {
104 }
105
106 return status;
107}
108
111VOID
113WDFEXPORT(WdfSpinLockAcquire)(
114 __in
116 __in
119 _Acquires_lock_(_Curr_)
120 WDFSPINLOCK SpinLock
121 )
122{
123 DDI_ENTRY();
124
127
129 SpinLock,
131 (PVOID*) &pLock,
133
134 if (pLock->IsInterruptLock()) {
136 "WDFSPINLOCK %p is associated with an interrupt, "
137 "cannot be used for normal sync operations",
138 SpinLock);
140 return;
141 }
142
143 pLock->AcquireLock(
145}
146
149VOID
151WDFEXPORT(WdfSpinLockRelease)(
152 __in
154 __in
157 _Releases_lock_(_Curr_)
158 WDFSPINLOCK SpinLock
159 )
160{
161 DDI_ENTRY();
162
165
167 SpinLock,
169 (PVOID*) &pLock,
171
172 if (pLock->IsInterruptLock()) {
174 "WDFSPINLOCK %p is associated with an interrupt, "
175 "cannot be used for normal sync operations",
176 SpinLock);
178 return;
179 }
180
181 pLock->ReleaseLock();
182}
183
184} // extern "C"
LONG NTSTATUS
Definition: precomp.h:26
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
BOOLEAN IsInterruptLock(VOID)
Definition: fxspinlock.hpp:81
#define _Acquires_lock_(lock)
#define _Requires_lock_held_(lock)
#define _Requires_lock_not_held_(lock)
#define _Releases_lock_(lock)
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define TRACINGERROR
Definition: dbgtrace.h:63
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define __drv_savesIRQL
Definition: driverspecs.h:326
#define __drv_restoresIRQL
Definition: driverspecs.h:322
#define __drv_raisesIRQL(irql)
Definition: driverspecs.h:312
#define __drv_maxIRQL(irql)
Definition: driverspecs.h:291
#define __drv_minIRQL(irql)
Definition: driverspecs.h:293
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxObject * pParent
Definition: fxdpcapi.cpp:86
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
_Must_inspect_result_ __in_opt PWDF_OBJECT_ATTRIBUTES SpinLockAttributes
_Must_inspect_result_ __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFSPINLOCK * SpinLock
WDFSPINLOCK lock
USHORT extra
NTSTATUS status
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxSpinLock * pLock
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
@ FX_TYPE_SPIN_LOCK
Definition: fxtypes.h:77
_Must_inspect_result_ NTSTATUS __inline FxValidateObjectAttributesForParentHandle(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
#define _ReturnAddress()
Definition: intrin_arm.h:35
#define _Must_inspect_result_
Definition: no_sal2.h:62
unsigned short USHORT
Definition: pedump.c:61
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
BOOLEAN FxVerifierLock
Definition: fxglobals.h:451
Definition: ps.c:97
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STDCALL
Definition: wdf.h:45
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES SpinLockAttributes
Definition: wdfsync.h:225