Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygeniface.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 1998, 1999, 2000, 2001 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 /* 00020 * PROJECT: ReactOS kernel 00021 * FILE: drivers/fs/vfat/iface.c 00022 * PURPOSE: VFAT Filesystem 00023 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com) 00024 */ 00025 00026 /* INCLUDES *****************************************************************/ 00027 00028 #define NDEBUG 00029 #include "vfat.h" 00030 00031 /* GLOBALS *****************************************************************/ 00032 00033 PVFAT_GLOBAL_DATA VfatGlobalData; 00034 00035 /* FUNCTIONS ****************************************************************/ 00036 00037 NTSTATUS NTAPI 00038 DriverEntry(PDRIVER_OBJECT DriverObject, 00039 PUNICODE_STRING RegistryPath) 00040 /* 00041 * FUNCTION: Called by the system to initialize the driver 00042 * ARGUMENTS: 00043 * DriverObject = object describing this driver 00044 * RegistryPath = path to our configuration entries 00045 * RETURNS: Success or failure 00046 */ 00047 { 00048 PDEVICE_OBJECT DeviceObject; 00049 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Fat"); 00050 NTSTATUS Status; 00051 00052 Status = IoCreateDevice(DriverObject, 00053 sizeof(VFAT_GLOBAL_DATA), 00054 &DeviceName, 00055 FILE_DEVICE_DISK_FILE_SYSTEM, 00056 0, 00057 FALSE, 00058 &DeviceObject); 00059 00060 if (Status == STATUS_OBJECT_NAME_EXISTS || 00061 Status == STATUS_OBJECT_NAME_COLLISION) 00062 { 00063 /* Try an other name, if 'Fat' is already in use. 'Fat' is also used by fastfat.sys on W2K */ 00064 RtlInitUnicodeString(&DeviceName, L"\\RosFat"); 00065 Status = IoCreateDevice(DriverObject, 00066 sizeof(VFAT_GLOBAL_DATA), 00067 &DeviceName, 00068 FILE_DEVICE_DISK_FILE_SYSTEM, 00069 0, 00070 FALSE, 00071 &DeviceObject); 00072 } 00073 00074 00075 00076 if (!NT_SUCCESS(Status)) 00077 { 00078 return (Status); 00079 } 00080 00081 VfatGlobalData = DeviceObject->DeviceExtension; 00082 RtlZeroMemory (VfatGlobalData, sizeof(VFAT_GLOBAL_DATA)); 00083 VfatGlobalData->DriverObject = DriverObject; 00084 VfatGlobalData->DeviceObject = DeviceObject; 00085 00086 DeviceObject->Flags |= DO_DIRECT_IO; 00087 DriverObject->MajorFunction[IRP_MJ_CLOSE] = VfatBuildRequest; 00088 DriverObject->MajorFunction[IRP_MJ_CREATE] = VfatBuildRequest; 00089 DriverObject->MajorFunction[IRP_MJ_READ] = VfatBuildRequest; 00090 DriverObject->MajorFunction[IRP_MJ_WRITE] = VfatBuildRequest; 00091 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = VfatBuildRequest; 00092 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = VfatBuildRequest; 00093 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = VfatBuildRequest; 00094 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = VfatBuildRequest; 00095 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = 00096 VfatBuildRequest; 00097 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = 00098 VfatBuildRequest; 00099 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = VfatShutdown; 00100 DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] = VfatBuildRequest; 00101 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = VfatBuildRequest; 00102 DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = VfatBuildRequest; 00103 DriverObject->MajorFunction[IRP_MJ_PNP] = VfatBuildRequest; 00104 00105 DriverObject->DriverUnload = NULL; 00106 00107 /* Cache manager */ 00108 VfatGlobalData->CacheMgrCallbacks.AcquireForLazyWrite = VfatAcquireForLazyWrite; 00109 VfatGlobalData->CacheMgrCallbacks.ReleaseFromLazyWrite = VfatReleaseFromLazyWrite; 00110 VfatGlobalData->CacheMgrCallbacks.AcquireForReadAhead = VfatAcquireForReadAhead; 00111 VfatGlobalData->CacheMgrCallbacks.ReleaseFromReadAhead = VfatReleaseFromReadAhead; 00112 00113 /* Fast I/O */ 00114 VfatInitFastIoRoutines(&VfatGlobalData->FastIoDispatch); 00115 DriverObject->FastIoDispatch = &VfatGlobalData->FastIoDispatch; 00116 00117 /* Private lists */ 00118 ExInitializeNPagedLookasideList(&VfatGlobalData->FcbLookasideList, 00119 NULL, NULL, 0, sizeof(VFATFCB), TAG_FCB, 0); 00120 ExInitializeNPagedLookasideList(&VfatGlobalData->CcbLookasideList, 00121 NULL, NULL, 0, sizeof(VFATCCB), TAG_CCB, 0); 00122 ExInitializeNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList, 00123 NULL, NULL, 0, sizeof(VFAT_IRP_CONTEXT), TAG_IRP, 0); 00124 00125 ExInitializeResourceLite(&VfatGlobalData->VolumeListLock); 00126 InitializeListHead(&VfatGlobalData->VolumeListHead); 00127 IoRegisterFileSystem(DeviceObject); 00128 return(STATUS_SUCCESS); 00129 } 00130 00131 /* EOF */ 00132 Generated on Sun May 27 2012 04:27:46 for ReactOS by
1.7.6.1
|