ReactOS 0.4.15-dev-5666-gc548b97
iface.c
Go to the documentation of this file.
1/*
2 * PROJECT: VFAT Filesystem
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Driver entry interface
5 * COPYRIGHT: Copyright 1998 Jason Filby <jasonfilby@yahoo.com>
6 * Copyright 2010-2018 Pierre Schweitzer <pierre@reactos.org>
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include "vfat.h"
12
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS *****************************************************************/
17
19
20/* FUNCTIONS ****************************************************************/
21
22/*
23 * FUNCTION: Called by the system to initialize the driver
24 * ARGUMENTS:
25 * DriverObject = object describing this driver
26 * RegistryPath = path to our configuration entries
27 * RETURNS: Success or failure
28 */
29CODE_SEG("INIT")
35{
39
41
43 sizeof(VFAT_GLOBAL_DATA),
46 0,
47 FALSE,
49 if (!NT_SUCCESS(Status))
50 {
51 return Status;
52 }
53
54 VfatGlobalData = DeviceObject->DeviceExtension;
59 /* Enable this to enter the debugger when file system corruption
60 * has been detected:
61 VfatGlobalData->Flags = VFAT_BREAK_ON_CORRUPTION; */
62
63 /* Delayed close support */
71 {
74 }
75
76 DeviceObject->Flags |= DO_DIRECT_IO;
93
94 DriverObject->DriverUnload = NULL;
95
96 /* Cache manager */
101
102 /* Fast I/O */
104 DriverObject->FastIoDispatch = &VfatGlobalData->FastIoDispatch;
105
106 /* Private lists */
108 NULL, NULL, 0, sizeof(VFATFCB), TAG_FCB, 0);
110 NULL, NULL, 0, sizeof(VFATCCB), TAG_CCB, 0);
112 NULL, NULL, 0, sizeof(VFAT_IRP_CONTEXT), TAG_IRP, 0);
114 NULL, NULL, 0, sizeof(VFAT_CLOSE_CONTEXT), TAG_CLOSE, 0);
115
119
120#ifdef KDBG
121 {
122 BOOLEAN Registered;
123
124 Registered = KdRosRegisterCliCallback(vfatKdbgHandler);
125 DPRINT1("VFATFS KDBG extension registered: %s\n", (Registered ? "yes" : "no"));
126 }
127#endif
128
129 return STATUS_SUCCESS;
130}
131
132/* EOF */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TAG_CCB
Definition: cdprocs.h:85
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define TAG_FCB
Definition: nodetype.h:152
VOID VfatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch)
Definition: fastio.c:753
BOOLEAN NTAPI VfatAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: fastio.c:723
VOID NTAPI VfatReleaseFromLazyWrite(IN PVOID Context)
Definition: fastio.c:741
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PVFAT_GLOBAL_DATA VfatGlobalData
Definition: iface.c:18
Status
Definition: gdiplustypes.h:25
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
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:270
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:218
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
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
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:987
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define STATUS_SUCCESS
Definition: shellext.h:65
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: vfat.h:419
NPAGED_LOOKASIDE_LIST CcbLookasideList
Definition: vfat.h:418
PDRIVER_OBJECT DriverObject
Definition: vfat.h:411
BOOLEAN CloseWorkerRunning
Definition: vfat.h:426
ERESOURCE VolumeListLock
Definition: vfat.h:415
ULONG NumberProcessors
Definition: vfat.h:414
NPAGED_LOOKASIDE_LIST FcbLookasideList
Definition: vfat.h:417
FAST_IO_DISPATCH FastIoDispatch
Definition: vfat.h:421
PIO_WORKITEM CloseWorkItem
Definition: vfat.h:427
PAGED_LOOKASIDE_LIST CloseContextLookasideList
Definition: vfat.h:420
CACHE_MANAGER_CALLBACKS CacheMgrCallbacks
Definition: vfat.h:422
FAST_MUTEX CloseMutex
Definition: vfat.h:423
LIST_ENTRY CloseListHead
Definition: vfat.h:425
ULONG CloseCount
Definition: vfat.h:424
LIST_ENTRY VolumeListHead
Definition: vfat.h:416
PDEVICE_OBJECT DeviceObject
Definition: vfat.h:412
BOOLEAN ShutdownStarted
Definition: vfat.h:428
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
Definition: vfat.h:537
Definition: vfat.h:448
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_IRP
Definition: vfat.h:548
#define TAG_CLOSE
Definition: vfat.h:549
DRIVER_DISPATCH VfatBuildRequest
Definition: vfat.h:1147
DRIVER_DISPATCH VfatShutdown
Definition: vfat.h:1210
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SET_VOLUME_INFORMATION
#define IRP_MJ_FLUSH_BUFFERS
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP