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