2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: drivers/filesystems/fastfat/close.c
5 * PURPOSE: VFAT Filesystem
6 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
9 /* INCLUDES *****************************************************************/
16 /* FUNCTIONS ****************************************************************/
19 * FUNCTION: Closes a file
23 PDEVICE_EXTENSION DeviceExt
,
24 PFILE_OBJECT FileObject
)
28 NTSTATUS Status
= STATUS_SUCCESS
;
30 DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
31 DeviceExt
, FileObject
);
33 /* FIXME : update entry in directory? */
34 pCcb
= (PVFATCCB
) (FileObject
->FsContext2
);
35 pFcb
= (PVFATFCB
) (FileObject
->FsContext
);
39 return STATUS_SUCCESS
;
42 if (BooleanFlagOn(pFcb
->Flags
, FCB_IS_VOLUME
))
45 FileObject
->FsContext2
= NULL
;
49 vfatReleaseFCB(DeviceExt
, pFcb
);
52 FileObject
->FsContext2
= NULL
;
53 FileObject
->FsContext
= NULL
;
54 FileObject
->SectionObjectPointer
= NULL
;
55 DeviceExt
->OpenHandleCount
--;
63 if (DeviceExt
->OpenHandleCount
== 0)
65 VfatCheckForDismount(DeviceExt
, FALSE
);
73 * FUNCTION: Closes a file
77 PVFAT_IRP_CONTEXT IrpContext
)
81 DPRINT("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext
->DeviceObject
, IrpContext
->Irp
);
83 if (IrpContext
->DeviceObject
== VfatGlobalData
->DeviceObject
)
85 DPRINT("Closing file system\n");
86 IrpContext
->Irp
->IoStatus
.Information
= 0;
87 return STATUS_SUCCESS
;
89 if (!ExAcquireResourceExclusiveLite(&IrpContext
->DeviceExt
->DirResource
, BooleanFlagOn(IrpContext
->Flags
, IRPCONTEXT_CANWAIT
)))
91 return VfatMarkIrpContextForQueue(IrpContext
);
94 Status
= VfatCloseFile(IrpContext
->DeviceExt
, IrpContext
->FileObject
);
95 ExReleaseResourceLite(&IrpContext
->DeviceExt
->DirResource
);
97 IrpContext
->Irp
->IoStatus
.Information
= 0;