Reworked code for handling of asynchonous i/o requests.
[reactos.git] / reactos / drivers / fs / vfat / cleanup.c
1 /* $Id: cleanup.c,v 1.3 2001/11/02 22:44:34 hbirr Exp $
2 *
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)
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <ddk/ntddk.h>
13
14 #define NDEBUG
15 #include <debug.h>
16
17 #include "vfat.h"
18
19 /* FUNCTIONS ****************************************************************/
20
21 static NTSTATUS
22 VfatCleanupFile(PDEVICE_EXTENSION DeviceExt,
23 PFILE_OBJECT FileObject)
24 /*
25 * FUNCTION: Cleans up after a file has been closed.
26 */
27 {
28 DPRINT("VfatCleanupFile(DeviceExt %x, FileObject %x)\n",
29 DeviceExt, FileObject);
30
31 /* FIXME: handle file/directory deletion here */
32
33 return STATUS_SUCCESS;
34 }
35
36 NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
37 /*
38 * FUNCTION: Cleans up after a file has been closed.
39 */
40 {
41 NTSTATUS Status;
42
43 DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
44
45 if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
46 {
47 return VfatQueueRequest (IrpContext);
48 }
49
50 Status = VfatCleanupFile(IrpContext->DeviceExt, IrpContext->FileObject);
51
52 ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
53
54 IrpContext->Irp->IoStatus.Status = Status;
55 IrpContext->Irp->IoStatus.Information = 0;
56
57 IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
58 VfatFreeIrpContext(IrpContext);
59 return (Status);
60 }
61
62 /* EOF */