[FORMATTING] Fix indentation

svn path=/trunk/; revision=31740
This commit is contained in:
Hervé Poussineau 2008-01-12 17:20:11 +00:00
parent daea1a27a5
commit 0e38eeaf88

View file

@ -13,145 +13,146 @@
/* FUNCTIONS ****************************************************************/
static NTSTATUS
VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
/*
* FUNCTION: Cleans up after a file has been closed.
*/
static NTSTATUS
VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
{
PVFATFCB pFcb;
PFILE_OBJECT FileObject = IrpContext->FileObject;
PVFATFCB pFcb;
PFILE_OBJECT FileObject = IrpContext->FileObject;
DPRINT("VfatCleanupFile(DeviceExt %p, FileObject %p)\n",
IrpContext->DeviceExt, FileObject);
DPRINT("VfatCleanupFile(DeviceExt %p, FileObject %p)\n",
IrpContext->DeviceExt, FileObject);
/* FIXME: handle file/directory deletion here */
pFcb = (PVFATFCB) FileObject->FsContext;
if (pFcb)
/* FIXME: handle file/directory deletion here */
pFcb = (PVFATFCB) FileObject->FsContext;
if (!pFcb)
return STATUS_SUCCESS;
if (pFcb->Flags & FCB_IS_VOLUME)
{
if (pFcb->Flags & FCB_IS_VOLUME)
{
pFcb->OpenHandleCount--;
pFcb->OpenHandleCount--;
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
else
}
else
{
if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
return STATUS_PENDING;
}
if(!ExAcquireResourceExclusiveLite (&pFcb->PagingIoResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
ExReleaseResourceLite (&pFcb->MainResource);
return STATUS_PENDING;
}
pFcb->OpenHandleCount--;
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
FsRtlFastUnlockAll(&pFcb->FileLock,
FileObject,
IoGetRequestorProcess(IrpContext->Irp),
NULL);
}
if (pFcb->Flags & FCB_IS_DIRTY)
{
VfatUpdateEntry (pFcb);
}
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 1)
{
PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject;
if (tmpFileObject != NULL)
{
return STATUS_PENDING;
}
if(!ExAcquireResourceExclusiveLite (&pFcb->PagingIoResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
ExReleaseResourceLite (&pFcb->MainResource);
return STATUS_PENDING;
}
pFcb->OpenHandleCount--;
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
FsRtlFastUnlockAll(&pFcb->FileLock,
FileObject,
IoGetRequestorProcess(IrpContext->Irp),
NULL);
}
if (pFcb->Flags & FCB_IS_DIRTY)
{
VfatUpdateEntry (pFcb);
}
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 1)
{
PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject;
if (tmpFileObject != NULL)
{
pFcb->FileObject = NULL;
pFcb->FileObject = NULL;
#ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache(tmpFileObject);
CcRosReleaseFileCache(tmpFileObject);
#else
CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
#endif
ObDereferenceObject(tmpFileObject);
ObDereferenceObject(tmpFileObject);
}
#if 0
/* FIXME:
* CcPurgeCacheSection is unimplemented.
*/
CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
/* FIXME:
* CcPurgeCacheSection is unimplemented.
*/
CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
#endif
}
/* Uninitialize file cache if. */
}
/* Uninitialize file cache if. */
#ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache (FileObject);
CcRosReleaseFileCache (FileObject);
#else
if (FileObject->SectionObjectPointer->SharedCacheMap)
{
CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL);
}
if (FileObject->SectionObjectPointer->SharedCacheMap)
{
CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL);
}
#endif
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
FileObject->Flags |= FO_CLEANUP_COMPLETE;
FileObject->Flags |= FO_CLEANUP_COMPLETE;
ExReleaseResourceLite (&pFcb->PagingIoResource);
ExReleaseResourceLite (&pFcb->MainResource);
}
ExReleaseResourceLite (&pFcb->PagingIoResource);
ExReleaseResourceLite (&pFcb->MainResource);
}
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
/*
* FUNCTION: Cleans up after a file has been closed.
*/
NTSTATUS VfatCleanup(PVFAT_IRP_CONTEXT IrpContext)
{
NTSTATUS Status;
NTSTATUS Status;
DPRINT("VfatCleanup(DeviceObject %p, Irp %p)\n", IrpContext->DeviceObject, IrpContext->Irp);
DPRINT("VfatCleanup(DeviceObject %p, Irp %p)\n", IrpContext->DeviceObject, IrpContext->Irp);
if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{
Status = STATUS_SUCCESS;
goto ByeBye;
}
if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{
Status = STATUS_SUCCESS;
goto ByeBye;
}
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
Status = VfatCleanupFile(IrpContext);
Status = VfatCleanupFile(IrpContext);
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
if (Status == STATUS_PENDING)
{
return VfatQueueRequest(IrpContext);
}
if (Status == STATUS_PENDING)
{
return VfatQueueRequest(IrpContext);
}
ByeBye:
IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0;
IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0;
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
VfatFreeIrpContext(IrpContext);
return (Status);
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
VfatFreeIrpContext(IrpContext);
return (Status);
}
/* EOF */