mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 01:13:04 -05:00
Major refactoring: WIP
This commit is contained in:
parent
19923395c7
commit
801970e971
@ -100,7 +100,6 @@ NTSTATUS FspDeviceCreateSecure(UINT32 Kind, ULONG ExtraSize,
|
|||||||
DeviceExtension = FspDeviceExtension(DeviceObject);
|
DeviceExtension = FspDeviceExtension(DeviceObject);
|
||||||
KeInitializeSpinLock(&DeviceExtension->SpinLock);
|
KeInitializeSpinLock(&DeviceExtension->SpinLock);
|
||||||
DeviceExtension->RefCount = 1;
|
DeviceExtension->RefCount = 1;
|
||||||
ExInitializeResourceLite(&DeviceExtension->Resource);
|
|
||||||
DeviceExtension->Kind = Kind;
|
DeviceExtension->Kind = Kind;
|
||||||
|
|
||||||
switch (Kind)
|
switch (Kind)
|
||||||
@ -115,10 +114,7 @@ NTSTATUS FspDeviceCreateSecure(UINT32 Kind, ULONG ExtraSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
{
|
|
||||||
ExDeleteResourceLite(&DeviceExtension->Resource);
|
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
*PDeviceObject = DeviceObject;
|
*PDeviceObject = DeviceObject;
|
||||||
|
|
||||||
@ -177,7 +173,6 @@ VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExDeleteResourceLite(&DeviceExtension->Resource);
|
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,6 +242,9 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject)
|
|||||||
ExInitializeWorkItem(&FsvolDeviceExtension->ExpirationWorkItem,
|
ExInitializeWorkItem(&FsvolDeviceExtension->ExpirationWorkItem,
|
||||||
FspFsvolDeviceExpirationRoutine, DeviceObject);
|
FspFsvolDeviceExpirationRoutine, DeviceObject);
|
||||||
|
|
||||||
|
/* initialize our resource */
|
||||||
|
ExInitializeResourceLite(&FsvolDeviceExtension->Resource);
|
||||||
|
|
||||||
/* initialize our generic table */
|
/* initialize our generic table */
|
||||||
RtlInitializeGenericTableAvl(&FsvolDeviceExtension->GenericTable,
|
RtlInitializeGenericTableAvl(&FsvolDeviceExtension->GenericTable,
|
||||||
FspFsvolDeviceCompareElement, FspFsvolDeviceAllocateElement, FspFsvolDeviceFreeElement, 0);
|
FspFsvolDeviceCompareElement, FspFsvolDeviceAllocateElement, FspFsvolDeviceFreeElement, 0);
|
||||||
@ -305,6 +303,9 @@ static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject)
|
|||||||
/* free the spare VPB if we still have it */
|
/* free the spare VPB if we still have it */
|
||||||
if (0 != FsvolDeviceExtension->SwapVpb)
|
if (0 != FsvolDeviceExtension->SwapVpb)
|
||||||
FspFreeExternal(FsvolDeviceExtension->SwapVpb);
|
FspFreeExternal(FsvolDeviceExtension->SwapVpb);
|
||||||
|
|
||||||
|
/* delete our resource */
|
||||||
|
ExDeleteResourceLite(&FsvolDeviceExtension->Resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID FspFsvolDeviceTimerRoutine(PDEVICE_OBJECT DeviceObject, PVOID Context)
|
static VOID FspFsvolDeviceTimerRoutine(PDEVICE_OBJECT DeviceObject, PVOID Context)
|
||||||
@ -364,7 +365,7 @@ PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Base.Resource));
|
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Resource));
|
||||||
|
|
||||||
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Result;
|
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Result;
|
||||||
|
|
||||||
@ -379,7 +380,7 @@ PVOID FspFsvolDeviceInsertContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Base.Resource));
|
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Resource));
|
||||||
ASSERT(0 != ElementStorage);
|
ASSERT(0 != ElementStorage);
|
||||||
|
|
||||||
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Result, Element = { 0 };
|
FSP_DEVICE_GENERIC_TABLE_ELEMENT_DATA *Result, Element = { 0 };
|
||||||
@ -402,7 +403,7 @@ VOID FspFsvolDeviceDeleteContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier,
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Base.Resource));
|
ASSERT(ExIsResourceAcquiredExclusiveLite(&FsvolDeviceExtension->Resource));
|
||||||
|
|
||||||
BOOLEAN Deleted;
|
BOOLEAN Deleted;
|
||||||
|
|
||||||
|
@ -354,7 +354,6 @@ typedef struct
|
|||||||
{
|
{
|
||||||
KSPIN_LOCK SpinLock;
|
KSPIN_LOCK SpinLock;
|
||||||
LONG RefCount;
|
LONG RefCount;
|
||||||
ERESOURCE Resource;
|
|
||||||
UINT32 Kind;
|
UINT32 Kind;
|
||||||
} FSP_DEVICE_EXTENSION;
|
} FSP_DEVICE_EXTENSION;
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -364,16 +363,17 @@ typedef struct
|
|||||||
PDEVICE_OBJECT FsvrtDeviceObject;
|
PDEVICE_OBJECT FsvrtDeviceObject;
|
||||||
HANDLE MupHandle;
|
HANDLE MupHandle;
|
||||||
BOOLEAN DeletePending;
|
BOOLEAN DeletePending;
|
||||||
|
PVPB SwapVpb;
|
||||||
FSP_WORK_ITEM_WITH_DELAY DeleteVolumeWorkItem;
|
FSP_WORK_ITEM_WITH_DELAY DeleteVolumeWorkItem;
|
||||||
FSP_DEVICE_GENERIC_TABLE_ELEMENT ElementStorage;
|
FSP_DEVICE_GENERIC_TABLE_ELEMENT ElementStorage;
|
||||||
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
|
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
|
||||||
PVPB SwapVpb;
|
|
||||||
FSP_IOQ Ioq;
|
FSP_IOQ Ioq;
|
||||||
KSPIN_LOCK ExpirationLock;
|
KSPIN_LOCK ExpirationLock;
|
||||||
WORK_QUEUE_ITEM ExpirationWorkItem;
|
WORK_QUEUE_ITEM ExpirationWorkItem;
|
||||||
BOOLEAN ExpirationInProgress;
|
BOOLEAN ExpirationInProgress;
|
||||||
RTL_AVL_TABLE GenericTable;
|
RTL_AVL_TABLE GenericTable;
|
||||||
PVOID GenericTableElementStorage;
|
PVOID GenericTableElementStorage;
|
||||||
|
ERESOURCE Resource;
|
||||||
} FSP_FSVOL_DEVICE_EXTENSION;
|
} FSP_FSVOL_DEVICE_EXTENSION;
|
||||||
static inline
|
static inline
|
||||||
FSP_DEVICE_EXTENSION *FspDeviceExtension(PDEVICE_OBJECT DeviceObject)
|
FSP_DEVICE_EXTENSION *FspDeviceExtension(PDEVICE_OBJECT DeviceObject)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user