From 11aca778bc9dc4a15405f77222cb970880cf2a2d Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sun, 13 Feb 2005 17:23:41 +0000 Subject: [PATCH] - Prepared ntfs for using CcInitializeCacheMap/CcUninitializeCacheMap instead of CcRosInitializeFileCache/CcRosReleaseFileCache. svn path=/trunk/; revision=13530 --- reactos/drivers/fs/ntfs/fcb.c | 24 +++++++++++++++++++++--- reactos/drivers/fs/ntfs/fsctl.c | 10 ++++++++-- reactos/drivers/fs/ntfs/ntfs.h | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/fs/ntfs/fcb.c b/reactos/drivers/fs/ntfs/fcb.c index 31029adf4e7..bda263a8584 100644 --- a/reactos/drivers/fs/ntfs/fcb.c +++ b/reactos/drivers/fs/ntfs/fcb.c @@ -155,7 +155,11 @@ NtfsReleaseFCB(PDEVICE_EXTENSION Vcb, if (Fcb->RefCount <= 0 && !NtfsFCBIsDirectory(Fcb)) { RemoveEntryList(&Fcb->FcbListEntry); +#ifdef USE_ROS_CC_AND_FS CcRosReleaseFileCache(Fcb->FileObject); +#else + CcUninitializeCacheMap (Fcb->FileObject, NULL, NULL); +#endif NtfsDestroyFCB(Fcb); } KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql); @@ -241,7 +245,7 @@ NtfsFCBInitializeCache(PVCB Vcb, newCCB->PtrFileObject = FileObject; Fcb->FileObject = FileObject; Fcb->DevExt = Vcb; - +#ifdef ROS_USE_CC_AND_FS Status = CcRosInitializeFileCache(FileObject, CACHEPAGESIZE(Vcb)); if (!NT_SUCCESS(Status)) @@ -249,7 +253,13 @@ NtfsFCBInitializeCache(PVCB Vcb, DbgPrint("CcRosInitializeFileCache failed\n"); KEBUGCHECK(0); } - +#else + CcInitializeCacheMap(FileObject, + (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize), + FALSE, + NULL, + NULL); +#endif ObDereferenceObject(FileObject); Fcb->Flags |= FCB_CACHE_INITIALIZED; @@ -394,7 +404,6 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb, PFCB Fcb, PFILE_OBJECT FileObject) { - NTSTATUS Status; PCCB newCCB; newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB); @@ -412,6 +421,8 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb, if (!(Fcb->Flags & FCB_CACHE_INITIALIZED)) { +#ifdef ROS_USE_CC_AND_FS + NTSTATUS Status; Status = CcRosInitializeFileCache(FileObject, CACHEPAGESIZE(Vcb)); if (!NT_SUCCESS(Status)) @@ -419,6 +430,13 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb, DbgPrint("CcRosInitializeFileCache failed\n"); KEBUGCHECK(0); } +#else + CcInitializeCacheMap(FileObject, + (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize), + FALSE, + NULL, + NULL); +#endif Fcb->Flags |= FCB_CACHE_INITIALIZED; } diff --git a/reactos/drivers/fs/ntfs/fsctl.c b/reactos/drivers/fs/ntfs/fsctl.c index 41071faaf20..4093cd55195 100644 --- a/reactos/drivers/fs/ntfs/fsctl.c +++ b/reactos/drivers/fs/ntfs/fsctl.c @@ -387,7 +387,7 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject, // Fcb->Entry.ExtentLocationL = 0; // Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE; - +#ifdef ROS_USE_CC_AND_FS Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject, CACHEPAGESIZE(DeviceExt)); if (!NT_SUCCESS (Status)) @@ -395,7 +395,13 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject, DbgPrint("CcRosInitializeFileCache() failed (Status %lx)\n", Status); goto ByeBye; } - +#else + CcInitializeCacheMap(DeviceExt->StreamFileObject, + (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize), + FALSE, + NULL, + NULL); +#endif ExInitializeResourceLite(&DeviceExt->DirResource); // ExInitializeResourceLite(&DeviceExt->FatResource); diff --git a/reactos/drivers/fs/ntfs/ntfs.h b/reactos/drivers/fs/ntfs/ntfs.h index 35121155a26..9c94cef55ab 100644 --- a/reactos/drivers/fs/ntfs/ntfs.h +++ b/reactos/drivers/fs/ntfs/ntfs.h @@ -3,6 +3,8 @@ #include +#define USE_ROS_CC_AND_FS + #define CACHEPAGESIZE(pDeviceExt) \ ((pDeviceExt)->NtfsInfo.BytesPerCluster > PAGE_SIZE ? \