3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/fs/vfat/cleanup.c
6 * PURPOSE: VFAT Filesystem
7 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
10 /* INCLUDES *****************************************************************/
12 #include <ddk/ntddk.h>
19 /* FUNCTIONS ****************************************************************/
22 VfatCleanupFile(PDEVICE_EXTENSION DeviceExt,
23 PFILE_OBJECT FileObject)
25 * FUNCTION: Cleans up after a file has been closed.
31 DPRINT("VfatCleanupFile(DeviceExt %x, FileObject %x)\n",
32 DeviceExt, FileObject);
34 /* FIXME: handle file/directory deletion here */
35 pCcb = (PVFATCCB) (FileObject->FsContext2);
38 return STATUS_SUCCESS;
42 if (FileObject->FileName.Buffer)
44 if (pFcb->Flags & FCB_UPDATE_DIRENTRY)
46 VfatUpdateEntry (DeviceExt, FileObject);
47 pFcb->Flags &= ~FCB_UPDATE_DIRENTRY;
51 /* Uninitialize the file cache. */
52 CcRosReleaseFileCache (FileObject, pFcb->RFCB.Bcb);
54 return STATUS_SUCCESS;
57 NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
59 * FUNCTION: Cleans up after a file has been closed.
64 DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
66 if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
68 Status = STATUS_SUCCESS;
72 if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
74 return VfatQueueRequest (IrpContext);
77 Status = VfatCleanupFile(IrpContext->DeviceExt, IrpContext->FileObject);
79 ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
82 IrpContext->Irp->IoStatus.Status = Status;
83 IrpContext->Irp->IoStatus.Information = 0;
85 IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
86 VfatFreeIrpContext(IrpContext);