7833e4dcb0735ee90e80f1111777c59b8d2d81fb
[reactos.git] / reactos / drivers / filesystems / fastfat_new / fastfat.h
1 #include <ntifs.h>
2 #include <ntdddisk.h>
3 #include <debug.h>
4 #include <pseh/pseh2.h>
5
6 #include "fullfat.h"
7
8 #include <fat.h>
9 #include <fatstruc.h>
10
11 #define Add2Ptr(P,I,T) ((T)((PUCHAR)(P) + (I)))
12 #define PtrOffset(B,O) ((ULONG)((ULONG_PTR)(O) - (ULONG_PTR)(B)))
13
14 #define TAG_CCB 'BCCV'
15 #define TAG_FCB 'BCFV'
16 #define TAG_IRP 'PRIV'
17 #define TAG_VFAT 'TAFV'
18
19
20 /* Global resource acquire/release */
21 #define FatAcquireExclusiveGlobal(IrpContext) \
22 ( \
23 ExAcquireResourceExclusiveLite(&FatGlobalData.Resource, \
24 (IrpContext)->Flags & IRPCONTEXT_CANWAIT) \
25 )
26
27 #define FatAcquireSharedGlobal(IrpContext) \
28 ( \
29 ExAcquireResourceSharedLite(&FatGlobalData.Resource, \
30 (IrpContext)->Flags & IRPCONTEXT_CANWAIT) \
31 )
32
33 #define FatReleaseGlobal(IrpContext) \
34 { \
35 ExReleaseResourceLite(&(FatGlobalData.Resource)); \
36 }
37
38
39 /* ------------------------------------------------------ shutdown.c */
40
41 DRIVER_DISPATCH FatShutdown;
42 NTSTATUS NTAPI
43 FatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp);
44
45 /* -------------------------------------------------------- volume.c */
46
47 NTSTATUS NTAPI
48 FatQueryVolumeInfo(PDEVICE_OBJECT DeviceObject, PIRP Irp);
49
50 NTSTATUS NTAPI
51 FatSetVolumeInfo(PDEVICE_OBJECT DeviceObject, PIRP Irp);
52
53 /* ------------------------------------------------------ blockdev.c */
54 NTSTATUS
55 NTAPI
56 FatPerformLboIo(
57 IN PFAT_IRP_CONTEXT IrpContext,
58 IN PLARGE_INTEGER Offset,
59 IN SIZE_T Length);
60
61 NTSTATUS
62 FatPerformVirtualNonCachedIo(
63 IN PFAT_IRP_CONTEXT IrpContext,
64 IN PFCB Fcb,
65 IN PLARGE_INTEGER Offset,
66 IN SIZE_T Length);
67
68 PVOID
69 FatMapUserBuffer(
70 IN OUT PIRP Irp);
71
72 /* ----------------------------------------------------------- dir.c */
73
74 NTSTATUS NTAPI
75 FatDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
76
77 VOID NTAPI
78 FatCreateRootDcb(IN PFAT_IRP_CONTEXT IrpContext,
79 IN PVCB Vcb);
80
81 /* -------------------------------------------------------- create.c */
82
83 NTSTATUS NTAPI
84 FatCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
85
86
87 /* --------------------------------------------------------- close.c */
88
89 NTSTATUS NTAPI
90 FatClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
91
92 /* ------------------------------------------------------- cleanup.c */
93
94 NTSTATUS NTAPI
95 FatCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp);
96
97 /* --------------------------------------------------------- fastio.c */
98
99 VOID
100 FatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch);
101
102 BOOLEAN NTAPI
103 FatAcquireForLazyWrite(IN PVOID Context,
104 IN BOOLEAN Wait);
105
106 VOID NTAPI
107 FatReleaseFromLazyWrite(IN PVOID Context);
108
109 BOOLEAN NTAPI
110 FatAcquireForReadAhead(IN PVOID Context,
111 IN BOOLEAN Wait);
112
113 VOID NTAPI
114 FatReleaseFromReadAhead(IN PVOID Context);
115
116 BOOLEAN NTAPI
117 FatNoopAcquire(IN PVOID Context,
118 IN BOOLEAN Wait);
119
120 VOID NTAPI
121 FatNoopRelease(IN PVOID Context);
122
123 /* --------------------------------------------------------- fastfat.c */
124
125 PFAT_IRP_CONTEXT NTAPI
126 FatBuildIrpContext(PIRP Irp, BOOLEAN CanWait);
127
128 VOID NTAPI
129 FatDestroyIrpContext(PFAT_IRP_CONTEXT IrpContext);
130
131 VOID
132 NTAPI
133 FatQueueRequest(IN PFAT_IRP_CONTEXT IrpContext,
134 IN PFAT_OPERATION_HANDLER OperationHandler);
135
136 VOID NTAPI
137 FatCompleteRequest(PFAT_IRP_CONTEXT IrpContext OPTIONAL,
138 PIRP Irp OPTIONAL,
139 NTSTATUS Status);
140
141 BOOLEAN NTAPI
142 FatAcquireExclusiveVcb(IN PFAT_IRP_CONTEXT IrpContext,
143 IN PVCB Vcb);
144
145 VOID NTAPI
146 FatReleaseVcb(IN PFAT_IRP_CONTEXT IrpContext,
147 IN PVCB Vcb);
148
149 TYPE_OF_OPEN
150 NTAPI
151 FatDecodeFileObject(IN PFILE_OBJECT FileObject,
152 OUT PVCB *Vcb,
153 OUT PFCB *FcbOrDcb,
154 OUT PCCB *Ccb);
155
156 /* --------------------------------------------------------- fullfat.c */
157
158 FF_T_SINT32
159 FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
160
161 FF_T_SINT32
162 FatReadBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
163
164 /* --------------------------------------------------------- lock.c */
165
166 NTSTATUS NTAPI
167 FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
168
169 /* --------------------------------------------------------- fsctl.c */
170
171 NTSTATUS NTAPI
172 FatFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
173
174 /* --------------------------------------------------------- finfo.c */
175
176 NTSTATUS NTAPI FatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
177 NTSTATUS NTAPI FatSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
178
179 /* --------------------------------------------------------- iface.c */
180
181 NTSTATUS
182 NTAPI
183 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
184
185 /* ----------------------------------------------------------- fat.c */
186 PVOID
187 FatPinPage(
188 PFAT_PAGE_CONTEXT Context,
189 LONGLONG ByteOffset);
190
191 PVOID
192 FatPinNextPage(
193 PFAT_PAGE_CONTEXT Context);
194
195 NTSTATUS
196 FatInitializeVcb(
197 IN PFAT_IRP_CONTEXT IrpContext,
198 IN PVCB Vcb,
199 IN PDEVICE_OBJECT TargetDeviceObject,
200 IN PVPB Vpb);
201
202 VOID
203 FatUninitializeVcb(
204 IN PVCB Vcb);
205
206 ULONG
207 FatScanFat(
208 IN PFCB Fcb,
209 IN LONGLONG Vbo, OUT PLONGLONG Lbo,
210 IN OUT PLONGLONG Length,
211 OUT PULONG Index,
212 IN BOOLEAN CanWait);
213
214 /* ------------------------------------------------------ device.c */
215
216 NTSTATUS NTAPI
217 FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
218
219 NTSTATUS
220 FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
221 ULONG ControlCode,
222 PVOID InputBuffer,
223 ULONG InputBufferSize,
224 PVOID OutputBuffer,
225 ULONG OutputBufferSize,
226 BOOLEAN Override);
227
228 /* ------------------------------------------------------ direntry.c */
229 VOID
230 FatFindDirent(IN OUT PFAT_FIND_DIRENT_CONTEXT Context,
231 OUT PDIR_ENTRY* Dirent,
232 OUT PUNICODE_STRING LongFileName OPTIONAL);
233
234 VOID
235 FatEnumerateDirents(IN OUT PFAT_ENUM_DIRENT_CONTEXT Context,
236 IN SIZE_T Offset);
237
238 VOID
239 FatQueryFileTimes(OUT PLARGE_INTEGER FileTimes,
240 IN PDIR_ENTRY Dirent);
241
242 /* ----------------------------------------------------------- fcb.c */
243 PFCB
244 FatLookupFcbByName(
245 IN PFCB ParentFcb,
246 IN PUNICODE_STRING Name);
247
248 BOOLEAN
249 FatLinkFcbNames(
250 IN PFCB ParentFcb,
251 IN PFCB Fcb);
252
253 VOID
254 FatUnlinkFcbNames(
255 IN PFCB ParentFcb,
256 IN PFCB Fcb);
257
258 NTSTATUS
259 FatCreateFcb(
260 OUT PFCB* CreatedFcb,
261 IN PFAT_IRP_CONTEXT IrpContext,
262 IN PFCB ParentFcb,
263 IN PDIR_ENTRY Dirent,
264 IN PUNICODE_STRING FileName,
265 IN PUNICODE_STRING LongFileName OPTIONAL);
266
267 NTSTATUS
268 FatOpenFcb(
269 OUT PFCB* Fcb,
270 IN PFAT_IRP_CONTEXT IrpContext,
271 IN PFCB ParentFcb,
272 IN PUNICODE_STRING FileName);
273
274 /* ------------------------------------------------------------ rw.c */
275
276 NTSTATUS NTAPI
277 FatRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
278
279 NTSTATUS NTAPI
280 FatWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
281
282 /* ------------------------------------------------------------- flush.c */
283
284 NTSTATUS NTAPI
285 FatFlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp);
286
287
288 /* EOF */