Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencdfs.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 2002, 2003 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* $Id: cdfs.c 48654 2010-08-30 11:51:17Z mjmartin $ 00020 * 00021 * COPYRIGHT: See COPYING in the top level directory 00022 * PROJECT: ReactOS kernel 00023 * FILE: drivers/fs/cdfs/cdfs.c 00024 * PURPOSE: CDROM (ISO 9660) filesystem driver 00025 * PROGRAMMER: Art Yerkes 00026 * Eric Kohl 00027 */ 00028 00029 /* INCLUDES *****************************************************************/ 00030 00031 #include "cdfs.h" 00032 00033 #define NDEBUG 00034 #include <debug.h> 00035 00036 /* GLOBALS ******************************************************************/ 00037 00038 PCDFS_GLOBAL_DATA CdfsGlobalData; 00039 00040 00041 /* FUNCTIONS ****************************************************************/ 00042 00043 NTSTATUS NTAPI 00044 DriverEntry(PDRIVER_OBJECT DriverObject, 00045 PUNICODE_STRING RegistryPath) 00046 /* 00047 * FUNCTION: Called by the system to initalize the driver 00048 * ARGUMENTS: 00049 * DriverObject = object describing this driver 00050 * RegistryPath = path to our configuration entries 00051 * RETURNS: Success or failure 00052 */ 00053 { 00054 PDEVICE_OBJECT DeviceObject; 00055 NTSTATUS Status; 00056 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Cdfs"); 00057 00058 DPRINT("CDFS 0.0.3\n"); 00059 00060 Status = IoCreateDevice(DriverObject, 00061 sizeof(CDFS_GLOBAL_DATA), 00062 &DeviceName, 00063 FILE_DEVICE_CD_ROM_FILE_SYSTEM, 00064 0, 00065 FALSE, 00066 &DeviceObject); 00067 if (!NT_SUCCESS(Status)) 00068 { 00069 return(Status); 00070 } 00071 00072 /* Initialize global data */ 00073 CdfsGlobalData = DeviceObject->DeviceExtension; 00074 RtlZeroMemory(CdfsGlobalData, 00075 sizeof(CDFS_GLOBAL_DATA)); 00076 CdfsGlobalData->DriverObject = DriverObject; 00077 CdfsGlobalData->DeviceObject = DeviceObject; 00078 00079 /* Initialize driver data */ 00080 DeviceObject->Flags = DO_DIRECT_IO; 00081 DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose; 00082 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup; 00083 DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate; 00084 DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead; 00085 DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite; 00086 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = 00087 CdfsFileSystemControl; 00088 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = 00089 CdfsDirectoryControl; 00090 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = 00091 CdfsQueryInformation; 00092 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = 00093 CdfsSetInformation; 00094 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = 00095 CdfsQueryVolumeInformation; 00096 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = 00097 CdfsSetVolumeInformation; 00098 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = 00099 CdfsDeviceControl; 00100 00101 DriverObject->DriverUnload = NULL; 00102 00103 /* Cache manager */ 00104 CdfsGlobalData->CacheMgrCallbacks.AcquireForLazyWrite = CdfsAcquireForLazyWrite; 00105 CdfsGlobalData->CacheMgrCallbacks.ReleaseFromLazyWrite = CdfsReleaseFromLazyWrite; 00106 CdfsGlobalData->CacheMgrCallbacks.AcquireForReadAhead = CdfsAcquireForLazyWrite; 00107 CdfsGlobalData->CacheMgrCallbacks.ReleaseFromReadAhead = CdfsReleaseFromLazyWrite; 00108 00109 DeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM; 00110 00111 IoRegisterFileSystem(DeviceObject); 00112 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; 00113 00114 return(STATUS_SUCCESS); 00115 } 00116 00117 00118 BOOLEAN NTAPI 00119 CdfsAcquireForLazyWrite(IN PVOID Context, 00120 IN BOOLEAN Wait) 00121 { 00122 PFCB Fcb = (PFCB)Context; 00123 ASSERT(Fcb); 00124 DPRINT("CdfsAcquireForLazyWrite(): Fcb %p\n", Fcb); 00125 00126 if (!ExAcquireResourceExclusiveLite(&(Fcb->MainResource), Wait)) 00127 { 00128 DPRINT("CdfsAcquireForLazyWrite(): ExReleaseResourceLite failed.\n"); 00129 return FALSE; 00130 } 00131 return TRUE; 00132 } 00133 00134 VOID NTAPI 00135 CdfsReleaseFromLazyWrite(IN PVOID Context) 00136 { 00137 PFCB Fcb = (PFCB)Context; 00138 ASSERT(Fcb); 00139 DPRINT("CdfsReleaseFromLazyWrite(): Fcb %p\n", Fcb); 00140 00141 ExReleaseResourceLite(&(Fcb->MainResource)); 00142 } Generated on Sun May 27 2012 04:27:29 for ReactOS by
1.7.6.1
|