update for HEAD-2003021201
[reactos.git] / drivers / fs / vfat / fsctl.c
index 244079e..5d84d45 100644 (file)
@@ -291,7 +291,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
       Status = STATUS_INSUFFICIENT_RESOURCES;
       goto ByeBye;
    }
-   Ccb = ExAllocatePoolWithTag (NonPagedPool, sizeof (VFATCCB), TAG_CCB);
+   Ccb = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);
    if (Ccb == NULL)
    {
       Status =  STATUS_INSUFFICIENT_RESOURCES;
@@ -330,7 +330,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
       DbgPrint ("CcRosInitializeFileCache failed\n");
       goto ByeBye;
    }
-   DeviceExt->LastAvailableCluster = 0;
+   DeviceExt->LastAvailableCluster = 2;
    ExInitializeResourceLite(&DeviceExt->DirResource);
    ExInitializeResourceLite(&DeviceExt->FatResource);
 
@@ -352,6 +352,10 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
    VolumeFcb->pDevExt = (PDEVICE_EXTENSION)DeviceExt->StorageDevice;
    DeviceExt->VolumeFcb = VolumeFcb;
 
+   ExAcquireResourceExclusiveLite(&VfatGlobalData->VolumeListLock, TRUE);
+   InsertHeadList(&VfatGlobalData->VolumeListHead, &DeviceExt->VolumeListEntry);
+   ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);
+
    /* read serial number */
    DeviceObject->Vpb->SerialNumber = DeviceExt->FatInfo.VolumeID;
 
@@ -367,9 +371,9 @@ ByeBye:
      if (DeviceExt && DeviceExt->FATFileObject)
         ObDereferenceObject (DeviceExt->FATFileObject);
      if (Fcb)
-        ExFreePool(Fcb);
+        vfatDestroyFCB(Fcb);
      if (Ccb)
-        ExFreePool(Ccb);
+        vfatDestroyCCB(Ccb);
      if (DeviceObject)
        IoDeleteDevice(DeviceObject);
      if (VolumeFcb)