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
)
29 NTSTATUS Status
= STATUS_SUCCESS
;
31 DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
32 DeviceExt
, FileObject
);
34 /* FIXME : update entry in directory? */
35 pCcb
= (PVFATCCB
) (FileObject
->FsContext2
);
36 pFcb
= (PVFATFCB
) (FileObject
->FsContext
);
40 return STATUS_SUCCESS
;
43 IsVolume
= BooleanFlagOn(pFcb
->Flags
, FCB_IS_VOLUME
);
47 FileObject
->FsContext2
= NULL
;
51 vfatReleaseFCB(DeviceExt
, pFcb
);
54 FileObject
->FsContext2
= NULL
;
55 FileObject
->FsContext
= NULL
;
56 FileObject
->SectionObjectPointer
= NULL
;
64 if (IsVolume
&& DeviceExt
->OpenHandleCount
== 0)
66 VfatCheckForDismount(DeviceExt
, FALSE
);
74 * FUNCTION: Closes a file
78 PVFAT_IRP_CONTEXT IrpContext
)
82 DPRINT("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext
->DeviceObject
, IrpContext
->Irp
);
84 if (IrpContext
->DeviceObject
== VfatGlobalData
->DeviceObject
)
86 DPRINT("Closing file system\n");
87 IrpContext
->Irp
->IoStatus
.Information
= 0;
88 return STATUS_SUCCESS
;
90 if (!ExAcquireResourceExclusiveLite(&IrpContext
->DeviceExt
->DirResource
, BooleanFlagOn(IrpContext
->Flags
, IRPCONTEXT_CANWAIT
)))
92 return VfatMarkIrpContextForQueue(IrpContext
);
95 Status
= VfatCloseFile(IrpContext
->DeviceExt
, IrpContext
->FileObject
);
96 ExReleaseResourceLite(&IrpContext
->DeviceExt
->DirResource
);
98 IrpContext
->Irp
->IoStatus
.Information
= 0;