3 * Copyright (C) 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS kernel
22 * FILE: drivers/filesystems/cdfs/cdfs.c
23 * PURPOSE: CDROM (ISO 9660) filesystem driver
24 * PROGRAMMER: Art Yerkes
28 /* INCLUDES *****************************************************************/
35 /* GLOBALS ******************************************************************/
37 PCDFS_GLOBAL_DATA CdfsGlobalData
;
40 /* FUNCTIONS ****************************************************************/
44 DriverEntry(PDRIVER_OBJECT DriverObject
,
45 PUNICODE_STRING RegistryPath
)
47 * FUNCTION: Called by the system to initialize the driver
49 * DriverObject = object describing this driver
50 * RegistryPath = path to our configuration entries
51 * RETURNS: Success or failure
54 PDEVICE_OBJECT DeviceObject
;
56 UNICODE_STRING DeviceName
= RTL_CONSTANT_STRING(L
"\\Cdfs");
58 UNREFERENCED_PARAMETER(RegistryPath
);
60 DPRINT("CDFS 0.0.3\n");
62 Status
= IoCreateDevice(DriverObject
,
63 sizeof(CDFS_GLOBAL_DATA
),
65 FILE_DEVICE_CD_ROM_FILE_SYSTEM
,
69 if (!NT_SUCCESS(Status
))
74 /* Initialize global data */
75 CdfsGlobalData
= DeviceObject
->DeviceExtension
;
76 RtlZeroMemory(CdfsGlobalData
,
77 sizeof(CDFS_GLOBAL_DATA
));
78 CdfsGlobalData
->DriverObject
= DriverObject
;
79 CdfsGlobalData
->DeviceObject
= DeviceObject
;
81 /* Initialize driver data */
82 DeviceObject
->Flags
= DO_DIRECT_IO
;
83 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = CdfsFsdDispatch
;
84 DriverObject
->MajorFunction
[IRP_MJ_CLEANUP
] = CdfsFsdDispatch
;
85 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = CdfsFsdDispatch
;
86 DriverObject
->MajorFunction
[IRP_MJ_READ
] = CdfsFsdDispatch
;
87 DriverObject
->MajorFunction
[IRP_MJ_WRITE
] = CdfsFsdDispatch
;
88 DriverObject
->MajorFunction
[IRP_MJ_FILE_SYSTEM_CONTROL
] = CdfsFsdDispatch
;
89 DriverObject
->MajorFunction
[IRP_MJ_DIRECTORY_CONTROL
] = CdfsFsdDispatch
;
90 DriverObject
->MajorFunction
[IRP_MJ_QUERY_INFORMATION
] = CdfsFsdDispatch
;
91 DriverObject
->MajorFunction
[IRP_MJ_SET_INFORMATION
] = CdfsFsdDispatch
;
92 DriverObject
->MajorFunction
[IRP_MJ_QUERY_VOLUME_INFORMATION
] = CdfsFsdDispatch
;
93 DriverObject
->MajorFunction
[IRP_MJ_SET_VOLUME_INFORMATION
] = CdfsFsdDispatch
;
94 DriverObject
->MajorFunction
[IRP_MJ_DEVICE_CONTROL
] = CdfsFsdDispatch
;
96 CdfsGlobalData
->FastIoDispatch
.SizeOfFastIoDispatch
= sizeof(FAST_IO_DISPATCH
);
97 CdfsGlobalData
->FastIoDispatch
.FastIoCheckIfPossible
= CdfsFastIoCheckIfPossible
;
98 CdfsGlobalData
->FastIoDispatch
.FastIoRead
= CdfsFastIoRead
;
99 CdfsGlobalData
->FastIoDispatch
.FastIoWrite
= CdfsFastIoWrite
;
100 DriverObject
->FastIoDispatch
= &CdfsGlobalData
->FastIoDispatch
;
102 /* Initialize lookaside list for IRP contexts */
103 ExInitializeNPagedLookasideList(&CdfsGlobalData
->IrpContextLookasideList
,
104 NULL
, NULL
, 0, sizeof(CDFS_IRP_CONTEXT
), 'PRIC', 0);
106 DriverObject
->DriverUnload
= NULL
;
109 CdfsGlobalData
->CacheMgrCallbacks
.AcquireForLazyWrite
= CdfsAcquireForLazyWrite
;
110 CdfsGlobalData
->CacheMgrCallbacks
.ReleaseFromLazyWrite
= CdfsReleaseFromLazyWrite
;
111 CdfsGlobalData
->CacheMgrCallbacks
.AcquireForReadAhead
= CdfsAcquireForLazyWrite
;
112 CdfsGlobalData
->CacheMgrCallbacks
.ReleaseFromReadAhead
= CdfsReleaseFromLazyWrite
;
114 DeviceObject
->Flags
|= DO_LOW_PRIORITY_FILESYSTEM
;
116 IoRegisterFileSystem(DeviceObject
);
117 DeviceObject
->Flags
&= ~DO_DEVICE_INITIALIZING
;
119 return(STATUS_SUCCESS
);