mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Added CdfsCleanup.
svn path=/trunk/; revision=3480
This commit is contained in:
parent
b06d4dcc2f
commit
4b6d4d065b
4 changed files with 112 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -82,6 +82,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
/* Initialize driver data */
|
||||
DeviceObject->Flags = DO_DIRECT_IO;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;
|
||||
|
|
|
@ -227,7 +227,11 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
|
|||
int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );
|
||||
void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max );
|
||||
|
||||
/* cleanup.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
CdfsCleanup(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp);
|
||||
|
||||
/* close.c */
|
||||
|
||||
|
|
104
reactos/drivers/fs/cdfs/cleanup.c
Normal file
104
reactos/drivers/fs/cdfs/cleanup.c
Normal 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 */
|
|
@ -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 = ../../..
|
||||
|
||||
|
@ -7,7 +7,7 @@ TARGET_TYPE = driver
|
|||
TARGET_NAME = cdfs
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue