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