15a91f2b338e448ff9c01816618f760983336e88
[reactos.git] / reactos / drivers / filesystems / fastfat / vfat.h
1 #ifndef _FASTFAT_PCH_
2 #define _FASTFAT_PCH_
3
4 #include <ntifs.h>
5 #include <ntdddisk.h>
6 #include <dos.h>
7 #include <pseh/pseh2.h>
8
9 #define USE_ROS_CC_AND_FS
10
11 #define ROUND_DOWN(n, align) \
12 (((ULONG)n) & ~((align) - 1l))
13
14 #define ROUND_UP(n, align) \
15 ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
16
17 #include <pshpack1.h>
18 struct _BootSector
19 {
20 unsigned char magic0, res0, magic1;
21 unsigned char OEMName[8];
22 unsigned short BytesPerSector;
23 unsigned char SectorsPerCluster;
24 unsigned short ReservedSectors;
25 unsigned char FATCount;
26 unsigned short RootEntries, Sectors;
27 unsigned char Media;
28 unsigned short FATSectors, SectorsPerTrack, Heads;
29 unsigned long HiddenSectors, SectorsHuge;
30 unsigned char Drive, Res1, Sig;
31 unsigned long VolumeID;
32 unsigned char VolumeLabel[11], SysType[8];
33 unsigned char Res2[448];
34 unsigned short Signatur1;
35 };
36
37 struct _BootSector32
38 {
39 unsigned char magic0, res0, magic1; // 0
40 unsigned char OEMName[8]; // 3
41 unsigned short BytesPerSector; // 11
42 unsigned char SectorsPerCluster; // 13
43 unsigned short ReservedSectors; // 14
44 unsigned char FATCount; // 16
45 unsigned short RootEntries, Sectors; // 17
46 unsigned char Media; // 21
47 unsigned short FATSectors, SectorsPerTrack, Heads; // 22
48 unsigned long HiddenSectors, SectorsHuge; // 28
49 unsigned long FATSectors32; // 36
50 unsigned short ExtFlag; // 40
51 unsigned short FSVersion; // 42
52 unsigned long RootCluster; // 44
53 unsigned short FSInfoSector; // 48
54 unsigned short BootBackup; // 50
55 unsigned char Res3[12]; // 52
56 unsigned char Drive; // 64
57 unsigned char Res4; // 65
58 unsigned char ExtBootSignature; // 66
59 unsigned long VolumeID; // 67
60 unsigned char VolumeLabel[11], SysType[8]; // 71
61 unsigned char Res2[420]; // 90
62 unsigned short Signature1; // 510
63 };
64
65 struct _BootSectorFatX
66 {
67 unsigned char SysType[4]; // 0
68 unsigned long VolumeID; // 4
69 unsigned long SectorsPerCluster; // 8
70 unsigned short FATCount; // 12
71 unsigned long Unknown; // 14
72 unsigned char Unused[4078]; // 18
73 };
74
75 struct _FsInfoSector
76 {
77 unsigned long ExtBootSignature2; // 0
78 unsigned char Res6[480]; // 4
79 unsigned long FSINFOSignature; // 484
80 unsigned long FreeCluster; // 488
81 unsigned long NextCluster; // 492
82 unsigned char Res7[12]; // 496
83 unsigned long Signatur2; // 508
84 };
85
86 typedef struct _BootSector BootSector;
87
88 struct _FATDirEntry
89 {
90 union
91 {
92 struct { unsigned char Filename[8], Ext[3]; };
93 unsigned char ShortName[11];
94 };
95 unsigned char Attrib;
96 unsigned char lCase;
97 unsigned char CreationTimeMs;
98 unsigned short CreationTime,CreationDate,AccessDate;
99 union
100 {
101 unsigned short FirstClusterHigh; // FAT32
102 unsigned short ExtendedAttributes; // FAT12/FAT16
103 };
104 unsigned short UpdateTime; //time create/update
105 unsigned short UpdateDate; //date create/update
106 unsigned short FirstCluster;
107 unsigned long FileSize;
108 };
109
110 #define FAT_EAFILE "EA DATA. SF"
111
112 typedef struct _EAFileHeader FAT_EA_FILE_HEADER, *PFAT_EA_FILE_HEADER;
113
114 struct _EAFileHeader
115 {
116 unsigned short Signature; // ED
117 unsigned short Unknown[15];
118 unsigned short EASetTable[240];
119 };
120
121 typedef struct _EASetHeader FAT_EA_SET_HEADER, *PFAT_EA_SET_HEADER;
122
123 struct _EASetHeader
124 {
125 unsigned short Signature; // EA
126 unsigned short Offset; // relative offset, same value as in the EASetTable
127 unsigned short Unknown1[2];
128 char TargetFileName[12];
129 unsigned short Unknown2[3];
130 unsigned int EALength;
131 // EA Header
132 };
133
134 typedef struct _EAHeader FAT_EA_HEADER, *PFAT_EA_HEADER;
135
136 struct _EAHeader
137 {
138 unsigned char Unknown;
139 unsigned char EANameLength;
140 unsigned short EAValueLength;
141 // Name Data
142 // Value Data
143 };
144
145 typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
146
147 struct _FATXDirEntry
148 {
149 unsigned char FilenameLength; // 0
150 unsigned char Attrib; // 1
151 unsigned char Filename[42]; // 2
152 unsigned long FirstCluster; // 44
153 unsigned long FileSize; // 48
154 unsigned short UpdateTime; // 52
155 unsigned short UpdateDate; // 54
156 unsigned short CreationTime; // 56
157 unsigned short CreationDate; // 58
158 unsigned short AccessTime; // 60
159 unsigned short AccessDate; // 62
160 };
161
162 struct _slot
163 {
164 unsigned char id; // sequence number for slot
165 WCHAR name0_4[5]; // first 5 characters in name
166 unsigned char attr; // attribute byte
167 unsigned char reserved; // always 0
168 unsigned char alias_checksum; // checksum for 8.3 alias
169 WCHAR name5_10[6]; // 6 more characters in name
170 unsigned char start[2]; // starting cluster number
171 WCHAR name11_12[2]; // last 2 characters in name
172 };
173
174 typedef struct _slot slot;
175
176 #include <poppack.h>
177
178 #define VFAT_CASE_LOWER_BASE 8 // base is lower case
179 #define VFAT_CASE_LOWER_EXT 16 // extension is lower case
180
181 #define LONGNAME_MAX_LENGTH 256 // max length for a long filename
182
183 #define ENTRY_DELETED(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
184 #define ENTRY_VOLUME(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
185 #define ENTRY_END(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
186
187 #define FAT_ENTRY_DELETED(DirEntry) ((DirEntry)->Filename[0] == 0xe5)
188 #define FAT_ENTRY_END(DirEntry) ((DirEntry)->Filename[0] == 0)
189 #define FAT_ENTRY_LONG(DirEntry) (((DirEntry)->Attrib & 0x3f) == 0x0f)
190 #define FAT_ENTRY_VOLUME(DirEntry) (((DirEntry)->Attrib & 0x1f) == 0x08)
191
192 #define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
193 #define FATX_ENTRY_END(DirEntry) ((DirEntry)->FilenameLength == 0xff)
194 #define FATX_ENTRY_LONG(DirEntry) (FALSE)
195 #define FATX_ENTRY_VOLUME(DirEntry) (((DirEntry)->Attrib & 0x1f) == 0x08)
196
197 #define FAT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
198 #define FATX_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
199
200 typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
201
202 union _DIR_ENTRY
203 {
204 FAT_DIR_ENTRY Fat;
205 FATX_DIR_ENTRY FatX;
206 };
207
208 typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
209
210 #define BLOCKSIZE 512
211
212 #define FAT16 (1)
213 #define FAT12 (2)
214 #define FAT32 (3)
215 #define FATX16 (4)
216 #define FATX32 (5)
217
218 #define VCB_VOLUME_LOCKED 0x0001
219 #define VCB_DISMOUNT_PENDING 0x0002
220 #define VCB_IS_FATX 0x0004
221 #define VCB_IS_DIRTY 0x4000 /* Volume is dirty */
222 #define VCB_CLEAR_DIRTY 0x8000 /* Clean dirty flag at shutdown */
223
224 typedef struct
225 {
226 ULONG VolumeID;
227 ULONG FATStart;
228 ULONG FATCount;
229 ULONG FATSectors;
230 ULONG rootDirectorySectors;
231 ULONG rootStart;
232 ULONG dataStart;
233 ULONG RootCluster;
234 ULONG SectorsPerCluster;
235 ULONG BytesPerSector;
236 ULONG BytesPerCluster;
237 ULONG NumberOfClusters;
238 ULONG FatType;
239 ULONG Sectors;
240 BOOLEAN FixedMedia;
241 } FATINFO, *PFATINFO;
242
243 struct _VFATFCB;
244 struct _VFAT_DIRENTRY_CONTEXT;
245
246 typedef struct _HASHENTRY
247 {
248 ULONG Hash;
249 struct _VFATFCB* self;
250 struct _HASHENTRY* next;
251 }
252 HASHENTRY;
253
254 #define FCB_HASH_TABLE_SIZE 65536
255
256 typedef struct DEVICE_EXTENSION *PDEVICE_EXTENSION;
257
258 typedef NTSTATUS (*PGET_NEXT_CLUSTER)(PDEVICE_EXTENSION,ULONG,PULONG);
259 typedef NTSTATUS (*PFIND_AND_MARK_AVAILABLE_CLUSTER)(PDEVICE_EXTENSION,PULONG);
260 typedef NTSTATUS (*PWRITE_CLUSTER)(PDEVICE_EXTENSION,ULONG,ULONG,PULONG);
261
262 typedef NTSTATUS (*PGET_NEXT_DIR_ENTRY)(PVOID*,PVOID*,struct _VFATFCB*,struct _VFAT_DIRENTRY_CONTEXT*,BOOLEAN);
263
264 typedef struct DEVICE_EXTENSION
265 {
266 ERESOURCE DirResource;
267 ERESOURCE FatResource;
268
269 KSPIN_LOCK FcbListLock;
270 LIST_ENTRY FcbListHead;
271 ULONG HashTableSize;
272 struct _HASHENTRY **FcbHashTable;
273
274 PDEVICE_OBJECT VolumeDevice;
275 PDEVICE_OBJECT StorageDevice;
276 PFILE_OBJECT FATFileObject;
277 FATINFO FatInfo;
278 ULONG LastAvailableCluster;
279 ULONG AvailableClusters;
280 BOOLEAN AvailableClustersValid;
281 ULONG Flags;
282 struct _VFATFCB *VolumeFcb;
283
284 /* Pointers to functions for manipulating FAT. */
285 PGET_NEXT_CLUSTER GetNextCluster;
286 PFIND_AND_MARK_AVAILABLE_CLUSTER FindAndMarkAvailableCluster;
287 PWRITE_CLUSTER WriteCluster;
288 ULONG CleanShutBitMask;
289
290 /* Pointers to functions for manipulating directory entries. */
291 PGET_NEXT_DIR_ENTRY GetNextDirEntry;
292
293 ULONG BaseDateYear;
294
295 LIST_ENTRY VolumeListEntry;
296
297 /* Notifications */
298 LIST_ENTRY NotifyList;
299 PNOTIFY_SYNC NotifySync;
300
301 /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE */
302 ULONG OpenHandleCount;
303
304 /* VPBs for dismount */
305 PVPB IoVPB;
306 PVPB SpareVPB;
307 } DEVICE_EXTENSION, VCB, *PVCB;
308
309 typedef struct
310 {
311 PDRIVER_OBJECT DriverObject;
312 PDEVICE_OBJECT DeviceObject;
313 ULONG Flags;
314 ERESOURCE VolumeListLock;
315 LIST_ENTRY VolumeListHead;
316 NPAGED_LOOKASIDE_LIST FcbLookasideList;
317 NPAGED_LOOKASIDE_LIST CcbLookasideList;
318 NPAGED_LOOKASIDE_LIST IrpContextLookasideList;
319 FAST_IO_DISPATCH FastIoDispatch;
320 CACHE_MANAGER_CALLBACKS CacheMgrCallbacks;
321 } VFAT_GLOBAL_DATA, *PVFAT_GLOBAL_DATA;
322
323 extern PVFAT_GLOBAL_DATA VfatGlobalData;
324
325 #define FCB_CACHE_INITIALIZED 0x0001
326 #define FCB_DELETE_PENDING 0x0002
327 #define FCB_IS_FAT 0x0004
328 #define FCB_IS_PAGE_FILE 0x0008
329 #define FCB_IS_VOLUME 0x0010
330 #define FCB_IS_DIRTY 0x0020
331 #define FCB_IS_FATX_ENTRY 0x0040
332
333 typedef struct _VFATFCB
334 {
335 /* FCB header required by ROS/NT */
336 FSRTL_COMMON_FCB_HEADER RFCB;
337 SECTION_OBJECT_POINTERS SectionObjectPointers;
338 ERESOURCE MainResource;
339 ERESOURCE PagingIoResource;
340 /* end FCB header required by ROS/NT */
341
342 /* directory entry for this file or directory */
343 DIR_ENTRY entry;
344
345 /* Pointer to attributes in entry */
346 PUCHAR Attributes;
347
348 /* long file name, points into PathNameBuffer */
349 UNICODE_STRING LongNameU;
350
351 /* short file name */
352 UNICODE_STRING ShortNameU;
353
354 /* directory name, points into PathNameBuffer */
355 UNICODE_STRING DirNameU;
356
357 /* path + long file name 260 max*/
358 UNICODE_STRING PathNameU;
359
360 /* buffer for PathNameU */
361 PWCHAR PathNameBuffer;
362
363 /* buffer for ShortNameU */
364 WCHAR ShortNameBuffer[13];
365
366 /* */
367 LONG RefCount;
368
369 /* List of FCB's for this volume */
370 LIST_ENTRY FcbListEntry;
371
372 /* pointer to the parent fcb */
373 struct _VFATFCB *parentFcb;
374
375 /* Flags for the fcb */
376 ULONG Flags;
377
378 /* pointer to the file object which has initialized the fcb */
379 PFILE_OBJECT FileObject;
380
381 /* Directory index for the short name entry */
382 ULONG dirIndex;
383
384 /* Directory index where the long name starts */
385 ULONG startIndex;
386
387 /* Share access for the file object */
388 SHARE_ACCESS FCBShareAccess;
389
390 /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
391 ULONG OpenHandleCount;
392
393 /* Entry into the hash table for the path + long name */
394 HASHENTRY Hash;
395
396 /* Entry into the hash table for the path + short name */
397 HASHENTRY ShortHash;
398
399 /* List of byte-range locks for this file */
400 FILE_LOCK FileLock;
401
402 /*
403 * Optimalization: caching of last read/write cluster+offset pair. Can't
404 * be in VFATCCB because it must be reset everytime the allocated clusters
405 * change.
406 */
407 FAST_MUTEX LastMutex;
408 ULONG LastCluster;
409 ULONG LastOffset;
410 } VFATFCB, *PVFATFCB;
411
412 typedef struct _VFATCCB
413 {
414 LARGE_INTEGER CurrentByteOffset;
415 /* for DirectoryControl */
416 ULONG Entry;
417 /* for DirectoryControl */
418 UNICODE_STRING SearchPattern;
419 } VFATCCB, *PVFATCCB;
420
421 #define TAG_CCB 'BCCV'
422 #define TAG_FCB 'BCFV'
423 #define TAG_IRP 'PRIV'
424 #define TAG_VFAT 'TAFV'
425
426 #define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))
427
428 typedef struct __DOSTIME
429 {
430 USHORT Second:5;
431 USHORT Minute:6;
432 USHORT Hour:5;
433 }
434 DOSTIME, *PDOSTIME;
435
436 typedef struct __DOSDATE
437 {
438 USHORT Day:5;
439 USHORT Month:4;
440 USHORT Year:7;
441 }
442 DOSDATE, *PDOSDATE;
443
444 #define IRPCONTEXT_CANWAIT 0x0001
445 #define IRPCONTEXT_PENDINGRETURNED 0x0002
446
447 typedef struct
448 {
449 PIRP Irp;
450 PDEVICE_OBJECT DeviceObject;
451 PDEVICE_EXTENSION DeviceExt;
452 ULONG Flags;
453 WORK_QUEUE_ITEM WorkQueueItem;
454 PIO_STACK_LOCATION Stack;
455 UCHAR MajorFunction;
456 UCHAR MinorFunction;
457 PFILE_OBJECT FileObject;
458 ULONG RefCount;
459 KEVENT Event;
460 } VFAT_IRP_CONTEXT, *PVFAT_IRP_CONTEXT;
461
462 typedef struct _VFAT_DIRENTRY_CONTEXT
463 {
464 ULONG StartIndex;
465 ULONG DirIndex;
466 DIR_ENTRY DirEntry;
467 UNICODE_STRING LongNameU;
468 UNICODE_STRING ShortNameU;
469 } VFAT_DIRENTRY_CONTEXT, *PVFAT_DIRENTRY_CONTEXT;
470
471 typedef struct _VFAT_MOVE_CONTEXT
472 {
473 ULONG FirstCluster;
474 ULONG FileSize;
475 USHORT CreationDate;
476 USHORT CreationTime;
477 } VFAT_MOVE_CONTEXT, *PVFAT_MOVE_CONTEXT;
478
479 /* blockdev.c */
480
481 NTSTATUS
482 VfatReadDisk(
483 IN PDEVICE_OBJECT pDeviceObject,
484 IN PLARGE_INTEGER ReadOffset,
485 IN ULONG ReadLength,
486 IN PUCHAR Buffer,
487 IN BOOLEAN Override);
488
489 NTSTATUS
490 VfatReadDiskPartial(
491 IN PVFAT_IRP_CONTEXT IrpContext,
492 IN PLARGE_INTEGER ReadOffset,
493 IN ULONG ReadLength,
494 IN ULONG BufferOffset,
495 IN BOOLEAN Wait);
496
497 NTSTATUS
498 VfatWriteDiskPartial(
499 IN PVFAT_IRP_CONTEXT IrpContext,
500 IN PLARGE_INTEGER WriteOffset,
501 IN ULONG WriteLength,
502 IN ULONG BufferOffset,
503 IN BOOLEAN Wait);
504
505 NTSTATUS
506 VfatBlockDeviceIoControl(
507 IN PDEVICE_OBJECT DeviceObject,
508 IN ULONG CtlCode,
509 IN PVOID InputBuffer,
510 IN ULONG InputBufferSize,
511 IN OUT PVOID OutputBuffer,
512 IN OUT PULONG pOutputBufferSize,
513 IN BOOLEAN Override);
514
515 /* cleanup.c */
516
517 NTSTATUS
518 VfatCleanup(
519 PVFAT_IRP_CONTEXT IrpContext);
520
521 /* close.c */
522
523 NTSTATUS
524 VfatClose(
525 PVFAT_IRP_CONTEXT IrpContext);
526
527 NTSTATUS
528 VfatCloseFile(
529 PDEVICE_EXTENSION DeviceExt,
530 PFILE_OBJECT FileObject);
531
532 /* create.c */
533
534 NTSTATUS
535 VfatCreate(
536 PVFAT_IRP_CONTEXT IrpContext);
537
538 NTSTATUS
539 FindFile(
540 PDEVICE_EXTENSION DeviceExt,
541 PVFATFCB Parent,
542 PUNICODE_STRING FileToFindU,
543 PVFAT_DIRENTRY_CONTEXT DirContext,
544 BOOLEAN First);
545
546 VOID
547 vfat8Dot3ToString(
548 PFAT_DIR_ENTRY pEntry,
549 PUNICODE_STRING NameU);
550
551 NTSTATUS
552 ReadVolumeLabel(
553 PDEVICE_EXTENSION DeviceExt,
554 PVPB Vpb);
555
556 /* dir.c */
557
558 NTSTATUS
559 VfatDirectoryControl(
560 PVFAT_IRP_CONTEXT IrpContext);
561
562 BOOLEAN
563 FsdDosDateTimeToSystemTime(
564 PDEVICE_EXTENSION DeviceExt,
565 USHORT DosDate,
566 USHORT DosTime,
567 PLARGE_INTEGER SystemTime);
568
569 BOOLEAN
570 FsdSystemTimeToDosDateTime(
571 PDEVICE_EXTENSION DeviceExt,
572 PLARGE_INTEGER SystemTime,
573 USHORT *pDosDate,
574 USHORT *pDosTime);
575
576 /* direntry.c */
577
578 ULONG
579 vfatDirEntryGetFirstCluster(
580 PDEVICE_EXTENSION pDeviceExt,
581 PDIR_ENTRY pDirEntry);
582
583 BOOLEAN
584 VfatIsDirectoryEmpty(
585 PVFATFCB Fcb);
586
587 NTSTATUS
588 FATGetNextDirEntry(
589 PVOID *pContext,
590 PVOID *pPage,
591 IN PVFATFCB pDirFcb,
592 IN PVFAT_DIRENTRY_CONTEXT DirContext,
593 BOOLEAN First);
594
595 NTSTATUS
596 FATXGetNextDirEntry(
597 PVOID *pContext,
598 PVOID *pPage,
599 IN PVFATFCB pDirFcb,
600 IN PVFAT_DIRENTRY_CONTEXT DirContext,
601 BOOLEAN First);
602
603 /* dirwr.c */
604
605 NTSTATUS
606 VfatAddEntry(
607 PDEVICE_EXTENSION DeviceExt,
608 PUNICODE_STRING PathNameU,
609 PVFATFCB* Fcb,
610 PVFATFCB ParentFcb,
611 ULONG RequestedOptions,
612 UCHAR ReqAttr,
613 PVFAT_MOVE_CONTEXT MoveContext);
614
615 NTSTATUS
616 VfatUpdateEntry(
617 PVFATFCB pFcb);
618
619 NTSTATUS
620 VfatDelEntry(
621 PDEVICE_EXTENSION,
622 PVFATFCB,
623 PVFAT_MOVE_CONTEXT);
624
625 BOOLEAN
626 vfatFindDirSpace(
627 PDEVICE_EXTENSION DeviceExt,
628 PVFATFCB pDirFcb,
629 ULONG nbSlots,
630 PULONG start);
631
632 NTSTATUS
633 vfatRenameEntry(
634 IN PDEVICE_EXTENSION DeviceExt,
635 IN PVFATFCB pFcb,
636 IN PUNICODE_STRING FileName,
637 IN BOOLEAN CaseChangeOnly);
638
639 NTSTATUS
640 VfatMoveEntry(
641 IN PDEVICE_EXTENSION DeviceExt,
642 IN PVFATFCB pFcb,
643 IN PUNICODE_STRING FileName,
644 IN PVFATFCB ParentFcb);
645
646 /* ea.h */
647
648 NTSTATUS
649 VfatSetExtendedAttributes(
650 PFILE_OBJECT FileObject,
651 PVOID Ea,
652 ULONG EaLength);
653
654 /* fastio.c */
655
656 VOID
657 VfatInitFastIoRoutines(
658 PFAST_IO_DISPATCH FastIoDispatch);
659
660 BOOLEAN
661 NTAPI
662 VfatAcquireForLazyWrite(
663 IN PVOID Context,
664 IN BOOLEAN Wait);
665
666 VOID
667 NTAPI
668 VfatReleaseFromLazyWrite(
669 IN PVOID Context);
670
671 BOOLEAN
672 NTAPI
673 VfatAcquireForReadAhead(
674 IN PVOID Context,
675 IN BOOLEAN Wait);
676
677 VOID
678 NTAPI
679 VfatReleaseFromReadAhead(
680 IN PVOID Context);
681
682 /* fat.c */
683
684 NTSTATUS
685 FAT12GetNextCluster(
686 PDEVICE_EXTENSION DeviceExt,
687 ULONG CurrentCluster,
688 PULONG NextCluster);
689
690 NTSTATUS
691 FAT12FindAndMarkAvailableCluster(
692 PDEVICE_EXTENSION DeviceExt,
693 PULONG Cluster);
694
695 NTSTATUS
696 FAT12WriteCluster(
697 PDEVICE_EXTENSION DeviceExt,
698 ULONG ClusterToWrite,
699 ULONG NewValue,
700 PULONG OldValue);
701
702 NTSTATUS
703 FAT16GetNextCluster(
704 PDEVICE_EXTENSION DeviceExt,
705 ULONG CurrentCluster,
706 PULONG NextCluster);
707
708 NTSTATUS
709 FAT16FindAndMarkAvailableCluster(
710 PDEVICE_EXTENSION DeviceExt,
711 PULONG Cluster);
712
713 NTSTATUS
714 FAT16WriteCluster(
715 PDEVICE_EXTENSION DeviceExt,
716 ULONG ClusterToWrite,
717 ULONG NewValue,
718 PULONG OldValue);
719
720 NTSTATUS
721 FAT32GetNextCluster(
722 PDEVICE_EXTENSION DeviceExt,
723 ULONG CurrentCluster,
724 PULONG NextCluster);
725
726 NTSTATUS
727 FAT32FindAndMarkAvailableCluster(
728 PDEVICE_EXTENSION DeviceExt,
729 PULONG Cluster);
730
731 NTSTATUS
732 FAT32WriteCluster(
733 PDEVICE_EXTENSION DeviceExt,
734 ULONG ClusterToWrite,
735 ULONG NewValue,
736 PULONG OldValue);
737
738 NTSTATUS
739 OffsetToCluster(
740 PDEVICE_EXTENSION DeviceExt,
741 ULONG FirstCluster,
742 ULONG FileOffset,
743 PULONG Cluster,
744 BOOLEAN Extend);
745
746 ULONGLONG
747 ClusterToSector(
748 PDEVICE_EXTENSION DeviceExt,
749 ULONG Cluster);
750
751 NTSTATUS
752 GetNextCluster(
753 PDEVICE_EXTENSION DeviceExt,
754 ULONG CurrentCluster,
755 PULONG NextCluster);
756
757 NTSTATUS
758 GetNextClusterExtend(
759 PDEVICE_EXTENSION DeviceExt,
760 ULONG CurrentCluster,
761 PULONG NextCluster);
762
763 NTSTATUS
764 CountAvailableClusters(
765 PDEVICE_EXTENSION DeviceExt,
766 PLARGE_INTEGER Clusters);
767
768 NTSTATUS
769 WriteCluster(
770 PDEVICE_EXTENSION DeviceExt,
771 ULONG ClusterToWrite,
772 ULONG NewValue);
773
774 /* fcb.c */
775
776 PVFATFCB
777 vfatNewFCB(
778 PDEVICE_EXTENSION pVCB,
779 PUNICODE_STRING pFileNameU);
780
781 NTSTATUS
782 vfatUpdateFCB(
783 PDEVICE_EXTENSION pVCB,
784 PVFATFCB Fcb,
785 PUNICODE_STRING LongName,
786 PUNICODE_STRING ShortName,
787 PVFATFCB ParentFcb);
788
789 VOID
790 vfatDestroyFCB(
791 PVFATFCB pFCB);
792
793 VOID
794 vfatDestroyCCB(
795 PVFATCCB pCcb);
796
797 VOID
798 vfatGrabFCB(
799 PDEVICE_EXTENSION pVCB,
800 PVFATFCB pFCB);
801
802 VOID
803 vfatReleaseFCB(
804 PDEVICE_EXTENSION pVCB,
805 PVFATFCB pFCB);
806
807 PVFATFCB
808 vfatGrabFCBFromTable(
809 PDEVICE_EXTENSION pDeviceExt,
810 PUNICODE_STRING pFileNameU);
811
812 PVFATFCB
813 vfatMakeRootFCB(
814 PDEVICE_EXTENSION pVCB);
815
816 PVFATFCB
817 vfatOpenRootFCB(
818 PDEVICE_EXTENSION pVCB);
819
820 BOOLEAN
821 vfatFCBIsDirectory(
822 PVFATFCB FCB);
823
824 BOOLEAN
825 vfatFCBIsRoot(
826 PVFATFCB FCB);
827
828 NTSTATUS
829 vfatAttachFCBToFileObject(
830 PDEVICE_EXTENSION vcb,
831 PVFATFCB fcb,
832 PFILE_OBJECT fileObject);
833
834 NTSTATUS
835 vfatDirFindFile(
836 PDEVICE_EXTENSION pVCB,
837 PVFATFCB parentFCB,
838 PUNICODE_STRING FileToFindU,
839 PVFATFCB *fileFCB);
840
841 NTSTATUS
842 vfatGetFCBForFile(
843 PDEVICE_EXTENSION pVCB,
844 PVFATFCB *pParentFCB,
845 PVFATFCB *pFCB,
846 PUNICODE_STRING pFileNameU);
847
848 NTSTATUS
849 vfatMakeFCBFromDirEntry(
850 PVCB vcb,
851 PVFATFCB directoryFCB,
852 PVFAT_DIRENTRY_CONTEXT DirContext,
853 PVFATFCB *fileFCB);
854
855 /* finfo.c */
856
857 NTSTATUS
858 VfatQueryInformation(
859 PVFAT_IRP_CONTEXT IrpContext);
860
861 NTSTATUS
862 VfatSetInformation(
863 PVFAT_IRP_CONTEXT IrpContext);
864
865 NTSTATUS
866 VfatSetAllocationSizeInformation(
867 PFILE_OBJECT FileObject,
868 PVFATFCB Fcb,
869 PDEVICE_EXTENSION DeviceExt,
870 PLARGE_INTEGER AllocationSize);
871
872 /* flush.c */
873
874 NTSTATUS
875 VfatFlush(
876 PVFAT_IRP_CONTEXT IrpContext);
877
878 NTSTATUS
879 VfatFlushVolume(
880 PDEVICE_EXTENSION DeviceExt,
881 PVFATFCB VolumeFcb);
882
883 /* fsctl.c */
884
885 NTSTATUS
886 VfatFileSystemControl(
887 PVFAT_IRP_CONTEXT IrpContext);
888
889 /* iface.c */
890
891 NTSTATUS
892 NTAPI
893 DriverEntry(
894 PDRIVER_OBJECT DriverObject,
895 PUNICODE_STRING RegistryPath);
896
897
898 /* misc.c */
899
900 NTSTATUS
901 VfatQueueRequest(
902 PVFAT_IRP_CONTEXT IrpContext);
903
904 PVFAT_IRP_CONTEXT
905 VfatAllocateIrpContext(
906 PDEVICE_OBJECT DeviceObject,
907 PIRP Irp);
908
909 VOID
910 VfatFreeIrpContext(
911 PVFAT_IRP_CONTEXT IrpContext);
912
913 DRIVER_DISPATCH
914 VfatBuildRequest;
915
916 NTSTATUS
917 NTAPI
918 VfatBuildRequest(
919 PDEVICE_OBJECT DeviceObject,
920 PIRP Irp);
921
922 PVOID
923 VfatGetUserBuffer(
924 IN PIRP);
925
926 NTSTATUS
927 VfatLockUserBuffer(
928 IN PIRP,
929 IN ULONG,
930 IN LOCK_OPERATION);
931
932 BOOLEAN
933 VfatCheckForDismount(
934 IN PDEVICE_EXTENSION DeviceExt,
935 IN BOOLEAN Create);
936
937 /* pnp.c */
938
939 NTSTATUS
940 VfatPnp(
941 PVFAT_IRP_CONTEXT IrpContext);
942
943 /* rw.c */
944
945 NTSTATUS
946 VfatRead(
947 PVFAT_IRP_CONTEXT IrpContext);
948
949 NTSTATUS
950 VfatWrite(
951 PVFAT_IRP_CONTEXT IrpContext);
952
953 NTSTATUS
954 NextCluster(
955 PDEVICE_EXTENSION DeviceExt,
956 ULONG FirstCluster,
957 PULONG CurrentCluster,
958 BOOLEAN Extend);
959
960 /* shutdown.c */
961
962 DRIVER_DISPATCH
963 VfatShutdown;
964
965 NTSTATUS
966 NTAPI
967 VfatShutdown(
968 PDEVICE_OBJECT DeviceObject,
969 PIRP Irp);
970
971 /* string.c */
972
973 VOID
974 vfatSplitPathName(
975 PUNICODE_STRING PathNameU,
976 PUNICODE_STRING DirNameU,
977 PUNICODE_STRING FileNameU);
978
979 BOOLEAN
980 vfatIsLongIllegal(
981 WCHAR c);
982
983 BOOLEAN
984 wstrcmpjoki(
985 PWSTR s1,
986 PWSTR s2);
987
988 /* volume.c */
989
990 NTSTATUS
991 VfatQueryVolumeInformation(
992 PVFAT_IRP_CONTEXT IrpContext);
993
994 NTSTATUS
995 VfatSetVolumeInformation(
996 PVFAT_IRP_CONTEXT IrpContext);
997
998 #endif /* _FASTFAT_PCH_ */