Added CdfsCleanup.

svn path=/trunk/; revision=3480
This commit is contained in:
Hartmut Birr 2002-09-09 17:27:14 +00:00
parent b06d4dcc2f
commit 4b6d4d065b
4 changed files with 112 additions and 3 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: cdfs.c,v 1.6 2002/08/20 20:37:06 hyperion Exp $ /* $Id: cdfs.c,v 1.7 2002/09/09 17:27:14 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -82,6 +82,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
/* Initialize driver data */ /* Initialize driver data */
DeviceObject->Flags = DO_DIRECT_IO; DeviceObject->Flags = DO_DIRECT_IO;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose; DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate; DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead; DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite; DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;

View file

@ -227,7 +227,11 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 ); int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );
void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max ); void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max );
/* cleanup.c */
NTSTATUS STDCALL
CdfsCleanup(PDEVICE_OBJECT DeviceObject,
PIRP Irp);
/* close.c */ /* close.c */

View file

@ -0,0 +1,104 @@
/*
* 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.
*/
/* $Id: cleanup.c,v 1.1 2002/09/09 17:27:14 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/fs/cdfs/cleanup.c
* PURPOSE: CDROM (ISO 9660) filesystem driver
* PROGRAMMER: Hartmut Birr
* UPDATE HISTORY:
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#define NDEBUG
#include <debug.h>
#include "cdfs.h"
/* FUNCTIONS ****************************************************************/
static NTSTATUS
CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject)
/*
* FUNCTION: Cleans up after a file has been closed.
*/
{
PCCB Ccb;
DPRINT("CdfsCleanupFile(DeviceExt %x, FileObject %x)\n",
DeviceExt,
FileObject);
Ccb = (PCCB) (FileObject->FsContext2);
if (Ccb == NULL)
{
return STATUS_SUCCESS;
}
/* Uninitialize the file cache. */
CcRosReleaseFileCache (FileObject, Ccb->Fcb->RFCB.Bcb);
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;
ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource, TRUE);
Status = CdfsCleanupFile(DeviceExtension, FileObject);
ExReleaseResourceLite(&DeviceExtension->DirResource);
ByeBye:
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(Status);
}
/* EOF */

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.3 2002/05/01 13:15:42 ekohl Exp $ # $Id: makefile,v 1.4 2002/09/09 17:27:14 hbirr Exp $
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
@ -7,7 +7,7 @@ TARGET_TYPE = driver
TARGET_NAME = cdfs TARGET_NAME = cdfs
TARGET_OBJECTS = $(TARGET_NAME).o close.o common.o create.o dirctl.o \ TARGET_OBJECTS = $(TARGET_NAME).o close.o common.o create.o dirctl.o \
fcb.o finfo.o fsctl.o misc.o rw.o volinfo.o fcb.o finfo.o fsctl.o misc.o rw.o volinfo.o cleanup.o
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak