update for HEAD-2003091401
[reactos.git] / drivers / fs / vfat / fcb.c
index 6f1a375..241e2e6 100644 (file)
@@ -14,6 +14,7 @@
 #include <ddk/ntddk.h>
 #include <wchar.h>
 #include <limits.h>
+#include <ntos.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -82,8 +83,6 @@ vfatDestroyFCB(PVFATFCB  pFCB)
   FsRtlUninitializeFileLock(&pFCB->FileLock); 
   ExDeleteResourceLite(&pFCB->PagingIoResource);
   ExDeleteResourceLite(&pFCB->MainResource);
-  if ((pFCB->Flags & FCB_IS_PAGE_FILE) && pFCB->FatChainSize)
-       ExFreePool(pFCB->FatChain);
   ExFreeToNPagedLookasideList(&VfatGlobalData->FcbLookasideList, pFCB);
 }
 
@@ -156,7 +155,7 @@ vfatReleaseFCB(PDEVICE_EXTENSION  pVCB,  PVFATFCB  pFCB)
         if (vfatFCBIsDirectory(pFCB))
         {
            /* Uninitialize file cache if initialized for this file object. */
-           if (pFCB->FileObject->SectionObjectPointers->SharedCacheMap)
+           if (pFCB->FileObject->SectionObjectPointer->SharedCacheMap)
           {
               CcRosReleaseFileCache(pFCB->FileObject);
           }
@@ -207,12 +206,9 @@ vfatGrabFCBFromTable(PDEVICE_EXTENSION  pVCB, PWSTR  pFileName)
 {
   KIRQL  oldIrql;
   PVFATFCB  rcFCB;
-  PLIST_ENTRY  current_entry;
   ULONG Hash;
   PWCHAR ObjectName = NULL;
   ULONG len;
-  ULONG index;
-  ULONG currentindex;
   
   HASHENTRY* entry; 
 
@@ -286,7 +282,7 @@ vfatFCBInitializeCacheFromVolume (PVCB  vcb, PVFATFCB  fcb)
   memset (newCCB, 0, sizeof (VFATCCB));
 
   fileObject->Flags |= FO_FCB_IS_VALID | FO_DIRECT_CACHE_PAGING_READ;
-  fileObject->SectionObjectPointers = &fcb->SectionObjectPointers;
+  fileObject->SectionObjectPointer = &fcb->SectionObjectPointers;
   fileObject->FsContext = fcb;
   fileObject->FsContext2 = newCCB;
   fcb->FileObject = fileObject;
@@ -300,7 +296,7 @@ vfatFCBInitializeCacheFromVolume (PVCB  vcb, PVFATFCB  fcb)
   if (!NT_SUCCESS (status))
   {
     DbgPrint ("CcRosInitializeFileCache failed\n");
-    KeBugCheck (0);
+    KEBUGCHECK (0);
   }
 
   fcb->Flags |= FCB_CACHE_INITIALIZED;
@@ -325,13 +321,13 @@ vfatMakeRootFCB(PDEVICE_EXTENSION  pVCB)
   if (pVCB->FatInfo.FatType == FAT32)
   {
     CurrentCluster = FirstCluster = pVCB->FatInfo.RootCluster;
-    FCB->entry.FirstCluster = FirstCluster & 0xffff;
-    FCB->entry.FirstClusterHigh = FirstCluster >> 16;
+    FCB->entry.FirstCluster = (unsigned short)(FirstCluster & 0xffff);
+    FCB->entry.FirstClusterHigh = (unsigned short)(FirstCluster >> 16);
 
     while (CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
     {
       Size += pVCB->FatInfo.BytesPerCluster;
-      Status = NextCluster (pVCB, NULL, FirstCluster, &CurrentCluster, FALSE);
+      Status = NextCluster (pVCB, FirstCluster, &CurrentCluster, FALSE);
     }
   }
   else
@@ -421,7 +417,7 @@ vfatMakeFCBFromDirEntry(PVCB  vcb,
       while (CurrentCluster != 0xffffffff)
       {
          Size += vcb->FatInfo.BytesPerCluster;
-         Status = NextCluster (vcb, NULL, FirstCluster, &CurrentCluster, FALSE);
+         Status = NextCluster (vcb, FirstCluster, &CurrentCluster, FALSE);
       }
     }
   }
@@ -451,7 +447,6 @@ vfatAttachFCBToFileObject (PDEVICE_EXTENSION  vcb,
                            PVFATFCB  fcb,
                            PFILE_OBJECT  fileObject)
 {
-  NTSTATUS  status;
   PVFATCCB  newCCB;
 
   newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);
@@ -463,7 +458,7 @@ vfatAttachFCBToFileObject (PDEVICE_EXTENSION  vcb,
 
   fileObject->Flags = fileObject->Flags | FO_FCB_IS_VALID |
       FO_DIRECT_CACHE_PAGING_READ;
-  fileObject->SectionObjectPointers = &fcb->SectionObjectPointers;
+  fileObject->SectionObjectPointer = &fcb->SectionObjectPointers;
   fileObject->FsContext = fcb;
   fileObject->FsContext2 = newCCB;
   DPRINT ("file open: fcb:%x file size: %d\n", fcb, fcb->entry.FileSize);