[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
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 /* ----------------------------------------------------------- dir.c */
69
70 NTSTATUS NTAPI
71 FatDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
72
73 VOID NTAPI
74 FatCreateRootDcb(IN PFAT_IRP_CONTEXT IrpContext,
75 IN PVCB Vcb);
76
77 PFCB NTAPI
78 FatCreateDcb(IN PFAT_IRP_CONTEXT IrpContext,
79 IN PVCB Vcb,
80 IN PFCB ParentDcb);
81
82 /* -------------------------------------------------------- create.c */
83
84 NTSTATUS NTAPI
85 FatCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
86
87
88 /* --------------------------------------------------------- close.c */
89
90 NTSTATUS NTAPI
91 FatClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
92
93 /* ------------------------------------------------------- cleanup.c */
94
95 NTSTATUS NTAPI
96 FatCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp);
97
98 /* --------------------------------------------------------- fastio.c */
99
100 VOID
101 FatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch);
102
103 BOOLEAN NTAPI
104 FatAcquireForLazyWrite(IN PVOID Context,
105 IN BOOLEAN Wait);
106
107 VOID NTAPI
108 FatReleaseFromLazyWrite(IN PVOID Context);
109
110 BOOLEAN NTAPI
111 FatAcquireForReadAhead(IN PVOID Context,
112 IN BOOLEAN Wait);
113
114 VOID NTAPI
115 FatReleaseFromReadAhead(IN PVOID Context);
116
117 BOOLEAN NTAPI
118 FatNoopAcquire(IN PVOID Context,
119 IN BOOLEAN Wait);
120
121 VOID NTAPI
122 FatNoopRelease(IN PVOID Context);
123
124 /* --------------------------------------------------------- fastfat.c */
125
126 PFAT_IRP_CONTEXT NTAPI
127 FatBuildIrpContext(PIRP Irp, BOOLEAN CanWait);
128
129 VOID NTAPI
130 FatDestroyIrpContext(PFAT_IRP_CONTEXT IrpContext);
131
132 VOID
133 NTAPI
134 FatQueueRequest(IN PFAT_IRP_CONTEXT IrpContext,
135 IN PFAT_OPERATION_HANDLER OperationHandler);
136
137 VOID NTAPI
138 FatCompleteRequest(PFAT_IRP_CONTEXT IrpContext OPTIONAL,
139 PIRP Irp OPTIONAL,
140 NTSTATUS Status);
141
142 BOOLEAN NTAPI
143 FatAcquireExclusiveVcb(IN PFAT_IRP_CONTEXT IrpContext,
144 IN PVCB Vcb);
145
146 BOOLEAN NTAPI
147 FatAcquireSharedVcb(IN PFAT_IRP_CONTEXT IrpContext,
148 IN PVCB Vcb);
149
150 VOID NTAPI
151 FatReleaseVcb(IN PFAT_IRP_CONTEXT IrpContext,
152 IN PVCB Vcb);
153
154 BOOLEAN NTAPI
155 FatAcquireExclusiveFcb(IN PFAT_IRP_CONTEXT IrpContext,
156 IN PFCB Fcb);
157
158 BOOLEAN NTAPI
159 FatAcquireSharedFcb(IN PFAT_IRP_CONTEXT IrpContext,
160 IN PFCB Fcb);
161
162 VOID NTAPI
163 FatReleaseFcb(IN PFAT_IRP_CONTEXT IrpContext,
164 IN PFCB Fcb);
165
166 TYPE_OF_OPEN
167 NTAPI
168 FatDecodeFileObject(IN PFILE_OBJECT FileObject,
169 OUT PVCB *Vcb,
170 OUT PFCB *FcbOrDcb,
171 OUT PCCB *Ccb);
172
173 VOID NTAPI
174 FatSetFileObject(PFILE_OBJECT FileObject,
175 TYPE_OF_OPEN TypeOfOpen,
176 PVOID Fcb,
177 PCCB Ccb);
178
179 PVOID FASTCALL
180 FatMapUserBuffer(PIRP Irp);
181
182 /* --------------------------------------------------------- fullfat.c */
183
184 FF_T_SINT32
185 FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
186
187 FF_T_SINT32
188 FatReadBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
189
190 /* --------------------------------------------------------- lock.c */
191
192 NTSTATUS NTAPI
193 FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
194
195 /* --------------------------------------------------------- fsctl.c */
196
197 NTSTATUS NTAPI
198 FatFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
199
200 /* --------------------------------------------------------- finfo.c */
201
202 NTSTATUS NTAPI FatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
203 NTSTATUS NTAPI FatSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
204
205 /* --------------------------------------------------------- iface.c */
206
207 NTSTATUS
208 NTAPI
209 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
210
211 /* ----------------------------------------------------------- fat.c */
212 PVOID
213 FatPinPage(
214 PFAT_PAGE_CONTEXT Context,
215 LONGLONG ByteOffset);
216
217 PVOID
218 FatPinNextPage(
219 PFAT_PAGE_CONTEXT Context);
220
221 NTSTATUS
222 FatInitializeVcb(
223 IN PFAT_IRP_CONTEXT IrpContext,
224 IN PVCB Vcb,
225 IN PDEVICE_OBJECT TargetDeviceObject,
226 IN PVPB Vpb);
227
228 VOID
229 FatUninitializeVcb(
230 IN PVCB Vcb);
231
232 ULONG
233 FatScanFat(
234 IN PFCB Fcb,
235 IN LONGLONG Vbo, OUT PLONGLONG Lbo,
236 IN OUT PLONGLONG Length,
237 OUT PULONG Index,
238 IN BOOLEAN CanWait);
239
240 /* ------------------------------------------------------ device.c */
241
242 NTSTATUS NTAPI
243 FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
244
245 NTSTATUS
246 FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
247 ULONG ControlCode,
248 PVOID InputBuffer,
249 ULONG InputBufferSize,
250 PVOID OutputBuffer,
251 ULONG OutputBufferSize,
252 BOOLEAN Override);
253
254 /* ------------------------------------------------------ direntry.c */
255 VOID
256 FatFindDirent(IN OUT PFAT_FIND_DIRENT_CONTEXT Context,
257 OUT PDIR_ENTRY* Dirent,
258 OUT PUNICODE_STRING LongFileName OPTIONAL);
259
260 VOID
261 FatEnumerateDirents(IN OUT PFAT_ENUM_DIRENT_CONTEXT Context,
262 IN SIZE_T Offset);
263
264 VOID
265 FatQueryFileTimes(OUT PLARGE_INTEGER FileTimes,
266 IN PDIR_ENTRY Dirent);
267
268 /* ----------------------------------------------------------- fcb.c */
269 PFCB
270 FatLookupFcbByName(
271 IN PFCB ParentFcb,
272 IN PUNICODE_STRING Name);
273
274 BOOLEAN
275 FatLinkFcbNames(
276 IN PFCB ParentFcb,
277 IN PFCB Fcb);
278
279 VOID
280 FatUnlinkFcbNames(
281 IN PFCB ParentFcb,
282 IN PFCB Fcb);
283
284 PFCB NTAPI
285 FatCreateFcb(
286 IN PFAT_IRP_CONTEXT IrpContext,
287 IN PVCB Vcb,
288 IN PFCB ParentDcb,
289 IN FF_FILE *FileHandle);
290
291 PFCB NTAPI
292 FatFindFcb(PFAT_IRP_CONTEXT IrpContext,
293 PRTL_SPLAY_LINKS *RootNode,
294 PSTRING AnsiName,
295 PBOOLEAN IsDosName);
296
297 VOID NTAPI
298 FatInsertName(IN PFAT_IRP_CONTEXT IrpContext,
299 IN PRTL_SPLAY_LINKS *RootNode,
300 IN PFCB_NAME_LINK Name);
301
302 VOID NTAPI
303 FatRemoveNames(IN PFAT_IRP_CONTEXT IrpContext,
304 IN PFCB Fcb);
305
306 PCCB NTAPI
307 FatCreateCcb();
308
309 VOID NTAPI
310 FatSetFullNameInFcb(PFCB Fcb,
311 PUNICODE_STRING Name);
312
313 VOID NTAPI
314 FatSetFullFileNameInFcb(IN PFAT_IRP_CONTEXT IrpContext,
315 IN PFCB Fcb);
316
317 VOID NTAPI
318 FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
319 IN PFCB Fcb);
320
321 VOID NTAPI
322 Fati8dot3ToString(IN PCHAR FileName,
323 IN BOOLEAN DownCase,
324 OUT POEM_STRING OutString);
325
326 /* ------------------------------------------------------------ rw.c */
327
328 NTSTATUS NTAPI
329 FatRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
330
331 NTSTATUS NTAPI
332 FatWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
333
334 /* ------------------------------------------------------------- flush.c */
335
336 NTSTATUS NTAPI
337 FatFlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp);
338
339
340 /* EOF */