[fastfat_new]
[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 NTSYSAPI
39 NTSTATUS
40 NTAPI
41 RtlUpcaseUnicodeStringToCountedOemString(
42 IN OUT POEM_STRING DestinationString,
43 IN PCUNICODE_STRING SourceString,
44 IN BOOLEAN AllocateDestinationString
45 );
46
47
48 /* ------------------------------------------------------ shutdown.c */
49
50 DRIVER_DISPATCH FatShutdown;
51 NTSTATUS NTAPI
52 FatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp);
53
54 /* -------------------------------------------------------- volume.c */
55
56 NTSTATUS NTAPI
57 FatQueryVolumeInfo(PDEVICE_OBJECT DeviceObject, PIRP Irp);
58
59 NTSTATUS NTAPI
60 FatSetVolumeInfo(PDEVICE_OBJECT DeviceObject, PIRP Irp);
61
62 VOID NTAPI
63 FatReadStreamFile(PVCB Vcb,
64 ULONGLONG ByteOffset,
65 ULONG ByteSize,
66 PBCB *Bcb,
67 PVOID *Buffer);
68
69 /* ------------------------------------------------------ blockdev.c */
70 NTSTATUS
71 NTAPI
72 FatPerformLboIo(
73 IN PFAT_IRP_CONTEXT IrpContext,
74 IN PLARGE_INTEGER Offset,
75 IN SIZE_T Length);
76
77 NTSTATUS
78 FatPerformVirtualNonCachedIo(
79 IN PFAT_IRP_CONTEXT IrpContext,
80 IN PFCB Fcb,
81 IN PLARGE_INTEGER Offset,
82 IN SIZE_T Length);
83
84 /* ----------------------------------------------------------- dir.c */
85
86 NTSTATUS NTAPI
87 FatDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
88
89 VOID NTAPI
90 FatCreateRootDcb(IN PFAT_IRP_CONTEXT IrpContext,
91 IN PVCB Vcb);
92
93 PFCB NTAPI
94 FatCreateDcb(IN PFAT_IRP_CONTEXT IrpContext,
95 IN PVCB Vcb,
96 IN PFCB ParentDcb,
97 IN FF_FILE *FileHandle);
98
99 IO_STATUS_BLOCK NTAPI
100 FatiOpenExistingDcb(IN PFAT_IRP_CONTEXT IrpContext,
101 IN PFILE_OBJECT FileObject,
102 IN PVCB Vcb,
103 IN PFCB Dcb,
104 IN PACCESS_MASK DesiredAccess,
105 IN USHORT ShareAccess,
106 IN ULONG CreateDisposition,
107 IN BOOLEAN NoEaKnowledge,
108 IN BOOLEAN DeleteOnClose);
109
110 /* -------------------------------------------------------- create.c */
111
112 NTSTATUS NTAPI
113 FatCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
114
115
116 /* --------------------------------------------------------- close.c */
117
118 NTSTATUS NTAPI
119 FatClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
120
121 /* ------------------------------------------------------- cleanup.c */
122
123 NTSTATUS NTAPI
124 FatCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp);
125
126 /* --------------------------------------------------------- fastio.c */
127
128 VOID
129 FatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch);
130
131 BOOLEAN NTAPI
132 FatAcquireForLazyWrite(IN PVOID Context,
133 IN BOOLEAN Wait);
134
135 VOID NTAPI
136 FatReleaseFromLazyWrite(IN PVOID Context);
137
138 BOOLEAN NTAPI
139 FatAcquireForReadAhead(IN PVOID Context,
140 IN BOOLEAN Wait);
141
142 VOID NTAPI
143 FatReleaseFromReadAhead(IN PVOID Context);
144
145 BOOLEAN NTAPI
146 FatNoopAcquire(IN PVOID Context,
147 IN BOOLEAN Wait);
148
149 VOID NTAPI
150 FatNoopRelease(IN PVOID Context);
151
152 /* --------------------------------------------------------- fastfat.c */
153
154 PFAT_IRP_CONTEXT NTAPI
155 FatBuildIrpContext(PIRP Irp, BOOLEAN CanWait);
156
157 VOID NTAPI
158 FatDestroyIrpContext(PFAT_IRP_CONTEXT IrpContext);
159
160 VOID
161 NTAPI
162 FatQueueRequest(IN PFAT_IRP_CONTEXT IrpContext,
163 IN PFAT_OPERATION_HANDLER OperationHandler);
164
165 VOID NTAPI
166 FatCompleteRequest(PFAT_IRP_CONTEXT IrpContext OPTIONAL,
167 PIRP Irp OPTIONAL,
168 NTSTATUS Status);
169
170 BOOLEAN NTAPI
171 FatAcquireExclusiveVcb(IN PFAT_IRP_CONTEXT IrpContext,
172 IN PVCB Vcb);
173
174 BOOLEAN NTAPI
175 FatAcquireSharedVcb(IN PFAT_IRP_CONTEXT IrpContext,
176 IN PVCB Vcb);
177
178 VOID NTAPI
179 FatReleaseVcb(IN PFAT_IRP_CONTEXT IrpContext,
180 IN PVCB Vcb);
181
182 BOOLEAN NTAPI
183 FatAcquireExclusiveFcb(IN PFAT_IRP_CONTEXT IrpContext,
184 IN PFCB Fcb);
185
186 BOOLEAN NTAPI
187 FatAcquireSharedFcb(IN PFAT_IRP_CONTEXT IrpContext,
188 IN PFCB Fcb);
189
190 VOID NTAPI
191 FatReleaseFcb(IN PFAT_IRP_CONTEXT IrpContext,
192 IN PFCB Fcb);
193
194 TYPE_OF_OPEN
195 NTAPI
196 FatDecodeFileObject(IN PFILE_OBJECT FileObject,
197 OUT PVCB *Vcb,
198 OUT PFCB *FcbOrDcb,
199 OUT PCCB *Ccb);
200
201 VOID NTAPI
202 FatSetFileObject(PFILE_OBJECT FileObject,
203 TYPE_OF_OPEN TypeOfOpen,
204 PVOID Fcb,
205 PCCB Ccb);
206
207 PVOID FASTCALL
208 FatMapUserBuffer(PIRP Irp);
209
210 /* --------------------------------------------------------- fullfat.c */
211
212 FF_T_SINT32
213 FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
214
215 FF_T_SINT32
216 FatReadBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
217
218 /* --------------------------------------------------------- lock.c */
219
220 NTSTATUS NTAPI
221 FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
222
223 VOID NTAPI
224 FatOplockComplete(IN PVOID Context,
225 IN PIRP Irp);
226
227 VOID NTAPI
228 FatPrePostIrp(IN PVOID Context,
229 IN PIRP Irp);
230
231 /* --------------------------------------------------------- fsctl.c */
232
233 NTSTATUS NTAPI
234 FatFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
235
236 /* --------------------------------------------------------- finfo.c */
237
238 NTSTATUS NTAPI FatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
239 NTSTATUS NTAPI FatSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
240
241 /* --------------------------------------------------------- fullfat.c */
242
243 FF_FILE *FF_OpenW(FF_IOMAN *pIoman, PUNICODE_STRING pathW, FF_T_UINT8 Mode, FF_ERROR *pError);
244
245 /* --------------------------------------------------------- iface.c */
246
247 NTSTATUS
248 NTAPI
249 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
250
251 /* ----------------------------------------------------------- fat.c */
252 PVOID
253 FatPinPage(
254 PFAT_PAGE_CONTEXT Context,
255 LONGLONG ByteOffset);
256
257 PVOID
258 FatPinNextPage(
259 PFAT_PAGE_CONTEXT Context);
260
261 NTSTATUS
262 FatInitializeVcb(
263 IN PFAT_IRP_CONTEXT IrpContext,
264 IN PVCB Vcb,
265 IN PDEVICE_OBJECT TargetDeviceObject,
266 IN PVPB Vpb);
267
268 VOID
269 FatUninitializeVcb(
270 IN PVCB Vcb);
271
272 ULONG
273 FatScanFat(
274 IN PFCB Fcb,
275 IN LONGLONG Vbo, OUT PLONGLONG Lbo,
276 IN OUT PLONGLONG Length,
277 OUT PULONG Index,
278 IN BOOLEAN CanWait);
279
280 /* ------------------------------------------------------ device.c */
281
282 NTSTATUS NTAPI
283 FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
284
285 NTSTATUS
286 FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
287 ULONG ControlCode,
288 PVOID InputBuffer,
289 ULONG InputBufferSize,
290 PVOID OutputBuffer,
291 ULONG OutputBufferSize,
292 BOOLEAN Override);
293
294 /* ------------------------------------------------------ direntry.c */
295 VOID
296 FatFindDirent(IN OUT PFAT_FIND_DIRENT_CONTEXT Context,
297 OUT PDIR_ENTRY* Dirent,
298 OUT PUNICODE_STRING LongFileName OPTIONAL);
299
300 VOID
301 FatEnumerateDirents(IN OUT PFAT_ENUM_DIRENT_CONTEXT Context,
302 IN SIZE_T Offset);
303
304 VOID
305 FatQueryFileTimes(OUT PLARGE_INTEGER FileTimes,
306 IN PDIR_ENTRY Dirent);
307
308 /* ----------------------------------------------------------- fcb.c */
309 PFCB
310 FatLookupFcbByName(
311 IN PFCB ParentFcb,
312 IN PUNICODE_STRING Name);
313
314 BOOLEAN
315 FatLinkFcbNames(
316 IN PFCB ParentFcb,
317 IN PFCB Fcb);
318
319 VOID
320 FatUnlinkFcbNames(
321 IN PFCB ParentFcb,
322 IN PFCB Fcb);
323
324 PFCB NTAPI
325 FatCreateFcb(
326 IN PFAT_IRP_CONTEXT IrpContext,
327 IN PVCB Vcb,
328 IN PFCB ParentDcb,
329 IN FF_FILE *FileHandle);
330
331 IO_STATUS_BLOCK NTAPI
332 FatiOpenExistingFcb(IN PFAT_IRP_CONTEXT IrpContext,
333 IN PFILE_OBJECT FileObject,
334 IN PVCB Vcb,
335 IN PFCB Fcb,
336 IN PACCESS_MASK DesiredAccess,
337 IN USHORT ShareAccess,
338 IN ULONG AllocationSize,
339 IN PFILE_FULL_EA_INFORMATION EaBuffer,
340 IN ULONG EaLength,
341 IN UCHAR FileAttributes,
342 IN ULONG CreateDisposition,
343 IN BOOLEAN NoEaKnowledge,
344 IN BOOLEAN DeleteOnClose,
345 IN BOOLEAN OpenedAsDos,
346 OUT PBOOLEAN OplockPostIrp);
347
348 PFCB NTAPI
349 FatFindFcb(PFAT_IRP_CONTEXT IrpContext,
350 PRTL_SPLAY_LINKS *RootNode,
351 PSTRING AnsiName,
352 PBOOLEAN IsDosName);
353
354 VOID NTAPI
355 FatInsertName(IN PFAT_IRP_CONTEXT IrpContext,
356 IN PRTL_SPLAY_LINKS *RootNode,
357 IN PFCB_NAME_LINK Name);
358
359 VOID NTAPI
360 FatRemoveNames(IN PFAT_IRP_CONTEXT IrpContext,
361 IN PFCB Fcb);
362
363 PCCB NTAPI
364 FatCreateCcb();
365
366 VOID NTAPI
367 FatSetFullNameInFcb(PFCB Fcb,
368 PUNICODE_STRING Name);
369
370 VOID NTAPI
371 FatSetFullFileNameInFcb(IN PFAT_IRP_CONTEXT IrpContext,
372 IN PFCB Fcb);
373
374 VOID NTAPI
375 FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
376 IN PFCB Fcb);
377
378 VOID NTAPI
379 Fati8dot3ToString(IN PCHAR FileName,
380 IN BOOLEAN DownCase,
381 OUT POEM_STRING OutString);
382
383 /* ------------------------------------------------------------ rw.c */
384
385 NTSTATUS NTAPI
386 FatRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
387
388 NTSTATUS NTAPI
389 FatWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
390
391 /* ------------------------------------------------------------- flush.c */
392
393 NTSTATUS NTAPI
394 FatFlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp);
395
396
397 /* EOF */