From be6f66616198d2003f453d9f9cfef3488f5d48c0 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sun, 13 Feb 2005 17:21:16 +0000 Subject: [PATCH] - Prepared cdfs for using CcInitializeCacheMap/CcUninitializeCacheMap instead of CcRosInitializeFileCache/CcRosReleaseFileCache. svn path=/trunk/; revision=13529 --- reactos/drivers/fs/cdfs/cdfs.h | 2 ++ reactos/drivers/fs/cdfs/cleanup.c | 4 ++++ reactos/drivers/fs/cdfs/fcb.c | 20 ++++++++++++++++++-- reactos/drivers/fs/cdfs/fsctl.c | 10 ++++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/fs/cdfs/cdfs.h b/reactos/drivers/fs/cdfs/cdfs.h index e62d95adbb3..692912464cf 100644 --- a/reactos/drivers/fs/cdfs/cdfs.h +++ b/reactos/drivers/fs/cdfs/cdfs.h @@ -3,6 +3,8 @@ #include +#define USE_ROS_CC_AND_FS + #define CDFS_BASIC_SECTOR 2048 #define CDFS_PRIMARY_DESCRIPTOR_LOCATION 16 #define BLOCKSIZE CDFS_BASIC_SECTOR diff --git a/reactos/drivers/fs/cdfs/cleanup.c b/reactos/drivers/fs/cdfs/cleanup.c index f19c9a607f1..3e42acb4854 100644 --- a/reactos/drivers/fs/cdfs/cleanup.c +++ b/reactos/drivers/fs/cdfs/cleanup.c @@ -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; diff --git a/reactos/drivers/fs/cdfs/fcb.c b/reactos/drivers/fs/cdfs/fcb.c index afb602b133b..28b52b152a0 100644 --- a/reactos/drivers/fs/cdfs/fcb.c +++ b/reactos/drivers/fs/cdfs/fcb.c @@ -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; } diff --git a/reactos/drivers/fs/cdfs/fsctl.c b/reactos/drivers/fs/cdfs/fsctl.c index 85f67040781..89cee57ef29 100644 --- a/reactos/drivers/fs/cdfs/fsctl.c +++ b/reactos/drivers/fs/cdfs/fsctl.c @@ -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);