/* INCLUDES *****************************************************************/
-#define NDEBUG
#include "vfat.h"
+#define NDEBUG
+#include <debug.h>
+
/* FUNCTIONS ****************************************************************/
-NTSTATUS
-VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
/*
* FUNCTION: Closes a file
*/
+NTSTATUS
+VfatCloseFile(
+ PDEVICE_EXTENSION DeviceExt,
+ PFILE_OBJECT FileObject)
{
- PVFATFCB pFcb;
- PVFATCCB pCcb;
- NTSTATUS Status = STATUS_SUCCESS;
-
- DPRINT ("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
- DeviceExt, FileObject);
-
- /* FIXME : update entry in directory? */
- pCcb = (PVFATCCB) (FileObject->FsContext2);
- pFcb = (PVFATFCB) (FileObject->FsContext);
-
- if (pFcb == NULL)
- {
- return STATUS_SUCCESS;
- }
-
- if (pFcb->Flags & FCB_IS_VOLUME)
- {
- DPRINT1("Volume\n");
- pFcb->RefCount--;
- FileObject->FsContext2 = NULL;
- }
- else
- {
- if (FileObject->DeletePending)
+ PVFATFCB pFcb;
+ PVFATCCB pCcb;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
+ DeviceExt, FileObject);
+
+ /* FIXME : update entry in directory? */
+ pCcb = (PVFATCCB) (FileObject->FsContext2);
+ pFcb = (PVFATFCB) (FileObject->FsContext);
+
+ if (pFcb == NULL)
+ {
+ return STATUS_SUCCESS;
+ }
+
+ if (pFcb->Flags & FCB_IS_VOLUME)
{
- if (pFcb->Flags & FCB_DELETE_PENDING)
- {
- VfatDelEntry (DeviceExt, pFcb);
- }
- else
- {
- Status = STATUS_DELETE_PENDING;
- }
+ DPRINT1("Volume\n");
+ pFcb->RefCount--;
+ FileObject->FsContext2 = NULL;
+ }
+ else
+ {
+ if (FileObject->DeletePending)
+ {
+ if (pFcb->Flags & FCB_DELETE_PENDING)
+ {
+ VfatDelEntry(DeviceExt, pFcb);
+ }
+ else
+ {
+ Status = STATUS_DELETE_PENDING;
+ }
+ }
+
+ vfatReleaseFCB(DeviceExt, pFcb);
}
- vfatReleaseFCB (DeviceExt, pFcb);
- }
- FileObject->FsContext2 = NULL;
- FileObject->FsContext = NULL;
- FileObject->SectionObjectPointer = NULL;
+ FileObject->FsContext2 = NULL;
+ FileObject->FsContext = NULL;
+ FileObject->SectionObjectPointer = NULL;
- if (pCcb)
- {
- vfatDestroyCCB(pCcb);
- }
+ if (pCcb)
+ {
+ vfatDestroyCCB(pCcb);
+ }
- return Status;
+ return Status;
}
-NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext)
/*
* FUNCTION: Closes a file
*/
+NTSTATUS
+VfatClose(
+ PVFAT_IRP_CONTEXT IrpContext)
{
- NTSTATUS Status;
+ NTSTATUS Status;
- DPRINT ("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext->DeviceObject, IrpContext->Irp);
+ DPRINT("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext->DeviceObject, IrpContext->Irp);
- if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
+ if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{
- DPRINT("Closing file system\n");
- Status = STATUS_SUCCESS;
- goto ByeBye;
+ DPRINT("Closing file system\n");
+ Status = STATUS_SUCCESS;
+ goto ByeBye;
}
#if 0
- /* There occurs a dead look at the call to CcRosDeleteFileCache/ObDereferenceObject/VfatClose
- in CmLazyCloseThreadMain if VfatClose is execute asynchronous in a worker thread. */
- if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
+ /* There occurs a dead look at the call to CcRosDeleteFileCache/ObDereferenceObject/VfatClose
+ in CmLazyCloseThreadMain if VfatClose is execute asynchronous in a worker thread. */
+ if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
#else
- if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, TRUE))
+ if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, TRUE))
#endif
- {
- return VfatQueueRequest (IrpContext);
- }
+ {
+ return VfatQueueRequest(IrpContext);
+ }
- Status = VfatCloseFile (IrpContext->DeviceExt, IrpContext->FileObject);
- ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
+ Status = VfatCloseFile(IrpContext->DeviceExt, IrpContext->FileObject);
+ ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
ByeBye:
- IrpContext->Irp->IoStatus.Status = Status;
- IrpContext->Irp->IoStatus.Information = 0;
- IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
- VfatFreeIrpContext(IrpContext);
+ IrpContext->Irp->IoStatus.Status = Status;
+ IrpContext->Irp->IoStatus.Information = 0;
+ IoCompleteRequest(IrpContext->Irp, IO_NO_INCREMENT);
+ VfatFreeIrpContext(IrpContext);
- return (Status);
+ return Status;
}
/* EOF */