2002-08-14 20:58:39 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001 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.
|
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
1999-12-04 20:58:45 +00:00
|
|
|
*
|
1998-10-05 04:00:59 +00:00
|
|
|
* PROJECT: ReactOS kernel
|
2003-10-11 17:51:56 +00:00
|
|
|
* FILE: drivers/fs/vfat/iface.c
|
1998-10-05 04:00:59 +00:00
|
|
|
* PURPOSE: VFAT Filesystem
|
|
|
|
* PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
|
2003-10-11 17:51:56 +00:00
|
|
|
* Hartmut Birr
|
1999-12-11 21:14:49 +00:00
|
|
|
*/
|
1998-12-20 19:41:39 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
/* INCLUDES *****************************************************************/
|
1998-12-20 19:41:39 +00:00
|
|
|
|
2000-02-21 22:44:37 +00:00
|
|
|
#include <ddk/ntddk.h>
|
2003-11-17 02:12:52 +00:00
|
|
|
#include <rosrtl/string.h>
|
1998-12-20 19:41:39 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
#define NDEBUG
|
2000-06-29 23:35:53 +00:00
|
|
|
#include <debug.h>
|
1998-10-05 04:00:59 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
#include "vfat.h"
|
1998-12-20 19:41:39 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
/* GLOBALS *****************************************************************/
|
1998-10-05 04:00:59 +00:00
|
|
|
|
2002-03-18 22:37:13 +00:00
|
|
|
PVFAT_GLOBAL_DATA VfatGlobalData;
|
1998-10-05 04:00:59 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
/* FUNCTIONS ****************************************************************/
|
1999-06-27 23:06:50 +00:00
|
|
|
|
2000-12-29 23:17:12 +00:00
|
|
|
NTSTATUS STDCALL
|
2002-03-18 22:37:13 +00:00
|
|
|
DriverEntry(PDRIVER_OBJECT DriverObject,
|
2001-06-11 19:52:22 +00:00
|
|
|
PUNICODE_STRING RegistryPath)
|
1998-10-05 04:00:59 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Called by the system to initalize the driver
|
|
|
|
* ARGUMENTS:
|
|
|
|
* DriverObject = object describing this driver
|
|
|
|
* RegistryPath = path to our configuration entries
|
|
|
|
* RETURNS: Success or failure
|
|
|
|
*/
|
|
|
|
{
|
2001-03-06 08:19:58 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject;
|
2003-11-17 02:12:52 +00:00
|
|
|
UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Fat");
|
2001-03-06 08:19:58 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2002-03-18 22:37:13 +00:00
|
|
|
Status = IoCreateDevice(DriverObject,
|
|
|
|
sizeof(VFAT_GLOBAL_DATA),
|
2001-03-06 08:19:58 +00:00
|
|
|
&DeviceName,
|
2002-03-18 22:37:13 +00:00
|
|
|
FILE_DEVICE_DISK_FILE_SYSTEM,
|
2001-03-06 08:19:58 +00:00
|
|
|
0,
|
|
|
|
FALSE,
|
|
|
|
&DeviceObject);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return (Status);
|
|
|
|
}
|
2002-03-18 22:37:13 +00:00
|
|
|
VfatGlobalData = DeviceObject->DeviceExtension;
|
|
|
|
RtlZeroMemory (VfatGlobalData, sizeof(VFAT_GLOBAL_DATA));
|
|
|
|
VfatGlobalData->DriverObject = DriverObject;
|
|
|
|
VfatGlobalData->DeviceObject = DeviceObject;
|
2001-03-06 08:19:58 +00:00
|
|
|
|
|
|
|
DeviceObject->Flags = DO_DIRECT_IO;
|
2004-02-10 16:22:57 +00:00
|
|
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_READ] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_WRITE] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = VfatBuildRequest;
|
2002-08-14 20:58:39 +00:00
|
|
|
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
2004-02-10 16:22:57 +00:00
|
|
|
VfatBuildRequest;
|
2002-08-14 20:58:39 +00:00
|
|
|
DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
|
2004-02-10 16:22:57 +00:00
|
|
|
VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = VfatShutdown;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = VfatBuildRequest;
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = VfatBuildRequest;
|
2002-03-18 22:37:13 +00:00
|
|
|
|
|
|
|
DriverObject->DriverUnload = NULL;
|
2001-03-06 08:19:58 +00:00
|
|
|
|
* Used look aside lists to allocate memory for VFATFCB, VFATCCB and VFAT_IRP_CONTEXT.
* Removed IsLastEntry, IsVolEntry, IsDeletedEntry, vfat_wstrlen, vfatGrabFCB,
vfat_initstr, vfat_wcsncat, vfat_wcsncpy, vfat_movestr, wstrcmpi and replaced
this functions with existing equivalents or functions from ntoskrnl.
* Merged GetEntryName into vfatGetNextDirEntry for reducing some overhead.
* Implemented a file name cache to speed up the searching for existing fcb.
* Removed some calls to FsdDosDateTimeToFileTime.
* Moved the call to CcZeroData behind the initializing of the cache (in VfatWrite).
* Using existing fcbs in FindFile if there is no '*?' within the search name.
svn path=/trunk/; revision=3740
2002-11-11 21:49:18 +00:00
|
|
|
ExInitializeNPagedLookasideList(&VfatGlobalData->FcbLookasideList,
|
|
|
|
NULL, NULL, 0, sizeof(VFATFCB), TAG_FCB, 0);
|
|
|
|
ExInitializeNPagedLookasideList(&VfatGlobalData->CcbLookasideList,
|
|
|
|
NULL, NULL, 0, sizeof(VFATCCB), TAG_CCB, 0);
|
|
|
|
ExInitializeNPagedLookasideList(&VfatGlobalData->IrpContextLookasideList,
|
|
|
|
NULL, NULL, 0, sizeof(VFAT_IRP_CONTEXT), TAG_IRP, 0);
|
2003-02-09 18:02:56 +00:00
|
|
|
|
|
|
|
ExInitializeResourceLite(&VfatGlobalData->VolumeListLock);
|
|
|
|
InitializeListHead(&VfatGlobalData->VolumeListHead);
|
2001-03-06 08:19:58 +00:00
|
|
|
IoRegisterFileSystem(DeviceObject);
|
2002-08-14 20:58:39 +00:00
|
|
|
return(STATUS_SUCCESS);
|
1998-10-05 04:00:59 +00:00
|
|
|
}
|
2001-03-06 08:19:58 +00:00
|
|
|
|
|
|
|
/* EOF */
|
2002-03-18 22:37:13 +00:00
|
|
|
|