[ros-diffs] [arty] 35720: Don't rely on DWIM semantics here, make an actual CC_FILE_SIZES. Noticed it and although strictly speaking it works, it's a little underhanded to just assume that some loose members of one struct can just be treated as another.

arty at svn.reactos.org arty at svn.reactos.org
Thu Aug 28 06:52:05 CEST 2008


Author: arty
Date: Wed Aug 27 23:52:04 2008
New Revision: 35720

URL: http://svn.reactos.org/svn/reactos?rev=35720&view=rev
Log:
Don't rely on DWIM semantics here, make an actual CC_FILE_SIZES.  Noticed it
and although strictly speaking it works, it's a little underhanded to just
assume that some loose members of one struct can just be treated as another.

Modified:
    branches/arty-newcc/drivers/filesystems/cdfs/fcb.c
    branches/arty-newcc/drivers/filesystems/cdfs/fsctl.c
    branches/arty-newcc/drivers/filesystems/cdfs/rw.c

Modified: branches/arty-newcc/drivers/filesystems/cdfs/fcb.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/cdfs/fcb.c?rev=35720&r1=35719&r2=35720&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/cdfs/fcb.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/cdfs/fcb.c [iso-8859-1] Wed Aug 27 23:52:04 2008
@@ -223,6 +223,7 @@
   PFILE_OBJECT FileObject;
   NTSTATUS Status;
   PCCB  newCCB;
+  CC_FILE_SIZES FileSizes;
 
   FileObject = IoCreateStreamFileObject(NULL, Vcb->StorageDevice);
 
@@ -240,6 +241,9 @@
   newCCB->PtrFileObject = FileObject;
   Fcb->FileObject = FileObject;
   Fcb->DevExt = Vcb;
+  FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
+  FileSizes.FileSize = Fcb->RFCB.FileSize;
+  FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
 
   Status = STATUS_SUCCESS;
   CcInitializeCacheMap(FileObject,
@@ -411,6 +415,7 @@
                           PFILE_OBJECT FileObject)
 {
   PCCB  newCCB;
+  CC_FILE_SIZES FileSizes;
 
   newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
   if (newCCB == NULL)
@@ -424,11 +429,14 @@
   FileObject->FsContext2 = newCCB;
   newCCB->PtrFileObject = FileObject;
   Fcb->DevExt = Vcb;
+  FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
+  FileSizes.FileSize = Fcb->RFCB.FileSize;
+  FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
 
   if (CdfsFCBIsDirectory(Fcb))
     {
   CcInitializeCacheMap(FileObject,
-                       (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+                       &FileSizes,
                        FALSE,
                        &(CdfsGlobalData->CacheMgrCallbacks),
                        Fcb);

Modified: branches/arty-newcc/drivers/filesystems/cdfs/fsctl.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/cdfs/fsctl.c?rev=35720&r1=35719&r2=35720&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/cdfs/fsctl.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/cdfs/fsctl.c [iso-8859-1] Wed Aug 27 23:52:04 2008
@@ -309,6 +309,7 @@
   PVPB Vpb;
   NTSTATUS Status;
   CDINFO CdInfo;
+  CC_FILE_SIZES FileSizes;
 
   DPRINT("CdfsMountVolume() called\n");
 
@@ -403,8 +404,12 @@
   Fcb->Entry.ExtentLocationL = 0;
   Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize + DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
 
+  FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
+  FileSizes.FileSize = Fcb->RFCB.FileSize;
+  FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
+
   CcInitializeCacheMap(DeviceExt->StreamFileObject,
-                       (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+                       &FileSizes,
 		       TRUE,
 		       &(CdfsGlobalData->CacheMgrCallbacks),
 		       Fcb);

Modified: branches/arty-newcc/drivers/filesystems/cdfs/rw.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/cdfs/rw.c?rev=35720&r1=35719&r2=35720&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/cdfs/rw.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/cdfs/rw.c [iso-8859-1] Wed Aug 27 23:52:04 2008
@@ -76,14 +76,19 @@
     {
       LARGE_INTEGER FileOffset;
       IO_STATUS_BLOCK IoStatus;
+      CC_FILE_SIZES FileSizes;
 
       if (ReadOffset + Length > Fcb->Entry.DataLengthL)
          Length = Fcb->Entry.DataLengthL - ReadOffset;
 
       if (FileObject->PrivateCacheMap == NULL)
 	{
+	  FileSizes.AllocationSize = Fcb->RFCB.AllocationSize;
+	  FileSizes.FileSize = Fcb->RFCB.FileSize;
+	  FileSizes.ValidDataLength = Fcb->RFCB.ValidDataLength;
+
           CcInitializeCacheMap(FileObject,
-                               (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+                               &FileSizes,
 		               FALSE,
 		               &(CdfsGlobalData->CacheMgrCallbacks),
 		               Fcb);



More information about the Ros-diffs mailing list