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

svn path=/trunk/; revision=13529
This commit is contained in:
Hartmut Birr 2005-02-13 17:21:16 +00:00
parent 6dc6d975d8
commit be6f666161
4 changed files with 32 additions and 4 deletions

View file

@ -3,6 +3,8 @@
#include <ddk/ntifs.h>
#define USE_ROS_CC_AND_FS
#define CDFS_BASIC_SECTOR 2048
#define CDFS_PRIMARY_DESCRIPTOR_LOCATION 16
#define BLOCKSIZE CDFS_BASIC_SECTOR

View file

@ -54,7 +54,11 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
/* Uninitialize file cache if initialized for this file object. */
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
{
#ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache (FileObject);
#else
CcUninitializeCacheMap (FileObject, NULL, NULL);
#endif
}
return STATUS_SUCCESS;

View file

@ -241,6 +241,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
Fcb->FileObject = FileObject;
Fcb->DevExt = Vcb;
#ifdef USE_ROS_AND_FS
Status = CcRosInitializeFileCache(FileObject,
PAGE_SIZE);
if (!NT_SUCCESS(Status))
@ -248,6 +249,13 @@ CdfsFCBInitializeCache(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;
@ -411,7 +419,6 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
PFCB Fcb,
PFILE_OBJECT FileObject)
{
NTSTATUS Status;
PCCB newCCB;
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
@ -426,9 +433,11 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
FileObject->FsContext2 = newCCB;
newCCB->PtrFileObject = FileObject;
Fcb->DevExt = Vcb;
if (CdfsFCBIsDirectory(Fcb))
{
#ifdef USE_ROS_CC_AND_FS
NTSTATUS Status;
Status = CcRosInitializeFileCache(FileObject,
PAGE_SIZE);
if (!NT_SUCCESS(Status))
@ -436,6 +445,13 @@ CdfsAttachFCBToFileObject(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

@ -402,7 +402,7 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
Fcb->Entry.ExtentLocationL = 0;
Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
#ifdef USE_ROS_CC_AND_FS
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject,
PAGE_SIZE);
if (!NT_SUCCESS (Status))
@ -410,7 +410,13 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
DbgPrint("CcRosInitializeFileCache failed\n");
goto ByeBye;
}
#else
CcInitializeCacheMap(DeviceExt->StreamFileObject,
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
TRUE,
NULL,
NULL);
#endif
ExInitializeResourceLite(&DeviceExt->VcbResource);
ExInitializeResourceLite(&DeviceExt->DirResource);