[ros-diffs] [mbosma] 25255: Recommit changes from cc branch, without the hackish changes to create.c.

mbosma at svn.reactos.org mbosma at svn.reactos.org
Sun Dec 31 17:43:41 CET 2006


Author: mbosma
Date: Sun Dec 31 19:43:40 2006
New Revision: 25255

URL: http://svn.reactos.org/svn/reactos?rev=25255&view=rev
Log:
Recommit changes from cc branch, without the hackish changes to create.c.

Modified:
    trunk/reactos/drivers/filesystems/vfat/cleanup.c
    trunk/reactos/drivers/filesystems/vfat/create.c

Modified: trunk/reactos/drivers/filesystems/vfat/cleanup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/cleanup.c?rev=25255&r1=25254&r2=25255&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/vfat/cleanup.c (original)
+++ trunk/reactos/drivers/filesystems/vfat/cleanup.c Sun Dec 31 19:43:40 2006
@@ -29,15 +29,40 @@
   pFcb = (PVFATFCB) FileObject->FsContext;
   if (pFcb)
     {
-      if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
-          FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
-       {
-         /* remove all locks this process have on this file */
-         FsRtlFastUnlockAll(&pFcb->FileLock,
-                            FileObject,
-                            IoGetRequestorProcess(IrpContext->Irp),
-                            NULL);
-       }
+      if (pFcb->Flags & FCB_IS_VOLUME)
+        {
+          pFcb->OpenHandleCount--;
+
+          if (pFcb->OpenHandleCount != 0)
+            {
+              IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
+            }
+        }
+      else
+        {
+          if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
+                                              (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+            {
+              return STATUS_PENDING;
+            }
+          if(!ExAcquireResourceExclusiveLite (&pFcb->PagingIoResource,
+                                              (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+            {
+              ExReleaseResourceLite (&pFcb->MainResource);
+              return STATUS_PENDING;
+            }
+
+          pFcb->OpenHandleCount--;
+
+          if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
+              FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
+            {
+              /* remove all locks this process have on this file */
+              FsRtlFastUnlockAll(&pFcb->FileLock,
+                                 FileObject,
+                                 IoGetRequestorProcess(IrpContext->Irp),
+                                 NULL);
+            }
 
      if (pFcb->Flags & FCB_IS_DIRTY)
        {
@@ -71,10 +96,21 @@
 #ifdef USE_ROS_CC_AND_FS
      CcRosReleaseFileCache (FileObject);
 #else
-     CcUninitializeCacheMap (FileObject, NULL, NULL);
+          if (FileObject->SectionObjectPointer->SharedCacheMap)
+	    {
+              CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL);
+	    }
 #endif
-     pFcb->OpenHandleCount--;
-     IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
+          if (pFcb->OpenHandleCount != 0)
+            {
+              IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
+            }
+
+          FileObject->Flags |= FO_CLEANUP_COMPLETE;
+
+          ExReleaseResourceLite (&pFcb->PagingIoResource);
+          ExReleaseResourceLite (&pFcb->MainResource);
+       }
     }
   return STATUS_SUCCESS;
 }
@@ -104,6 +140,11 @@
 
    ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
 
+   if (Status == STATUS_PENDING)
+   {
+      return VfatQueueRequest(IrpContext);
+   }
+
 ByeBye:
    IrpContext->Irp->IoStatus.Status = Status;
    IrpContext->Irp->IoStatus.Information = 0;

Modified: trunk/reactos/drivers/filesystems/vfat/create.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/create.c?rev=25255&r1=25254&r2=25255&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/vfat/create.c (original)
+++ trunk/reactos/drivers/filesystems/vfat/create.c Sun Dec 31 19:43:40 2006
@@ -656,7 +656,24 @@
 			VfatCloseFile (DeviceExt, FileObject);
 			return(STATUS_NOT_A_DIRECTORY);
 		}
-
+#ifndef USE_ROS_CC_AND_FS
+		if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY))
+		{
+			if (Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA || 
+				RequestedDisposition == FILE_OVERWRITE ||
+				RequestedDisposition == FILE_OVERWRITE_IF)
+			{
+				if (!MmFlushImageSection(&pFcb->SectionObjectPointers, MmFlushForWrite))
+				{
+					DPRINT1("%wZ\n", &pFcb->PathNameU);
+					DPRINT1("%d %d %d\n", Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA, 
+							RequestedDisposition == FILE_OVERWRITE, RequestedDisposition == FILE_OVERWRITE_IF);
+					VfatCloseFile (DeviceExt, FileObject);
+					return STATUS_SHARING_VIOLATION;
+				}
+			}
+		}
+#endif
 		if (PagingFileCreate)
 		{
 			/* FIXME:




More information about the Ros-diffs mailing list