2002-09-09 17:27:14 +00:00
|
|
|
/*
|
2013-03-16 19:49:08 +00:00
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 2002 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: services/fs/cdfs/cleanup.c
|
|
|
|
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
|
|
|
* PROGRAMMER:
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
*/
|
2002-09-09 17:27:14 +00:00
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2005-07-20 02:52:52 +00:00
|
|
|
#include "cdfs.h"
|
2002-09-09 17:27:14 +00:00
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
|
|
|
static NTSTATUS
|
|
|
|
CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
|
2009-02-03 14:50:50 +00:00
|
|
|
PFILE_OBJECT FileObject)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Cleans up after a file has been closed.
|
|
|
|
*/
|
2002-09-09 17:27:14 +00:00
|
|
|
{
|
2014-04-19 06:38:25 +00:00
|
|
|
PFCB Fcb;
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2013-05-11 09:24:31 +00:00
|
|
|
DPRINT("CdfsCleanupFile(DeviceExt %p, FileObject %p)\n",
|
2009-02-03 14:50:50 +00:00
|
|
|
DeviceExt,
|
|
|
|
FileObject);
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2014-04-19 06:38:25 +00:00
|
|
|
Fcb = FileObject->FsContext;
|
2014-04-19 06:32:58 +00:00
|
|
|
if (!Fcb)
|
|
|
|
{
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-04-18 21:49:12 +00:00
|
|
|
/* Notify about the cleanup */
|
|
|
|
FsRtlNotifyCleanup(DeviceExt->NotifySync,
|
|
|
|
&(DeviceExt->NotifyList),
|
|
|
|
FileObject->FsContext2);
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
/* Uninitialize file cache if initialized for this file object. */
|
|
|
|
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
|
2003-01-02 16:01:21 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
2003-01-02 16:01:21 +00:00
|
|
|
}
|
2005-05-08 02:16:32 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
return STATUS_SUCCESS;
|
2002-09-09 17:27:14 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 20:14:45 +00:00
|
|
|
NTSTATUS NTAPI
|
2002-09-09 17:27:14 +00:00
|
|
|
CdfsCleanup(PDEVICE_OBJECT DeviceObject,
|
2009-02-03 14:50:50 +00:00
|
|
|
PIRP Irp)
|
2002-09-09 17:27:14 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
PDEVICE_EXTENSION DeviceExtension;
|
|
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
NTSTATUS Status;
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("CdfsCleanup() called\n");
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
2002-09-09 17:27:14 +00:00
|
|
|
{
|
2009-02-03 14:50:50 +00:00
|
|
|
DPRINT("Closing file system\n");
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
goto ByeBye;
|
2002-09-09 17:27:14 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
Stack = IoGetCurrentIrpStackLocation(Irp);
|
|
|
|
FileObject = Stack->FileObject;
|
|
|
|
DeviceExtension = DeviceObject->DeviceExtension;
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
KeEnterCriticalRegion();
|
|
|
|
ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource, TRUE);
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
Status = CdfsCleanupFile(DeviceExtension, FileObject);
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
ExReleaseResourceLite(&DeviceExtension->DirResource);
|
|
|
|
KeLeaveCriticalRegion();
|
2002-09-09 17:27:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
ByeBye:
|
2009-02-03 14:50:50 +00:00
|
|
|
Irp->IoStatus.Status = Status;
|
|
|
|
Irp->IoStatus.Information = 0;
|
2002-09-09 17:27:14 +00:00
|
|
|
|
2009-02-03 14:50:50 +00:00
|
|
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
|
|
return(Status);
|
2002-09-09 17:27:14 +00:00
|
|
|
}
|
|
|
|
|
2003-09-20 20:31:57 +00:00
|
|
|
/* EOF */
|