[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 ****************************************************************/ /* FUNCTIONS ****************************************************************/
static NTSTATUS
VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
/* /*
* FUNCTION: Cleans up after a file has been closed. * FUNCTION: Cleans up after a file has been closed.
*/ */
static NTSTATUS
VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
{ {
PVFATFCB pFcb; PVFATFCB pFcb;
PFILE_OBJECT FileObject = IrpContext->FileObject; PFILE_OBJECT FileObject = IrpContext->FileObject;
DPRINT("VfatCleanupFile(DeviceExt %p, FileObject %p)\n", DPRINT("VfatCleanupFile(DeviceExt %p, FileObject %p)\n",
IrpContext->DeviceExt, FileObject); IrpContext->DeviceExt, FileObject);
/* FIXME: handle file/directory deletion here */ /* FIXME: handle file/directory deletion here */
pFcb = (PVFATFCB) FileObject->FsContext; pFcb = (PVFATFCB) FileObject->FsContext;
if (pFcb) 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) if (pFcb->OpenHandleCount != 0)
{ {
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess); IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
} }
else }
else
{
if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{ {
if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource, return STATUS_PENDING;
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT))) }
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; pFcb->FileObject = NULL;
}
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;
#ifdef USE_ROS_CC_AND_FS #ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache(tmpFileObject); CcRosReleaseFileCache(tmpFileObject);
#else #else
CcUninitializeCacheMap(tmpFileObject, NULL, NULL); CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
#endif #endif
ObDereferenceObject(tmpFileObject); ObDereferenceObject(tmpFileObject);
} }
#if 0 #if 0
/* FIXME: /* FIXME:
* CcPurgeCacheSection is unimplemented. * CcPurgeCacheSection is unimplemented.
*/ */
CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE); CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
#endif #endif
} }
/* Uninitialize file cache if. */ /* Uninitialize file cache if. */
#ifdef USE_ROS_CC_AND_FS #ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache (FileObject); CcRosReleaseFileCache (FileObject);
#else #else
if (FileObject->SectionObjectPointer->SharedCacheMap) if (FileObject->SectionObjectPointer->SharedCacheMap)
{ {
CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL); CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL);
} }
#endif #endif
if (pFcb->OpenHandleCount != 0) if (pFcb->OpenHandleCount != 0)
{ {
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess); IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
} }
FileObject->Flags |= FO_CLEANUP_COMPLETE; FileObject->Flags |= FO_CLEANUP_COMPLETE;
ExReleaseResourceLite (&pFcb->PagingIoResource); ExReleaseResourceLite (&pFcb->PagingIoResource);
ExReleaseResourceLite (&pFcb->MainResource); ExReleaseResourceLite (&pFcb->MainResource);
}
} }
return STATUS_SUCCESS;
return STATUS_SUCCESS;
} }
NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
/* /*
* FUNCTION: Cleans up after a file has been closed. * 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) if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{ {
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
goto ByeBye; goto ByeBye;
} }
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT))) (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{ {
return VfatQueueRequest (IrpContext); return VfatQueueRequest (IrpContext);
} }
Status = VfatCleanupFile(IrpContext); Status = VfatCleanupFile(IrpContext);
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource); ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
return VfatQueueRequest(IrpContext); return VfatQueueRequest(IrpContext);
} }
ByeBye: ByeBye:
IrpContext->Irp->IoStatus.Status = Status; IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0; IrpContext->Irp->IoStatus.Information = 0;
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT); IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
VfatFreeIrpContext(IrpContext); VfatFreeIrpContext(IrpContext);
return (Status); return (Status);
} }
/* EOF */ /* EOF */