ReactOS  0.4.15-dev-3203-gacde1e0
FxDeviceDescriptionEntry Struct Reference

#include <fxchildlist.hpp>

Inheritance diagram for FxDeviceDescriptionEntry:
Collaboration diagram for FxDeviceDescriptionEntry:

Public Member Functions

 FxDeviceDescriptionEntry (__inout FxChildList *DeviceList, __in ULONG AddressDescriptionSize, __in ULONG IdentificationDescriptionSize)
 
 ~FxDeviceDescriptionEntry ()
 
_Must_inspect_result_ PVOID operator new (__in size_t AllocatorBlock, __in PFX_DRIVER_GLOBALS DriverGlobals, __in size_t TotalDescriptionSize)
 
FxChildListGetParentList (VOID)
 
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER GetId (VOID)
 
BOOLEAN IsDeviceReportedMissing (VOID)
 
BOOLEAN IsDeviceRemoved (VOID)
 
VOID ProcessDeviceRemoved (VOID)
 
VOID DeviceSurpriseRemoved (VOID)
 
_Must_inspect_result_ FxDeviceDescriptionEntryClone (__inout PLIST_ENTRY FreeListHead)
 
BOOLEAN MatchStateToFlags (__in ULONG Flags)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Protected Member Functions

BOOLEAN __inline IsPresent (VOID)
 
- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 

Static Protected Member Functions

static FxDeviceDescriptionEntry_FromDescriptionLink (__in PLIST_ENTRY Link)
 
static FxDeviceDescriptionEntry_FromModificationLink (__in PLIST_ENTRY Link)
 

Protected Attributes

LIST_ENTRY m_DescriptionLink
 
FxChildListDescriptionState m_DescriptionState
 
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription
 
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER m_AddressDescription
 
LIST_ENTRY m_ModificationLink
 
FxChildListModificationState m_ModificationState
 
CfxDevicem_Pdo
 
FxChildListm_DeviceList
 
BOOLEAN m_FoundInLastScan
 
BOOLEAN m_ProcessingSurpriseRemove
 
BOOLEAN m_PendingDeleteOnScanEnd
 
FxChildListReportedMissingCallbackState m_ReportedMissingCallbackState
 

Friends

class FxDevice
 
class FxChildList
 

Detailed Description

Definition at line 666 of file fxchildlist.hpp.

Constructor & Destructor Documentation

◆ FxDeviceDescriptionEntry()

FxDeviceDescriptionEntry::FxDeviceDescriptionEntry ( __inout FxChildList DeviceList,
__in ULONG  AddressDescriptionSize,
__in ULONG  IdentificationDescriptionSize 
)

Definition at line 31 of file fxchildlist.cpp.

36 {
39  this, WDF_ALIGN_SIZE_UP(sizeof(*this), sizeof(PVOID)));
40 
42  AddressDescriptionSize;
43 
48  WDF_ALIGN_SIZE_UP(AddressDescriptionSize, sizeof(PVOID)));
49 
52  }
53 
56 
58 
60 
64 
65  //
66  // The parent DO can go away while the child still exists (stuck in a
67  // suprise remove state w/an open handle). As such, when the parent is
68  // destroyed, it will release its reference on the FxChildList. Each
69  // description will have its own reference to the list to keep the list
70  // alive as long as the child DO exists.
71  //
72  m_DeviceList->ADDREF(this);
73 }
FxChildList * m_DeviceList
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
struct _WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER * PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER
PDEVICE_LIST DeviceList
Definition: utils.c:27
#define FALSE
Definition: types.h:117
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
FxChildListModificationState m_ModificationState
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER m_AddressDescription
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct _WDF_CHILD_ADDRESS_DESCRIPTION_HEADER * PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription
description Header IdentificationDescriptionSize

Referenced by Clone().

◆ ~FxDeviceDescriptionEntry()

FxDeviceDescriptionEntry::~FxDeviceDescriptionEntry ( )

Definition at line 75 of file fxchildlist.cpp.

76 {
77  m_DeviceList->RELEASE(this);
78 }
FxChildList * m_DeviceList

Member Function Documentation

◆ _FromDescriptionLink()

static FxDeviceDescriptionEntry* FxDeviceDescriptionEntry::_FromDescriptionLink ( __in PLIST_ENTRY  Link)
inlinestaticprotected

◆ _FromModificationLink()

static FxDeviceDescriptionEntry* FxDeviceDescriptionEntry::_FromModificationLink ( __in PLIST_ENTRY  Link)
inlinestaticprotected

Definition at line 781 of file fxchildlist.hpp.

784  {
785  return CONTAINING_RECORD(Link,
788  }
static int Link(const char **args)
Definition: vfdcmd.c:2414
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by FxChildList::BeginScan(), FxChildList::EndScan(), FxChildList::GetNextDevice(), FxChildList::GetNextStaticDevice(), FxChildList::NotifyDeviceSurpriseRemove(), FxChildList::ProcessModificationsLocked(), FxChildList::SearchBackwardsForMatchingModificationLocked(), FxChildList::UpdateAllAsPresent(), and FxChildList::UpdateDeviceAsMissing().

◆ Clone()

_Must_inspect_result_ FxDeviceDescriptionEntry * FxDeviceDescriptionEntry::Clone ( __inout PLIST_ENTRY  FreeListHead)

Definition at line 259 of file fxchildlist.cpp.

262 {
263  FxDeviceDescriptionEntry* pNewEntry;
265 
266  pNewEntry = new(m_DeviceList->GetDriverGlobals(),
271 
272  if (pNewEntry == NULL) {
273  return NULL;
274  }
275 
278 
282  }
283 
284  if (NT_SUCCESS(status)) {
285  pNewEntry->m_FoundInLastScan = TRUE;
286  }
287  else {
288  //
289  // Free it later
290  //
291  InsertTailList(FreeListHead, &pNewEntry->m_DescriptionLink);
292  pNewEntry = NULL;
293  }
294 
295  return pNewEntry;
296 }
FxChildList * m_DeviceList
BOOLEAN HasAddressDescriptions(VOID)
#define TRUE
Definition: types.h:120
_Must_inspect_result_ NTSTATUS DuplicateAddress(__out PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER Dest, __in PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER Source)
LONG NTSTATUS
Definition: precomp.h:26
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ NTSTATUS DuplicateId(__out PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Dest, __in PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Source)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER m_AddressDescription
ULONG m_AddressDescriptionSize
FxDeviceDescriptionEntry(__inout FxChildList *DeviceList, __in ULONG AddressDescriptionSize, __in ULONG IdentificationDescriptionSize)
Definition: fxchildlist.cpp:31
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
size_t m_TotalDescriptionSize
#define NULL
Definition: types.h:112
ULONG m_IdentificationDescriptionSize
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DeviceSurpriseRemoved()

VOID FxDeviceDescriptionEntry::DeviceSurpriseRemoved ( VOID  )

Definition at line 102 of file fxchildlist.cpp.

105 {
106  KIRQL irql;
107 
111 }
FxChildList * m_DeviceList
#define TRUE
Definition: types.h:120
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
KSPIN_LOCK m_ListLock
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by FxPkgPdo::_PnpSurpriseRemoval(), and FxPkgPdo::PnpEventSurpriseRemovePendingOverload().

◆ GetId()

PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER FxDeviceDescriptionEntry::GetId ( VOID  )
inline

Definition at line 697 of file fxchildlist.hpp.

700  {
702  }
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription

Referenced by FxPkgPdo::PnpEventEjectHardwareOverload().

◆ GetParentList()

FxChildList* FxDeviceDescriptionEntry::GetParentList ( VOID  )
inline

◆ IsDeviceRemoved()

BOOLEAN FxDeviceDescriptionEntry::IsDeviceRemoved ( VOID  )

Definition at line 148 of file fxchildlist.cpp.

151 {
152  KIRQL irql;
153  BOOLEAN removed;
155 
156  pList = GetParentList();
157  removed = FALSE;
159 
161 
163 
165  //
166  // We should delete this entry as it was reported missing.
167  //
169 
171 
172  //
173  // Remove from the current list if no scan going on.
174  // Note that the description entry can't be removed from list if scan
175  // count is > 0 because it might be part of an iterator that driver is
176  // still using to iterate thru the child list.
177  //
178  if (pList->GetScanCount() == 0) {
179  //
180  // Remove from the current list
181  //
184  }
185  else {
186  //
187  // The entry will be removed and deleted when scan count goes to
188  // zero by the scanning thread, so make sure pdo deosn't reference
189  // the entry any more.
190  //
192  if (m_Pdo != NULL) {
194  }
195  }
196 
197  removed = TRUE;
198 
199  //
200  // No need to add a reference to m_DeviceList becuase as we hold a
201  // reference to it already. This reference is bound by the lifetime
202  // of this object, so we can always safely touch m_DeviceList even if
203  // the FDO is gone before the child is removed.
204  //
205  }
206 
208 
209  return removed;
210 }
FxChildList * m_DeviceList
#define TRUE
Definition: types.h:120
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
KIRQL irql
Definition: wave.h:1
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
FxChildList * pList
KSPIN_LOCK m_ListLock
FxChildList * GetParentList(VOID)
unsigned char BOOLEAN
FxChildListModificationState m_ModificationState
FxChildListDescriptionState m_DescriptionState
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define ASSERT(a)
Definition: mode.c:44
__inline FxPkgPdo * GetPdoPkg(VOID)
Definition: fxdevice.hpp:1254
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
FxDeviceDescriptionEntry * m_Description
Definition: fxpkgpdo.hpp:40
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
ULONG GetScanCount(VOID)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by FxPkgPdo::PnpEventCheckForDevicePresenceOverload().

◆ IsDeviceReportedMissing()

BOOLEAN FxDeviceDescriptionEntry::IsDeviceReportedMissing ( VOID  )

Definition at line 114 of file fxchildlist.cpp.

131 {
132  KIRQL irql;
133  BOOLEAN result;
134 
137  result = TRUE;
138  }
139  else {
140  result = FALSE;
141  }
143 
144  return result;
145 }
FxChildList * m_DeviceList
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
KSPIN_LOCK m_ListLock
unsigned char BOOLEAN
FxChildListDescriptionState m_DescriptionState
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by FxPkgPdo::DeleteSymbolicLinkOverload().

◆ IsPresent()

BOOLEAN __inline FxDeviceDescriptionEntry::IsPresent ( VOID  )
inlineprotected

Definition at line 755 of file fxchildlist.hpp.

758  {
761  return TRUE;
762  }
763  else {
764  return FALSE;
765  }
766  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
FxChildListDescriptionState m_DescriptionState

◆ MatchStateToFlags()

BOOLEAN FxDeviceDescriptionEntry::MatchStateToFlags ( __in ULONG  Flags)
inline

◆ operator new()

_Must_inspect_result_ PVOID FxDeviceDescriptionEntry::operator new ( __in size_t  AllocatorBlock,
__in PFX_DRIVER_GLOBALS  DriverGlobals,
__in size_t  TotalDescriptionSize 
)

Definition at line 82 of file fxchildlist.cpp.

87 {
88  PVOID p;
89 
90  UNREFERENCED_PARAMETER(AllocatorBlock);
91 
92  p = FxPoolAllocate(FxDriverGlobals, NonPagedPool, TotalDescriptionSize);
93 
94  if (p != NULL) {
95  RtlZeroMemory(p, TotalDescriptionSize);
96  }
97 
98  return p;
99 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
GLfloat GLfloat p
Definition: glext.h:8902

◆ ProcessDeviceRemoved()

VOID FxDeviceDescriptionEntry::ProcessDeviceRemoved ( VOID  )

Definition at line 213 of file fxchildlist.cpp.

216 {
217  LIST_ENTRY freeHead;
218  KIRQL irql;
220 
222 
223  pList = GetParentList();
224  InitializeListHead(&freeHead);
226 
227  //
228  // Remove from the current list. In some cases the entry may not be in any
229  // list in which case RemoveEntryList() will be a noop.
230  // Note that the description entry can't be removed from list if scan count
231  // is > 0 because it might be part of an iterator that driver is still using
232  // to iterate thru the child list.
233  //
234  if (pList->GetScanCount() == 0 || IsListEmpty(&m_DescriptionLink)) {
236 
237  //
238  // Instead of reimplementing a single description cleanup, just use the
239  // version which cleans up a list.
240  //
241  InsertTailList(&freeHead, &m_DescriptionLink);
242  }
243  else {
244  //
245  // The entry will be removed when scan count goes to zero.
246  //
250  }
251 
253 
254  m_DeviceList->DrainFreeListHead(&freeHead);
255 }
FxChildList * m_DeviceList
#define TRUE
Definition: types.h:120
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
KIRQL irql
Definition: wave.h:1
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
FxChildList * pList
KSPIN_LOCK m_ListLock
FxChildList * GetParentList(VOID)
FxChildListModificationState m_ModificationState
FxChildListDescriptionState m_DescriptionState
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define ASSERT(a)
Definition: mode.c:44
VOID DrainFreeListHead(__inout PLIST_ENTRY FreeListHead)
Definition: typedefs.h:119
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
ULONG GetScanCount(VOID)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by FxPkgPdo::PnpEventPdoRemovedOverload().

Friends And Related Function Documentation

◆ FxChildList

friend class FxChildList
friend

Definition at line 668 of file fxchildlist.hpp.

◆ FxDevice

friend class FxDevice
friend

Definition at line 667 of file fxchildlist.hpp.

Member Data Documentation

◆ m_AddressDescription

PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER FxDeviceDescriptionEntry::m_AddressDescription
protected

Definition at line 797 of file fxchildlist.hpp.

Referenced by Clone(), FxChildList::CloneEntryLocked(), and FxDeviceDescriptionEntry().

◆ m_DescriptionLink

LIST_ENTRY FxDeviceDescriptionEntry::m_DescriptionLink
protected

◆ m_DescriptionState

FxChildListDescriptionState FxDeviceDescriptionEntry::m_DescriptionState
protected

◆ m_DeviceList

◆ m_FoundInLastScan

BOOLEAN FxDeviceDescriptionEntry::m_FoundInLastScan
protected

Definition at line 807 of file fxchildlist.hpp.

Referenced by Clone(), and FxDeviceDescriptionEntry().

◆ m_IdentificationDescription

PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER FxDeviceDescriptionEntry::m_IdentificationDescription
protected

Definition at line 795 of file fxchildlist.hpp.

Referenced by Clone(), FxDeviceDescriptionEntry(), and GetId().

◆ m_ModificationLink

LIST_ENTRY FxDeviceDescriptionEntry::m_ModificationLink
protected

Definition at line 799 of file fxchildlist.hpp.

Referenced by _FromModificationLink(), and FxDeviceDescriptionEntry().

◆ m_ModificationState

FxChildListModificationState FxDeviceDescriptionEntry::m_ModificationState
protected

◆ m_Pdo

CfxDevice* FxDeviceDescriptionEntry::m_Pdo
protected

Definition at line 803 of file fxchildlist.hpp.

Referenced by IsDeviceRemoved().

◆ m_PendingDeleteOnScanEnd

BOOLEAN FxDeviceDescriptionEntry::m_PendingDeleteOnScanEnd
protected

◆ m_ProcessingSurpriseRemove

BOOLEAN FxDeviceDescriptionEntry::m_ProcessingSurpriseRemove
protected

◆ m_ReportedMissingCallbackState

FxChildListReportedMissingCallbackState FxDeviceDescriptionEntry::m_ReportedMissingCallbackState
protected

Definition at line 813 of file fxchildlist.hpp.


The documentation for this struct was generated from the following files: