2002-09-09 17:27:14 +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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2002-09-09 17:27:14 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: services/fs/cdfs/cleanup.c
|
|
|
|
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
2007-10-19 23:21:45 +00:00
|
|
|
* PROGRAMMER:
|
2005-05-08 02:16:32 +00:00
|
|
|
* 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,
|
|
|
|
PFILE_OBJECT FileObject)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Cleans up after a file has been closed.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
|
|
|
|
DPRINT("CdfsCleanupFile(DeviceExt %x, FileObject %x)\n",
|
|
|
|
DeviceExt,
|
|
|
|
FileObject);
|
|
|
|
|
|
|
|
|
2003-01-02 16:01:21 +00:00
|
|
|
/* Uninitialize file cache if initialized for this file object. */
|
2003-06-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
Changes for compiling with w32api
* include/ddk/cctypes.h (PREACTOS_COMMON_FCB_HEADER): Remove.
(FSRTL_COMMON_FCB_HEADER): Add.
* include/ddk/iotypes.h (FILE_OBJECT): Rename field
SectionObjectPointers to SectionObjectPointer.
* ntoskrnl/cc/copy.c, ntoskrnl/cc/misc.c, ntoskrnl/cc/pin.c,
ntoskrnl/cc/view.c, ntoskrnl/io/rawfs.c, ntoskrnl/mm/section.c,
drivers/fs/cdfs/cleanup.c, drivers/fs/cdfs/fcb.c,
drivers/fs/cdfs/fsctl.c, drivers/fs/ntfs/fcb.c, drivers/fs/ntfs/fsctl.c,
drivers/fs/vfat/close.c, drivers/fs/vfat/create.c,
drivers/fs/vfat/finfo.c, drivers/fs/vfat/fcb.c, drivers/fs/vfat/fsctl.c:
Use new FILE_OBJECT structure.
* drivers/fs/cdfs/cdfs.h, drivers/fs/ntfs/ntfs.h, drivers/fs/vfat/vfat.h:
Use new FSRTL_COMMON_FCB_HEADER structure.
* drivers/net/afd/include/afd.h (FSRTL_COMMON_FCB_HEADER): Remove.
* include/ddk/ketypes.h (KQUEUE): Match w32api structure.
* ntoskrnl/ke/queue.c, ntoskrnl/ke/wait.c: Use new structure.
* ntoskrnl/ke/spinlock.c (KeAcquireSpinLockAtDpcLevel,
KeReleaseSpinLockFromDpcLevel): Undefine before declaring.
svn path=/trunk/; revision=4865
2003-06-07 11:34:36 +00:00
|
|
|
if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap)
|
2003-01-02 16:01:21 +00:00
|
|
|
{
|
2005-02-13 17:21:16 +00:00
|
|
|
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
2003-01-02 16:01:21 +00:00
|
|
|
}
|
2005-05-08 02:16:32 +00:00
|
|
|
|
2002-09-09 17:27:14 +00:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS STDCALL
|
|
|
|
CdfsCleanup(PDEVICE_OBJECT DeviceObject,
|
|
|
|
PIRP Irp)
|
|
|
|
{
|
|
|
|
PDEVICE_EXTENSION DeviceExtension;
|
|
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
DPRINT("CdfsCleanup() called\n");
|
|
|
|
|
|
|
|
if (DeviceObject == CdfsGlobalData->DeviceObject)
|
|
|
|
{
|
|
|
|
DPRINT("Closing file system\n");
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
goto ByeBye;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stack = IoGetCurrentIrpStackLocation(Irp);
|
|
|
|
FileObject = Stack->FileObject;
|
|
|
|
DeviceExtension = DeviceObject->DeviceExtension;
|
|
|
|
|
2008-04-29 20:01:38 +00:00
|
|
|
KeEnterCriticalRegion();
|
2002-09-09 17:27:14 +00:00
|
|
|
ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource, TRUE);
|
|
|
|
|
|
|
|
Status = CdfsCleanupFile(DeviceExtension, FileObject);
|
|
|
|
|
|
|
|
ExReleaseResourceLite(&DeviceExtension->DirResource);
|
2008-04-29 20:01:38 +00:00
|
|
|
KeLeaveCriticalRegion();
|
2002-09-09 17:27:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
ByeBye:
|
|
|
|
Irp->IoStatus.Status = Status;
|
|
|
|
Irp->IoStatus.Information = 0;
|
|
|
|
|
|
|
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
|
2003-09-20 20:31:57 +00:00
|
|
|
/* EOF */
|
|
|
|
|