ReactOS
0.4.16-dev-91-g764881a
fxrelateddevicelist.cpp
Go to the documentation of this file.
1
/*++
2
3
Copyright (c) Microsoft Corporation. All rights reserved.
4
5
Module Name:
6
7
FxDependentList.cpp
8
9
Abstract:
10
This object derives from the transactioned list and provides a unique
11
object check during the addition of an item.
12
13
Author:
14
15
16
17
Environment:
18
19
Kernel mode only
20
21
Revision History:
22
23
--*/
24
25
#include "
fxsupportpch.hpp
"
26
27
_Must_inspect_result_
28
NTSTATUS
29
FxRelatedDeviceList::Add
(
30
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
31
__inout
FxRelatedDevice
*
Entry
32
)
33
{
34
return
FxSpinLockTransactionedList::Add
(FxDriverGlobals,
35
&
Entry
->m_TransactionedEntry);
36
}
37
38
VOID
39
FxRelatedDeviceList::Remove
(
40
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
41
__in
PDEVICE_OBJECT
Device
42
)
43
{
44
SearchForAndRemove
(FxDriverGlobals, (
PVOID
)
Device
);
45
}
46
47
_Must_inspect_result_
48
FxRelatedDevice
*
49
FxRelatedDeviceList::GetNextEntry
(
50
__in_opt
FxRelatedDevice
*
Entry
51
)
52
{
53
FxTransactionedEntry
*pReturn, *
pEntry
;
54
55
if
(
Entry
==
NULL
) {
56
pEntry
=
NULL
;
57
}
58
else
{
59
pEntry
= &
Entry
->m_TransactionedEntry;
60
}
61
62
pReturn =
FxSpinLockTransactionedList::GetNextEntry
(
pEntry
);
63
64
if
(pReturn !=
NULL
) {
65
return
CONTAINING_RECORD
(pReturn,
FxRelatedDevice
, m_TransactionedEntry);
66
}
67
else
{
68
return
NULL
;
69
}
70
}
71
72
_Must_inspect_result_
73
NTSTATUS
74
FxRelatedDeviceList::ProcessAdd
(
75
__in
FxTransactionedEntry
*NewEntry
76
)
77
{
78
FxRelatedDevice
* pNew, *pInList;
79
FxTransactionedEntry
*
pEntry
;
80
PLIST_ENTRY
ple
;
81
82
pNew =
CONTAINING_RECORD
(NewEntry,
FxRelatedDevice
, m_TransactionedEntry);
83
84
pEntry
=
NULL
;
85
86
//
87
// Go over the transactions first because the device could be in the real
88
// list with a transaction to remove it, so we catch first here instead
89
// of adding complexity to the iteration of the already inserted list.
90
//
91
for
(
ple
=
m_TransactionHead
.
Flink
;
92
ple
!= &
m_TransactionHead
;
93
ple
=
ple
->Flink) {
94
pEntry
=
FxTransactionedEntry::_FromEntry
(
ple
);
95
pInList =
CONTAINING_RECORD
(
pEntry
,
FxRelatedDevice
, m_TransactionedEntry);
96
97
if
(pInList->
m_DeviceObject
== pNew->
m_DeviceObject
) {
98
if
(
pEntry
->GetTransactionAction() ==
FxTransactionActionAdd
) {
99
//
100
// An additional add, failure
101
//
102
return
STATUS_DUPLICATE_OBJECTID
;
103
}
104
105
106
// Removal is OK b/c our add will be right behind it
107
//
108
ASSERT
(
pEntry
->GetTransactionAction() ==
FxTransactionActionRemove
);
109
return
STATUS_SUCCESS
;
110
}
111
}
112
113
pEntry
=
NULL
;
114
while
((
pEntry
=
FxSpinLockTransactionedList::GetNextEntryLocked
(
pEntry
)) !=
NULL
) {
// __super call
115
pInList =
CONTAINING_RECORD
(
pEntry
,
FxRelatedDevice
, m_TransactionedEntry);
116
117
if
(pInList->
m_DeviceObject
== pNew->
m_DeviceObject
) {
118
return
STATUS_DUPLICATE_OBJECTID
;
119
}
120
}
121
122
return
STATUS_SUCCESS
;
123
}
124
125
BOOLEAN
126
FxRelatedDeviceList::Compare
(
127
__in
FxTransactionedEntry
*
Entry
,
128
__in
PVOID
Data
129
)
130
{
131
FxRelatedDevice
*pRelated;
132
133
pRelated =
CONTAINING_RECORD
(
Entry
,
FxRelatedDevice
, m_TransactionedEntry);
134
135
return
pRelated->
GetDevice
() == (
PDEVICE_OBJECT
)
Data
?
TRUE
:
FALSE
;
136
}
137
138
VOID
139
FxRelatedDeviceList::EntryRemoved
(
140
__in
FxTransactionedEntry
*
Entry
141
)
142
{
143
FxRelatedDevice
*pRelated;
144
145
pRelated =
CONTAINING_RECORD
(
Entry
,
FxRelatedDevice
, m_TransactionedEntry);
146
147
if
(pRelated->
m_State
==
RelatedDeviceStateReportedPresent
) {
148
m_NeedReportMissing
++;
149
}
150
}
BOOLEAN
unsigned char BOOLEAN
Definition:
ProcessorBind.h:185
NTSTATUS
LONG NTSTATUS
Definition:
precomp.h:26
FxRelatedDeviceList::Add
_Must_inspect_result_ NTSTATUS Add(__in PFX_DRIVER_GLOBALS Globals, __inout FxRelatedDevice *Entry)
Definition:
fxrelateddevicelist.cpp:29
FxRelatedDeviceList::Remove
VOID Remove(__in PFX_DRIVER_GLOBALS Globals, __in MdDeviceObject Device)
Definition:
fxrelateddevicelist.cpp:39
FxRelatedDeviceList::Compare
virtual BOOLEAN Compare(__in FxTransactionedEntry *Entry, __in PVOID Data)
Definition:
fxrelateddevicelist.cpp:126
FxRelatedDeviceList::GetNextEntry
_Must_inspect_result_ FxRelatedDevice * GetNextEntry(__in_opt FxRelatedDevice *Entry)
Definition:
fxrelateddevicelist.cpp:49
FxRelatedDeviceList::m_NeedReportMissing
ULONG m_NeedReportMissing
Definition:
fxrelateddevicelist.hpp:109
FxRelatedDeviceList::ProcessAdd
virtual _Must_inspect_result_ NTSTATUS ProcessAdd(__in FxTransactionedEntry *Entry)
Definition:
fxrelateddevicelist.cpp:74
FxRelatedDeviceList::EntryRemoved
virtual VOID EntryRemoved(__in FxTransactionedEntry *Entry)
Definition:
fxrelateddevicelist.cpp:139
FxRelatedDevice
Definition:
fxrelateddevice.hpp:36
FxRelatedDevice::m_DeviceObject
MdDeviceObject m_DeviceObject
Definition:
fxrelateddevice.hpp:42
FxRelatedDevice::GetDevice
MdDeviceObject GetDevice(VOID)
Definition:
fxrelateddevice.hpp:58
FxRelatedDevice::m_State
FxRelatedDeviceState m_State
Definition:
fxrelateddevice.hpp:45
FxTransactionedList::GetNextEntryLocked
_Must_inspect_result_ FxTransactionedEntry * GetNextEntryLocked(__in_opt FxTransactionedEntry *Entry)
Definition:
fxtransactionedlist.cpp:458
FxTransactionedList::GetNextEntry
_Must_inspect_result_ FxTransactionedEntry * GetNextEntry(__in_opt FxTransactionedEntry *Entry)
Definition:
fxtransactionedlist.cpp:432
FxTransactionedList::SearchForAndRemove
VOID SearchForAndRemove(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID EntryData)
Definition:
fxtransactionedlist.cpp:304
FxTransactionedList::m_TransactionHead
LIST_ENTRY m_TransactionHead
Definition:
fxtransactionedlist.hpp:218
FxTransactionedList::Add
NTSTATUS Add(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxTransactionedEntry *Entry)
Definition:
fxtransactionedlist.cpp:263
__in
#define __in
Definition:
dbghelp.h:35
__inout
#define __inout
Definition:
dbghelp.h:50
__in_opt
#define __in_opt
Definition:
dbghelp.h:38
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
PDEVICE_OBJECT
struct _DEVICE_OBJECT * PDEVICE_OBJECT
ple
PSINGLE_LIST_ENTRY ple
Definition:
fxdeviceinterfaceapi.cpp:184
pEntry
PLIST_ENTRY pEntry
Definition:
fxioqueue.cpp:4484
RelatedDeviceStateReportedPresent
@ RelatedDeviceStateReportedPresent
Definition:
fxrelateddevice.hpp:32
FxTransactionActionAdd
@ FxTransactionActionAdd
Definition:
fxtransactionedlist.hpp:30
FxTransactionActionRemove
@ FxTransactionActionRemove
Definition:
fxtransactionedlist.hpp:31
void
Definition:
nsiface.idl:2307
ASSERT
#define ASSERT(a)
Definition:
mode.c:44
_Must_inspect_result_
#define _Must_inspect_result_
Definition:
ms_sal.h:558
STATUS_DUPLICATE_OBJECTID
#define STATUS_DUPLICATE_OBJECTID
Definition:
ntstatus.h:686
fxsupportpch.hpp
STATUS_SUCCESS
#define STATUS_SUCCESS
Definition:
shellext.h:65
Data
Definition:
sort_test.cpp:77
Entry
base of all file and directory entries
Definition:
entries.h:83
FxTransactionedEntry
Definition:
fxtransactionedlist.hpp:34
FxTransactionedEntry::_FromEntry
static FxTransactionedEntry * _FromEntry(__in PLIST_ENTRY Entry)
Definition:
fxtransactionedlist.hpp:65
_DEVICE_OBJECT
Definition:
env_spec_w32.h:413
_FX_DRIVER_GLOBALS
Definition:
fxglobals.h:165
_LIST_ENTRY
Definition:
typedefs.h:120
_LIST_ENTRY::Flink
struct _LIST_ENTRY * Flink
Definition:
typedefs.h:121
CONTAINING_RECORD
#define CONTAINING_RECORD(address, type, field)
Definition:
typedefs.h:260
Device
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition:
wdfchildlist.h:474
sdk
lib
drivers
wdf
kmdf
src
support
fxrelateddevicelist.cpp
Generated on Fri Oct 4 2024 06:13:20 for ReactOS by
1.9.6