ReactOS  0.4.14-dev-317-g96040ec
iface.c
Go to the documentation of this file.
1 /*
2  * ReactOS kernel
3  * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4  *
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.
9  *
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.
14  *
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.
18  */
19 /*
20  * PROJECT: ReactOS kernel
21  * FILE: drivers/fs/vfat/iface.c
22  * PURPOSE: VFAT Filesystem
23  * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
24  * Pierre Schweitzer (pierre@reactos.org)
25  */
26 
27 /* INCLUDES *****************************************************************/
28 
29 #include "vfat.h"
30 
31 #define NDEBUG
32 #include <debug.h>
33 
34 #if defined(ALLOC_PRAGMA)
35 #pragma alloc_text(INIT, DriverEntry)
36 #endif
37 
38 /* GLOBALS *****************************************************************/
39 
41 
42 /* FUNCTIONS ****************************************************************/
43 
44 /*
45  * FUNCTION: Called by the system to initialize the driver
46  * ARGUMENTS:
47  * DriverObject = object describing this driver
48  * RegistryPath = path to our configuration entries
49  * RETURNS: Success or failure
50  */
51 INIT_FUNCTION
53 NTAPI
57 {
61 
63 
65  sizeof(VFAT_GLOBAL_DATA),
66  &DeviceName,
68  0,
69  FALSE,
70  &DeviceObject);
73  {
74  /* Try an other name, if 'Fat' is already in use. 'Fat' is also used by fastfat.sys on W2K */
75  RtlInitUnicodeString(&DeviceName, L"\\RosFat");
77  sizeof(VFAT_GLOBAL_DATA),
78  &DeviceName,
80  0,
81  FALSE,
82  &DeviceObject);
83  }
84 
85  if (!NT_SUCCESS(Status))
86  {
87  return Status;
88  }
89 
95  /* Enable this to enter the debugger when file system corruption
96  * has been detected:
97  VfatGlobalData->Flags = VFAT_BREAK_ON_CORRUPTION; */
98 
99  /* Delayed close support */
107  {
110  }
111 
129 
131 
132  /* Cache manager */
137 
138  /* Fast I/O */
141 
142  /* Private lists */
144  NULL, NULL, 0, sizeof(VFATFCB), TAG_FCB, 0);
146  NULL, NULL, 0, sizeof(VFATCCB), TAG_CCB, 0);
148  NULL, NULL, 0, sizeof(VFAT_IRP_CONTEXT), TAG_IRP, 0);
150  NULL, NULL, 0, sizeof(VFAT_CLOSE_CONTEXT), TAG_CLOSE, 0);
151 
155 
156 #ifdef KDBG
157  {
158  BOOLEAN Registered;
159 
160  Registered = KdRosRegisterCliCallback(vfatKdbgHandler);
161  DPRINT1("FastFAT KDBG extension registered: %s\n", (Registered ? "yes" : "no"));
162  }
163 #endif
164 
165  return STATUS_SUCCESS;
166 }
167 
168 /* EOF */
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define TAG_FCB
Definition: vfat.h:541
#define IN
Definition: typedefs.h:38
LIST_ENTRY VolumeListHead
Definition: vfat.h:410
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:274
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
FAST_MUTEX CloseMutex
Definition: vfat.h:417
#define IRP_MJ_FLUSH_BUFFERS
Definition: vfat.h:441
Definition: vfat.h:530
#define IRP_MJ_SHUTDOWN
NPAGED_LOOKASIDE_LIST FcbLookasideList
Definition: vfat.h:411
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
PDRIVER_OBJECT DriverObject
Definition: vfat.h:405
VOID NTAPI VfatReleaseFromLazyWrite(IN PVOID Context)
Definition: fastio.c:746
#define TAG_IRP
Definition: vfat.h:542
PIO_WORKITEM CloseWorkItem
Definition: vfat.h:421
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define STATUS_OBJECT_NAME_EXISTS
Definition: ntstatus.h:114
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_SET_VOLUME_INFORMATION
FAST_IO_DISPATCH FastIoDispatch
Definition: vfat.h:415
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
WCHAR DeviceName[]
Definition: adapter.cpp:21
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: vfat.h:413
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
INIT_FUNCTION VOID VfatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch)
Definition: fastio.c:758
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
DRIVER_DISPATCH VfatBuildRequest
Definition: vfat.h:1141
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define TAG_CLOSE
Definition: vfat.h:543
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
ULONG NumberProcessors
Definition: vfat.h:408
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
NPAGED_LOOKASIDE_LIST CcbLookasideList
Definition: vfat.h:412
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:113
PDEVICE_OBJECT DeviceObject
Definition: vfat.h:406
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:222
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MJ_FILE_SYSTEM_CONTROL
BOOLEAN NTAPI VfatAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: fastio.c:728
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
#define TAG_CCB
Definition: cdprocs.h:77
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
Status
Definition: gdiplustypes.h:24
PVFAT_GLOBAL_DATA VfatGlobalData
Definition: iface.c:40
CACHE_MANAGER_CALLBACKS CacheMgrCallbacks
Definition: vfat.h:416
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
BOOLEAN ShutdownStarted
Definition: vfat.h:422
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
LIST_ENTRY CloseListHead
Definition: vfat.h:419
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
BOOLEAN CloseWorkerRunning
Definition: vfat.h:420
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_READ
Definition: rdpdr.c:46
ERESOURCE VolumeListLock
Definition: vfat.h:409
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:992
struct _FAST_IO_DISPATCH * FastIoDispatch
Definition: iotypes.h:2177
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
ULONG CloseCount
Definition: vfat.h:418
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
return STATUS_SUCCESS
Definition: btrfs.c:2938
PAGED_LOOKASIDE_LIST CloseContextLookasideList
Definition: vfat.h:414
DRIVER_DISPATCH VfatShutdown
Definition: vfat.h:1204
INIT_FUNCTION NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: iface.c:54
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14