- Prepared ntfs for using CcInitializeCacheMap/CcUninitializeCacheMap instead of CcRosInitializeFileCache/CcRosReleaseFileCache.

svn path=/trunk/; revision=13530
This commit is contained in:
Hartmut Birr 2005-02-13 17:23:41 +00:00
parent be6f666161
commit 11aca778bc
3 changed files with 31 additions and 5 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -3,6 +3,8 @@
#include <ddk/ntifs.h>
#define USE_ROS_CC_AND_FS
#define CACHEPAGESIZE(pDeviceExt) \
((pDeviceExt)->NtfsInfo.BytesPerCluster > PAGE_SIZE ? \