[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 VOID NTAPI
147 FatReleaseVcb(IN PFAT_IRP_CONTEXT IrpContext,
148 IN PVCB Vcb);
149
150 BOOLEAN NTAPI
151 FatAcquireExclusiveFcb(IN PFAT_IRP_CONTEXT IrpContext,
152 IN PFCB Fcb);
153
154 BOOLEAN NTAPI
155 FatAcquireSharedFcb(IN PFAT_IRP_CONTEXT IrpContext,
156 IN PFCB Fcb);
157
158 VOID NTAPI
159 FatReleaseFcb(IN PFAT_IRP_CONTEXT IrpContext,
160 IN PFCB Fcb);
161
162 TYPE_OF_OPEN
163 NTAPI
164 FatDecodeFileObject(IN PFILE_OBJECT FileObject,
165 OUT PVCB *Vcb,
166 OUT PFCB *FcbOrDcb,
167 OUT PCCB *Ccb);
168
169 VOID NTAPI
170 FatSetFileObject(PFILE_OBJECT FileObject,
171 TYPE_OF_OPEN TypeOfOpen,
172 PVOID Fcb,
173 PCCB Ccb);
174
175 PVOID FASTCALL
176 FatMapUserBuffer(PIRP Irp);
177
178 /* --------------------------------------------------------- fullfat.c */
179
180 FF_T_SINT32
181 FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
182
183 FF_T_SINT32
184 FatReadBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam);
185
186 /* --------------------------------------------------------- lock.c */
187
188 NTSTATUS NTAPI
189 FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
190
191 /* --------------------------------------------------------- fsctl.c */
192
193 NTSTATUS NTAPI
194 FatFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
195
196 /* --------------------------------------------------------- finfo.c */
197
198 NTSTATUS NTAPI FatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
199 NTSTATUS NTAPI FatSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
200
201 /* --------------------------------------------------------- iface.c */
202
203 NTSTATUS
204 NTAPI
205 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
206
207 /* ----------------------------------------------------------- fat.c */
208 PVOID
209 FatPinPage(
210 PFAT_PAGE_CONTEXT Context,
211 LONGLONG ByteOffset);
212
213 PVOID
214 FatPinNextPage(
215 PFAT_PAGE_CONTEXT Context);
216
217 NTSTATUS
218 FatInitializeVcb(
219 IN PFAT_IRP_CONTEXT IrpContext,
220 IN PVCB Vcb,
221 IN PDEVICE_OBJECT TargetDeviceObject,
222 IN PVPB Vpb);
223
224 VOID
225 FatUninitializeVcb(
226 IN PVCB Vcb);
227
228 ULONG
229 FatScanFat(
230 IN PFCB Fcb,
231 IN LONGLONG Vbo, OUT PLONGLONG Lbo,
232 IN OUT PLONGLONG Length,
233 OUT PULONG Index,
234 IN BOOLEAN CanWait);
235
236 /* ------------------------------------------------------ device.c */
237
238 NTSTATUS NTAPI
239 FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
240
241 NTSTATUS
242 FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
243 ULONG ControlCode,
244 PVOID InputBuffer,
245 ULONG InputBufferSize,
246 PVOID OutputBuffer,
247 ULONG OutputBufferSize,
248 BOOLEAN Override);
249
250 /* ------------------------------------------------------ direntry.c */
251 VOID
252 FatFindDirent(IN OUT PFAT_FIND_DIRENT_CONTEXT Context,
253 OUT PDIR_ENTRY* Dirent,
254 OUT PUNICODE_STRING LongFileName OPTIONAL);
255
256 VOID
257 FatEnumerateDirents(IN OUT PFAT_ENUM_DIRENT_CONTEXT Context,
258 IN SIZE_T Offset);
259
260 VOID
261 FatQueryFileTimes(OUT PLARGE_INTEGER FileTimes,
262 IN PDIR_ENTRY Dirent);
263
264 /* ----------------------------------------------------------- fcb.c */
265 PFCB
266 FatLookupFcbByName(
267 IN PFCB ParentFcb,
268 IN PUNICODE_STRING Name);
269
270 BOOLEAN
271 FatLinkFcbNames(
272 IN PFCB ParentFcb,
273 IN PFCB Fcb);
274
275 VOID
276 FatUnlinkFcbNames(
277 IN PFCB ParentFcb,
278 IN PFCB Fcb);
279
280 PFCB NTAPI
281 FatCreateFcb(
282 IN PFAT_IRP_CONTEXT IrpContext,
283 IN PVCB Vcb,
284 IN PFCB ParentDcb,
285 IN FF_FILE *FileHandle);
286
287 NTSTATUS
288 FatOpenFcb(
289 OUT PFCB* Fcb,
290 IN PFAT_IRP_CONTEXT IrpContext,
291 IN PFCB ParentFcb,
292 IN PUNICODE_STRING FileName);
293
294 PFCB NTAPI
295 FatFindFcb(PFAT_IRP_CONTEXT IrpContext,
296 PRTL_SPLAY_LINKS *RootNode,
297 PSTRING AnsiName,
298 PBOOLEAN IsDosName);
299
300 PCCB NTAPI
301 FatCreateCcb();
302
303 VOID NTAPI
304 FatSetFullNameInFcb(PFCB Fcb,
305 PUNICODE_STRING Name);
306
307 VOID NTAPI
308 FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
309 IN PFCB Fcb);
310
311 VOID NTAPI
312 Fati8dot3ToString(IN PCHAR FileName,
313 IN BOOLEAN DownCase,
314 OUT POEM_STRING OutString);
315
316 /* ------------------------------------------------------------ rw.c */
317
318 NTSTATUS NTAPI
319 FatRead(PDEVICE_OBJECT DeviceObject, PIRP Irp);
320
321 NTSTATUS NTAPI
322 FatWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp);
323
324 /* ------------------------------------------------------------- flush.c */
325
326 NTSTATUS NTAPI
327 FatFlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp);
328
329
330 /* EOF */