Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenclose.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS kernel 00004 * FILE: drivers/fs/vfat/close.c 00005 * PURPOSE: VFAT Filesystem 00006 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com) 00007 */ 00008 00009 /* INCLUDES *****************************************************************/ 00010 00011 #define NDEBUG 00012 #include "vfat.h" 00013 00014 /* FUNCTIONS ****************************************************************/ 00015 00016 NTSTATUS 00017 VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject) 00018 /* 00019 * FUNCTION: Closes a file 00020 */ 00021 { 00022 PVFATFCB pFcb; 00023 PVFATCCB pCcb; 00024 NTSTATUS Status = STATUS_SUCCESS; 00025 00026 DPRINT ("VfatCloseFile(DeviceExt %p, FileObject %p)\n", 00027 DeviceExt, FileObject); 00028 00029 /* FIXME : update entry in directory? */ 00030 pCcb = (PVFATCCB) (FileObject->FsContext2); 00031 pFcb = (PVFATFCB) (FileObject->FsContext); 00032 00033 if (pFcb == NULL) 00034 { 00035 return STATUS_SUCCESS; 00036 } 00037 00038 if (pFcb->Flags & FCB_IS_VOLUME) 00039 { 00040 DPRINT1("Volume\n"); 00041 pFcb->RefCount--; 00042 FileObject->FsContext2 = NULL; 00043 } 00044 else 00045 { 00046 if (FileObject->DeletePending) 00047 { 00048 if (pFcb->Flags & FCB_DELETE_PENDING) 00049 { 00050 VfatDelEntry (DeviceExt, pFcb); 00051 } 00052 else 00053 { 00054 Status = STATUS_DELETE_PENDING; 00055 } 00056 } 00057 vfatReleaseFCB (DeviceExt, pFcb); 00058 } 00059 00060 FileObject->FsContext2 = NULL; 00061 FileObject->FsContext = NULL; 00062 FileObject->SectionObjectPointer = NULL; 00063 00064 if (pCcb) 00065 { 00066 vfatDestroyCCB(pCcb); 00067 } 00068 00069 return Status; 00070 } 00071 00072 NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext) 00073 /* 00074 * FUNCTION: Closes a file 00075 */ 00076 { 00077 NTSTATUS Status; 00078 00079 DPRINT ("VfatClose(DeviceObject %p, Irp %p)\n", IrpContext->DeviceObject, IrpContext->Irp); 00080 00081 if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject) 00082 { 00083 DPRINT("Closing file system\n"); 00084 Status = STATUS_SUCCESS; 00085 goto ByeBye; 00086 } 00087 #if 0 00088 /* There occurs a dead look at the call to CcRosDeleteFileCache/ObDereferenceObject/VfatClose 00089 in CmLazyCloseThreadMain if VfatClose is execute asynchronous in a worker thread. */ 00090 if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT)) 00091 #else 00092 if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, TRUE)) 00093 #endif 00094 { 00095 return VfatQueueRequest (IrpContext); 00096 } 00097 00098 Status = VfatCloseFile (IrpContext->DeviceExt, IrpContext->FileObject); 00099 ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource); 00100 00101 ByeBye: 00102 IrpContext->Irp->IoStatus.Status = Status; 00103 IrpContext->Irp->IoStatus.Information = 0; 00104 IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT); 00105 VfatFreeIrpContext(IrpContext); 00106 00107 return (Status); 00108 } 00109 00110 /* EOF */ Generated on Sun May 27 2012 04:27:29 for ReactOS by
1.7.6.1
|