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
;
52 pFcb
->Flags
|= FCB_CLOSED
;
54 vfatReleaseFCB(DeviceExt
, pFcb
);
57 FileObject
->FsContext2
= NULL
;
58 FileObject
->FsContext
= NULL
;
59 FileObject
->SectionObjectPointer
= NULL
;
67 if (IsVolume
&& DeviceExt
->OpenHandleCount
== 0)
69 VfatCheckForDismount(DeviceExt
, FALSE
);
77 * FUNCTION: Closes a file
81 PVFAT_IRP_CONTEXT IrpContext
)
85 DPRINT("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext
->DeviceObject
, IrpContext
->Irp
);
87 if (IrpContext
->DeviceObject
== VfatGlobalData
->DeviceObject
)
89 DPRINT("Closing file system\n");
90 IrpContext
->Irp
->IoStatus
.Information
= 0;
91 return STATUS_SUCCESS
;
93 if (!ExAcquireResourceExclusiveLite(&IrpContext
->DeviceExt
->DirResource
, BooleanFlagOn(IrpContext
->Flags
, IRPCONTEXT_CANWAIT
)))
95 return VfatMarkIrpContextForQueue(IrpContext
);
98 Status
= VfatCloseFile(IrpContext
->DeviceExt
, IrpContext
->FileObject
);
99 ExReleaseResourceLite(&IrpContext
->DeviceExt
->DirResource
);
101 IrpContext
->Irp
->IoStatus
.Information
= 0;