[FASTFAT]
[reactos.git] / reactos / drivers / filesystems / fastfat / cleanup.c
index f05c116..4887f9d 100644 (file)
@@ -8,16 +8,20 @@
 
 /* INCLUDES *****************************************************************/
 
-#define NDEBUG
 #include "vfat.h"
 
+#define NDEBUG
+#include <debug.h>
+
 /* FUNCTIONS ****************************************************************/
 
 /*
  * FUNCTION: Cleans up after a file has been closed.
  */
-static NTSTATUS
-VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
+static
+NTSTATUS
+VfatCleanupFile(
+    PVFAT_IRP_CONTEXT IrpContext)
 {
     PVFATFCB pFcb;
     PFILE_OBJECT FileObject = IrpContext->FileObject;
@@ -26,7 +30,7 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
            IrpContext->DeviceExt, FileObject);
 
     /* FIXME: handle file/directory deletion here */
-    pFcb = (PVFATFCB) FileObject->FsContext;
+    pFcb = (PVFATFCB)FileObject->FsContext;
     if (!pFcb)
         return STATUS_SUCCESS;
 
@@ -41,15 +45,15 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
     }
     else
     {
-        if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
-                                            (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+        if(!ExAcquireResourceExclusiveLite(&pFcb->MainResource,
+                                           (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
         {
             return STATUS_PENDING;
         }
-        if(!ExAcquireResourceExclusiveLite (&pFcb->PagingIoResource,
-                                            (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+        if(!ExAcquireResourceExclusiveLite(&pFcb->PagingIoResource,
+                                           (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
         {
-            ExReleaseResourceLite (&pFcb->MainResource);
+            ExReleaseResourceLite(&pFcb->MainResource);
             return STATUS_PENDING;
         }
 
@@ -80,9 +84,9 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
                 pFcb->FileObject = NULL;
                 CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
                 ObDereferenceObject(tmpFileObject);
-           }
+            }
 
-           CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
+            CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
         }
 
         /* Uninitialize the cache (should be done even if caching was never initialized) */
@@ -95,8 +99,8 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
 
         FileObject->Flags |= FO_CLEANUP_COMPLETE;
 
-        ExReleaseResourceLite (&pFcb->PagingIoResource);
-        ExReleaseResourceLite (&pFcb->MainResource);
+        ExReleaseResourceLite(&pFcb->PagingIoResource);
+        ExReleaseResourceLite(&pFcb->MainResource);
     }
 
     return STATUS_SUCCESS;
@@ -105,7 +109,9 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
 /*
  * FUNCTION: Cleans up after a file has been closed.
  */
-NTSTATUS VfatCleanup(PVFAT_IRP_CONTEXT IrpContext)
+NTSTATUS
+VfatCleanup(
+    PVFAT_IRP_CONTEXT IrpContext)
 {
     NTSTATUS Status;
 
@@ -117,15 +123,15 @@ NTSTATUS VfatCleanup(PVFAT_IRP_CONTEXT IrpContext)
         goto ByeBye;
     }
 
-    if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource,
-                                         (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+    if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource,
+                                        (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
     {
-        return VfatQueueRequest (IrpContext);
+        return VfatQueueRequest(IrpContext);
     }
 
     Status = VfatCleanupFile(IrpContext);
 
-    ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
+    ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
 
     if (Status == STATUS_PENDING)
     {
@@ -136,9 +142,9 @@ ByeBye:
     IrpContext->Irp->IoStatus.Status = Status;
     IrpContext->Irp->IoStatus.Information = 0;
 
-    IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
+    IoCompleteRequest(IrpContext->Irp, IO_NO_INCREMENT);
     VfatFreeIrpContext(IrpContext);
-    return (Status);
+    return Status;
 }
 
 /* EOF */