https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab2b7a6bc6ff71f712bac…
commit ab2b7a6bc6ff71f712bac8743d6ad8f9b2ea94f7
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Mon Jun 15 06:57:04 2020 +0200
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Sun Jun 21 09:27:44 2020 +0300
[FASTFAT_NEW] Simplify unsupported NT6.2+ workarounds
---
drivers/filesystems/fastfat_new/allocsup.c | 4 ----
drivers/filesystems/fastfat_new/deviosup.c | 20 --------------------
drivers/filesystems/fastfat_new/fatinit.c | 16 ----------------
drivers/filesystems/fastfat_new/fatprocs.h | 9 +++++++++
drivers/filesystems/fastfat_new/fsctrl.c | 24 ------------------------
drivers/filesystems/fastfat_new/read.c | 4 ----
drivers/filesystems/fastfat_new/strucsup.c | 21 ---------------------
drivers/filesystems/fastfat_new/verfysup.c | 4 ----
drivers/filesystems/fastfat_new/write.c | 12 ------------
9 files changed, 9 insertions(+), 105 deletions(-)
diff --git a/drivers/filesystems/fastfat_new/allocsup.c
b/drivers/filesystems/fastfat_new/allocsup.c
index 883f758d682..4f7f8b20a43 100644
--- a/drivers/filesystems/fastfat_new/allocsup.c
+++ b/drivers/filesystems/fastfat_new/allocsup.c
@@ -2727,11 +2727,7 @@ Return Value:
// Map the MDL.
//
-#ifndef __REACTOS__
Buffer = MmGetSystemAddressForMdlSafe(Mdl,
HighPagePriority|MdlMappingNoExecute);
-#else
- Buffer = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority);
-#endif
if (!Buffer) {
NT_ASSERT( FALSE );
ZeroingStatus = STATUS_INSUFFICIENT_RESOURCES;
diff --git a/drivers/filesystems/fastfat_new/deviosup.c
b/drivers/filesystems/fastfat_new/deviosup.c
index a9535cf0de5..17462d8704b 100644
--- a/drivers/filesystems/fastfat_new/deviosup.c
+++ b/drivers/filesystems/fastfat_new/deviosup.c
@@ -1057,11 +1057,7 @@ Return Value:
// that this will be only a single page.
//
-#ifndef __REACTOS__
if (MmGetSystemAddressForMdlSafe( Mdl, NormalPagePriority | MdlMappingNoExecute )
== NULL) {
-#else
- if (MmGetSystemAddressForMdlSafe( Mdl, NormalPagePriority ) == NULL) {
-#endif
FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
}
@@ -1395,11 +1391,7 @@ Return Value:
// Allocate the local buffer
//
-#ifndef __REACTOS__
DiskBuffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
-#else
- DiskBuffer = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
-#endif
(ULONG) ROUND_TO_PAGES( SectorSize ),
TAG_IO_BUFFER );
@@ -2775,11 +2767,7 @@ Return Value:
// If we can't get pool, oh well....
//
-#ifndef __REACTOS__
Packet = ExAllocatePoolWithTag(NonPagedPoolNx,
sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
-#else
- Packet = ExAllocatePoolWithTag(NonPagedPool,
sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
-#endif
if ( Packet ) {
@@ -3407,11 +3395,7 @@ Return Value:
} else {
-#ifndef __REACTOS__
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress,
NormalPagePriority | MdlMappingNoExecute );
-#else
- PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress,
NormalPagePriority );
-#endif
if (Address == NULL) {
@@ -3476,11 +3460,7 @@ Return Value:
UserBuffer = FatMapUserBuffer( IrpContext, Irp );
-#ifndef __REACTOS__
Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag(
NonPagedPoolNx,
-#else
- Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag(
NonPagedPool,
-#endif
BufferLength,
TAG_IO_USER_BUFFER );
diff --git a/drivers/filesystems/fastfat_new/fatinit.c
b/drivers/filesystems/fastfat_new/fatinit.c
index a752fbd2841..b09339640d5 100644
--- a/drivers/filesystems/fastfat_new/fatinit.c
+++ b/drivers/filesystems/fastfat_new/fatinit.c
@@ -264,11 +264,7 @@ Return Value:
// Allocate the zero page
//
-#ifndef __REACTOS__
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF'
);
-#else
- FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPool, PAGE_SIZE, 'ZtaF' );
-#endif
if (FatData.ZeroPage == NULL) {
IoDeleteDevice (FatDiskFileSystemDeviceObject);
IoDeleteDevice (FatCdromFileSystemDeviceObject);
@@ -388,11 +384,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatIrpContextLookasideList,
NULL,
NULL,
-#ifndef __REACTOS__
POOL_NX_ALLOCATION |
POOL_RAISE_IF_ALLOCATION_FAILURE,
-#else
- POOL_RAISE_IF_ALLOCATION_FAILURE,
-#endif
sizeof(IRP_CONTEXT),
TAG_IRP_CONTEXT,
MaxDepth );
@@ -400,11 +392,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatNonPagedFcbLookasideList,
NULL,
NULL,
-#ifndef __REACTOS__
POOL_NX_ALLOCATION |
POOL_RAISE_IF_ALLOCATION_FAILURE,
-#else
- POOL_RAISE_IF_ALLOCATION_FAILURE,
-#endif
sizeof(NON_PAGED_FCB),
TAG_FCB_NONPAGED,
MaxDepth );
@@ -412,11 +400,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatEResourceLookasideList,
NULL,
NULL,
-#ifndef __REACTOS__
POOL_NX_ALLOCATION |
POOL_RAISE_IF_ALLOCATION_FAILURE,
-#else
- POOL_RAISE_IF_ALLOCATION_FAILURE,
-#endif
sizeof(ERESOURCE),
TAG_ERESOURCE,
MaxDepth );
diff --git a/drivers/filesystems/fastfat_new/fatprocs.h
b/drivers/filesystems/fastfat_new/fatprocs.h
index 90cc203d031..602f539cccb 100644
--- a/drivers/filesystems/fastfat_new/fatprocs.h
+++ b/drivers/filesystems/fastfat_new/fatprocs.h
@@ -40,6 +40,15 @@ Abstract:
#ifdef __REACTOS__
+// Downgrade unsupported NT6.2+ features.
+#undef MdlMappingNoExecute
+#define MdlMappingNoExecute 0
+#define NonPagedPoolNx NonPagedPool
+#define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
+#undef POOL_NX_ALLOCATION
+#define POOL_NX_ALLOCATION 0
+
+// Moved up: needed in 'fatstruc.h'.
typedef enum _TYPE_OF_OPEN {
UnopenedFileObject = 1,
diff --git a/drivers/filesystems/fastfat_new/fsctrl.c
b/drivers/filesystems/fastfat_new/fsctrl.c
index ef78449b5d5..0938dcc63e9 100644
--- a/drivers/filesystems/fastfat_new/fsctrl.c
+++ b/drivers/filesystems/fastfat_new/fsctrl.c
@@ -2117,11 +2117,7 @@ Return Value:
try_return( Status = STATUS_WRONG_VOLUME );
}
-#ifndef __REACTOS__
BootSector = FsRtlAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
-#else
- BootSector = FsRtlAllocatePoolWithTag(NonPagedPoolCacheAligned,
-#endif
(ULONG) ROUND_TO_PAGES( SectorSize ),
TAG_VERIFY_BOOTSECTOR);
@@ -2212,11 +2208,7 @@ Return Value:
RootDirectorySize = FatBytesPerCluster(&Bpb);
}
-#ifndef __REACTOS__
RootDirectory = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
-#else
- RootDirectory = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
-#endif
(ULONG) ROUND_TO_PAGES(
RootDirectorySize ),
TAG_VERIFY_ROOTDIR);
@@ -4009,11 +4001,7 @@ Return Value:
} else if (Irp->MdlAddress != NULL) {
-#ifndef __REACTOS__
VolumeState = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, LowPagePriority |
MdlMappingNoExecute );
-#else
- VolumeState = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, LowPagePriority
);
-#endif
if (VolumeState == NULL) {
@@ -4829,11 +4817,7 @@ Return Value:
try_leave( Status = STATUS_FILE_CORRUPT_ERROR);
}
-#ifndef __REACTOS__
*MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- *MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
(Index + 2) * (2 *
sizeof(LARGE_INTEGER)),
TAG_OUTPUT_MAPPINGPAIRS );
@@ -6087,11 +6071,7 @@ Return Value:
if (Buffer == NULL) {
-#ifndef __REACTOS__
Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- Buffer = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
BufferSize,
TAG_DEFRAG_BUFFER );
}
@@ -7979,11 +7959,7 @@ FatVerifyLookupFatEntry (
FatVerifyIndexIsValid( IrpContext, Vcb, FatIndex);
-#ifndef __REACTOS__
Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
-#else
- Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
-#endif
PAGE_SIZE,
TAG_ENTRY_LOOKUP_BUFFER );
diff --git a/drivers/filesystems/fastfat_new/read.c
b/drivers/filesystems/fastfat_new/read.c
index 95770aac934..48affe31142 100644
--- a/drivers/filesystems/fastfat_new/read.c
+++ b/drivers/filesystems/fastfat_new/read.c
@@ -685,11 +685,7 @@ Return Value:
if (!Wait) {
IrpContext->FatIoContext =
-#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(FAT_IO_CONTEXT),
TAG_FAT_IO_CONTEXT );
diff --git a/drivers/filesystems/fastfat_new/strucsup.c
b/drivers/filesystems/fastfat_new/strucsup.c
index 5cd50fe3348..4513be8dcb4 100644
--- a/drivers/filesystems/fastfat_new/strucsup.c
+++ b/drivers/filesystems/fastfat_new/strucsup.c
@@ -556,11 +556,7 @@ Return Value:
// Initialize the performance counters.
//
-#ifndef __REACTOS__
Vcb->Statistics = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- Vcb->Statistics = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(FILE_SYSTEM_STATISTICS) *
FatData.NumberProcessors,
TAG_VCB_STATS );
UnwindStatistics = Vcb->Statistics;
@@ -579,11 +575,7 @@ Return Value:
// of the storage stack on demand.
//
-#ifndef __REACTOS__
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof( VPB ),
TAG_VPB );
@@ -1047,11 +1039,7 @@ Return Value:
// have to continually reference through the Vcb
//
-#ifndef __REACTOS__
UnwindStorage[0] = Dcb = Vcb->RootDcb = FsRtlAllocatePoolWithTag(
NonPagedPoolNx,
-#else
- UnwindStorage[0] = Dcb = Vcb->RootDcb = FsRtlAllocatePoolWithTag(
NonPagedPool,
-#endif
sizeof(DCB),
TAG_FCB );
@@ -1144,11 +1132,7 @@ Return Value:
// directory is a fixed size so we can set it everything up now.
//
-#ifndef __REACTOS__
FsRtlInitializeLargeMcb( &Dcb->Mcb, NonPagedPoolNx );
-#else
- FsRtlInitializeLargeMcb( &Dcb->Mcb, NonPagedPool );
-#endif
UnwindMcb = &Dcb->Mcb;
if (FatIsFat32(Vcb)) {
@@ -1333,13 +1317,8 @@ Return Value:
if (IsPagingFile) {
-#ifndef __REACTOS__
PoolType = NonPagedPoolNx;
Fcb = UnwindStorage[0] = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- PoolType = NonPagedPool;
- Fcb = UnwindStorage[0] = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(FCB),
TAG_FCB );
} else {
diff --git a/drivers/filesystems/fastfat_new/verfysup.c
b/drivers/filesystems/fastfat_new/verfysup.c
index b40a1ebc697..969c332ab89 100644
--- a/drivers/filesystems/fastfat_new/verfysup.c
+++ b/drivers/filesystems/fastfat_new/verfysup.c
@@ -709,11 +709,7 @@ Return Value:
// If we couldn't get pool, oh well....
//
-#ifndef __REACTOS__
Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET),
' taF');
-#else
- Packet = ExAllocatePoolWithTag(NonPagedPool, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET),
' taF');
-#endif
if ( Packet ) {
diff --git a/drivers/filesystems/fastfat_new/write.c
b/drivers/filesystems/fastfat_new/write.c
index cf75c213958..60109d76261 100644
--- a/drivers/filesystems/fastfat_new/write.c
+++ b/drivers/filesystems/fastfat_new/write.c
@@ -447,11 +447,7 @@ Return Value:
if (!Wait) {
IrpContext->FatIoContext =
-#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(FAT_IO_CONTEXT),
TAG_FAT_IO_CONTEXT );
@@ -1662,11 +1658,7 @@ Return Value:
if (!FcbOrDcb->NonPaged->OutstandingAsyncEvent) {
FcbOrDcb->NonPaged->OutstandingAsyncEvent =
-#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(KEVENT),
TAG_EVENT );
@@ -2420,11 +2412,7 @@ Return Value:
// Get pool and initialize the timer and DPC
//
-#ifndef __REACTOS__
FlushContext = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
-#else
- FlushContext = FsRtlAllocatePoolWithTag( NonPagedPool,
-#endif
sizeof(DEFERRED_FLUSH_CONTEXT),
TAG_DEFERRED_FLUSH_CONTEXT );