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