2 * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3 * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
5 * PURPOSE: Header file: rfsd structures.
6 * PROGRAMMER: Mark Piper, Matt Wu, Bo Brantén.
16 #pragma warning(disable:4068)
17 #define __drv_mustHoldCriticalRegion
21 /* INCLUDES *************************************************************/
23 #include <linux/module.h>
24 //#include <linux/reiserfs_fs.h> // Full ReiserFS header
25 #include "reiserfs.h" // Simplified ReiserFS header
27 #include <ndk/rtlfuncs.h>
28 #include <pseh/pseh2.h>
31 typedef struct reiserfs_super_block_v1 RFSD_SUPER_BLOCK
, *PRFSD_SUPER_BLOCK
;
32 typedef struct stat_data RFSD_INODE
, *PRFSD_INODE
;
34 #define RFSD_CALLBACK(name) NTSTATUS(* name )(ULONG BlockNumber, PVOID pContext)
37 typedef struct block_head RFSD_BLOCK_HEAD
, *PRFSD_BLOCK_HEAD
; // [mark]
38 typedef struct reiserfs_de_head RFSD_DENTRY_HEAD
, *PRFSD_DENTRY_HEAD
; // [mark]
39 typedef struct item_head RFSD_ITEM_HEAD
, *PRFSD_ITEM_HEAD
; // [mark]
40 typedef struct reiserfs_key RFSD_KEY_ON_DISK
, *PRFSD_KEY_ON_DISK
;
41 typedef struct reiserfs_cpu_key RFSD_KEY_IN_MEMORY
, *PRFSD_KEY_IN_MEMORY
;
42 typedef struct disk_child RFSD_DISK_NODE_REF
, *PRFSD_DISK_NODE_REF
;
44 #define RFSD_NAME_LEN 255 /// Default length of buffers for filenames (although filenames may be longer)
46 #define SUPER_BLOCK_OFFSET REISERFS_DISK_OFFSET_IN_BYTES
47 #define SUPER_BLOCK_SIZE sizeof(RFSD_SUPER_BLOCK)
49 #define RFSD_ROOT_PARENT_ID 1 /// Part of the key for the root node
50 #define RFSD_ROOT_OBJECT_ID 2 /// Part of the key for the root node
51 #define RFSD_IS_ROOT_KEY(x) (x.k_dir_id == RFSD_ROOT_PARENT_ID && x.k_objectid == RFSD_ROOT_OBJECT_ID)
52 #define RFSD_IS_PTR_TO_ROOT_KEY(x) (x->k_dir_id == RFSD_ROOT_PARENT_ID && x->k_objectid == RFSD_ROOT_OBJECT_ID)
54 typedef short RFSD_KEY_COMPARISON
;
55 typedef __u16 RFSD_KEY_VERSION
;
57 #define RFSD_KEY_VERSION_1 0
58 #define RFSD_KEY_VERSION_2 1
59 #define RFSD_KEY_VERSION_UNKNOWN 7
61 // Results of a key comparison (as returned by CompareKeys)
62 #define RFSD_KEYS_MATCH 0
63 #define RFSD_KEY_SMALLER -1
64 #define RFSD_KEY_LARGER 1
67 #define RFSD_LEAF_BLOCK_LEVEL 1
73 /* DEBUG ****************************************************************/
75 #define DbgBreak() DbgPrint("rfsd: breakpoint requested.\n");DbgBreakPoint()
77 #define DbgBreak() DbgPrint("rfsd: breakpoint ignored.\n")
80 /* STRUCTS & CONSTS******************************************************/
82 #define RFSD_VERSION "0.26"
88 // To build read-only driver
90 #define RFSD_READ_ONLY TRUE
92 // To support driver dynamics unload
94 #define RFSD_UNLOAD TRUE
98 #define RFSD_POOL_TAG 'dsfR'
104 #define RFSD_BLOCK_TYPES (0x04)
106 #define MAXIMUM_RECORD_LENGTH (0x10000)
108 #define SECTOR_BITS (Vcb->SectorBits)
109 #define SECTOR_SIZE (Vcb->DiskGeometry.BytesPerSector)
110 #define DEFAULT_SECTOR_SIZE (0x200)
112 #define READ_AHEAD_GRANULARITY (0x10000)
114 #define SUPER_BLOCK (Vcb->SuperBlock)
116 #define BLOCK_SIZE (Vcb->BlockSize)
117 #define BLOCK_BITS (SUPER_BLOCK->s_log_block_size + 10)
119 #define INODES_COUNT (Vcb->SuperBlock->s_inodes_count)
121 #define INODES_PER_GROUP (SUPER_BLOCK->s_inodes_per_group)
122 #define BLOCKS_PER_GROUP (SUPER_BLOCK->s_blocks_per_group)
123 #define TOTAL_BLOCKS (SUPER_BLOCK->s_blocks_count)
125 #define RFSD_FIRST_DATA_BLOCK (SUPER_BLOCK->s_first_data_block)
129 #define CEILING_ALIGNED(A, B) (((A) + (B) - 1) & (~((B) - 1)))
132 // The __SLINE__ macro evaluates to a string with the line of the program from which it is called.
133 // (Note that this requires two levels of macro indirection...)
134 #define __STR2__(x) #x
135 #define __STR1__(x) __STR2__(x)
136 #define __SLINE__ __STR1__(__LINE__)
139 /* File System Releated *************************************************/
141 #define DRIVER_NAME "Rfsd"
142 #define DEVICE_NAME L"\\Rfsd"
146 #define PARAMETERS_KEY L"\\Parameters"
148 #define WRITING_SUPPORT L"WritingSupport"
149 #define CHECKING_BITMAP L"CheckingBitmap"
150 #define EXT3_FORCEWRITING L"Ext3ForceWriting"
151 #define EXT3_CODEPAGE L"CodePage"
153 // To support rfsd unload routine
156 #define DOS_DEVICE_NAME L"\\DosDevices\\Rfsd"
159 // Private IOCTL to make the driver ready to unload
161 #define IOCTL_PREPARE_TO_UNLOAD \
162 CTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_NEITHER, FILE_WRITE_ACCESS)
164 #endif // RFSD_UNLOAD
167 #define SetFlag(x,f) ((x) |= (f))
171 #define ClearFlag(x,f) ((x) &= ~(f))
174 #define IsFlagOn(a,b) ((BOOLEAN)(FlagOn(a,b) == b))
176 #define RfsdRaiseStatus(IRPCONTEXT,STATUS) { \
177 (IRPCONTEXT)->ExceptionCode = (STATUS); \
178 ExRaiseStatus( (STATUS) ); \
181 #define RfsdNormalizeAndRaiseStatus(IRPCONTEXT,STATUS) { \
182 /* (IRPCONTEXT)->ExceptionStatus = (STATUS); */ \
183 if ((STATUS) == STATUS_VERIFY_REQUIRED) { ExRaiseStatus((STATUS)); } \
184 ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),STATUS_UNEXPECTED_IO_ERROR)); \
188 // Define IsEndofFile for read and write operations
191 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
192 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
194 #define IsEndOfFile(Pos) ((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
195 (Pos.HighPart == FILE_USE_FILE_POINTER_POSITION ))
197 #define IsDirectory(Fcb) IsFlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
200 // Bug Check Codes Definitions
203 #define RFSD_FILE_SYSTEM (FILE_SYSTEM)
205 #define RFSD_BUGCHK_BLOCK (0x00010000)
206 #define RFSD_BUGCHK_CLEANUP (0x00020000)
207 #define RFSD_BUGCHK_CLOSE (0x00030000)
208 #define RFSD_BUGCHK_CMCB (0x00040000)
209 #define RFSD_BUGCHK_CREATE (0x00050000)
210 #define RFSD_BUGCHK_DEBUG (0x00060000)
211 #define RFSD_BUGCHK_DEVCTL (0x00070000)
212 #define RFSD_BUGCHK_DIRCTL (0x00080000)
213 #define RFSD_BUGCHK_DISPATCH (0x00090000)
214 #define RFSD_BUGCHK_EXCEPT (0x000A0000)
215 #define RFSD_BUGCHK_RFSD (0x000B0000)
216 #define RFSD_BUGCHK_FASTIO (0x000C0000)
217 #define RFSD_BUGCHK_FILEINFO (0x000D0000)
218 #define RFSD_BUGCHK_FLUSH (0x000E0000)
219 #define RFSD_BUGCHK_FSCTL (0x000F0000)
220 #define RFSD_BUGCHK_INIT (0x00100000)
221 #define RFSD_BUGCHK_LOCK (0x0011000)
222 #define RFSD_BUGCHK_MEMORY (0x0012000)
223 #define RFSD_BUGCHK_MISC (0x0013000)
224 #define RFSD_BUGCHK_READ (0x00140000)
225 #define RFSD_BUGCHK_SHUTDOWN (0x00150000)
226 #define RFSD_BUGCHK_VOLINFO (0x00160000)
227 #define RFSD_BUGCHK_WRITE (0x00170000)
229 #define RFSD_BUGCHK_LAST (0x00170000)
231 #define RfsdBugCheck(A,B,C,D) { KeBugCheckEx(RFSD_FILE_SYSTEM, A | __LINE__, B, C, D ); }
234 /* Rfsd file system definions *******************************************/
236 #define RFSD_MIN_BLOCK 1024
237 #define RFSD_MIN_FRAG 1024
240 // Inode flags (Linux uses octad number, but why ? strange!!!)
243 #define S_IFMT 0x0F000 /* 017 0000 */
244 #define S_IFSOCK 0x0C000 /* 014 0000 */
245 #define S_IFLNK 0x0A000 /* 012 0000 */
246 #define S_IFREG 0x08000 /* 010 0000 */
247 #define S_IFBLK 0x06000 /* 006 0000 */
248 #define S_IFDIR 0x04000 /* 004 0000 */
249 #define S_IFCHR 0x02000 /* 002 0000 */
250 #define S_IFIFO 0x01000 /* 001 0000 */
251 #define S_ISUID 0x00800 /* 000 4000 */
252 #define S_ISGID 0x00400 /* 000 2000 */
253 #define S_ISVTX 0x00200 /* 000 1000 */
255 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
256 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
257 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
258 #define S_ISFIL(m) (((m) & S_IFMT) == S_IFFIL)
259 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
260 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
261 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
262 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
264 #define S_IPERMISSION_MASK 0x1FF /* */
266 #define S_IRWXU 0x1C0 /* 0 0700 */
267 #define S_IRUSR 0x100 /* 0 0400 */
268 #define S_IWUSR 0x080 /* 0 0200 */
269 #define S_IXUSR 0x040 /* 0 0100 */
271 #define S_IRWXG 0x038 /* 0 0070 */
272 #define S_IRGRP 0x020 /* 0 0040 */
273 #define S_IWGRP 0x010 /* 0 0020 */
274 #define S_IXGRP 0x008 /* 0 0010 */
276 #define S_IRWXO 0x007 /* 0 0007 */
277 #define S_IROTH 0x004 /* 0 0004 */
278 #define S_IWOTH 0x002 /* 0 0002 */
279 #define S_IXOTH 0x001 /* 0 0001 */
281 #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
282 #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
283 #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
284 #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
285 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
287 #define S_ISREADABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH))
288 #define S_ISWRITABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH))
290 #define RfsdSetReadable(m) (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))
291 #define RfsdSetWritable(m) (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))
293 #define RfsdSetReadOnly(m) (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))
294 #define RfsdIsReadOnly(m) (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))
300 #define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */
301 #define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */
302 #define I_DIRTY_PAGES 4 /* Data-related inode changes pending */
307 #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
311 // Rfsd Driver Definitions
315 // RFSD_IDENTIFIER_TYPE
317 // Identifiers used to mark the structures
320 typedef enum _RFSD_IDENTIFIER_TYPE
{
327 } RFSD_IDENTIFIER_TYPE
;
332 // Header used to mark the structures
334 typedef struct _RFSD_IDENTIFIER
{
335 RFSD_IDENTIFIER_TYPE Type
;
337 } RFSD_IDENTIFIER
, *PRFSD_IDENTIFIER
;
340 #define NodeType(Ptr) (*((RFSD_IDENTIFIER_TYPE *)(Ptr)))
342 typedef struct _RFSD_MCB RFSD_MCB
, *PRFSD_MCB
;
348 // REPINNED_BCBS List
351 #define RFSD_REPINNED_BCBS_ARRAY_SIZE (8)
353 typedef struct _RFSD_REPINNED_BCBS
{
356 // A pointer to the next structure contains additional repinned bcbs
359 struct _RFSD_REPINNED_BCBS
*Next
;
362 // A fixed size array of pinned bcbs. Whenever a new bcb is added to
363 // the repinned bcb structure it is added to this array. If the
364 // array is already full then another repinned bcb structure is allocated
365 // and pointed to with Next.
368 PBCB Bcb
[ RFSD_REPINNED_BCBS_ARRAY_SIZE
];
370 } RFSD_REPINNED_BCBS
, *PRFSD_REPINNED_BCBS
;
373 #define CODEPAGE_MAXLEN 0x20
378 // Data that is not specific to a mounted volume
381 typedef struct _RFSD_GLOBAL
{
383 // Identifier for this structure
384 RFSD_IDENTIFIER Identifier
;
386 // Syncronization primitive for this structure
389 // Syncronization primitive for Counting
390 ERESOURCE CountResource
;
392 // Syncronization primitive for LookAside Lists
393 ERESOURCE LAResource
;
395 // Table of pointers to the fast I/O entry points
396 FAST_IO_DISPATCH FastIoDispatch
;
398 // Table of pointers to the Cache Manager callbacks
399 CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
;
400 CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
;
402 // Pointer to the driver object
403 PDRIVER_OBJECT DriverObject
;
405 // Pointer to the main device object
406 PDEVICE_OBJECT DeviceObject
;
408 // List of mounted volumes
411 // Look Aside table of IRP_CONTEXT, FCB, MCB, CCB
413 NPAGED_LOOKASIDE_LIST RfsdIrpContextLookasideList
;
414 NPAGED_LOOKASIDE_LIST RfsdFcbLookasideList
;
415 NPAGED_LOOKASIDE_LIST RfsdCcbLookasideList
;
416 PAGED_LOOKASIDE_LIST RfsdMcbLookasideList
;
425 // IRP_MJ_CLOSE : FCB
426 USHORT IRPCloseCount
;
429 // Global flags for the driver
432 // User specified codepage name
434 WCHAR UniName
[CODEPAGE_MAXLEN
];
435 UCHAR AnsiName
[CODEPAGE_MAXLEN
];
436 struct nls_table
* PageTable
;
439 } RFSD_GLOBAL
, *PRFSD_GLOBAL
;
441 #define PAGE_TABLE RfsdGlobal->CodePage.PageTable
444 // Flags for RFSD_GLOBAL_DATA
446 #define RFSD_UNLOAD_PENDING 0x00000001
447 #define RFSD_SUPPORT_WRITING 0x00000002
448 #define EXT3_FORCE_WRITING 0x00000004
449 #define RFSD_CHECKING_BITMAP 0x00000008
452 // Driver Extension define
455 RFSD_GLOBAL RfsdGlobal
;
456 } RFSDFS_EXT
, *PRFSDFS_EXT
;
459 typedef struct _RFSD_FCBVCB
{
461 // FCB header required by NT
462 FSRTL_COMMON_FCB_HEADER CommonFCBHeader
;
463 SECTION_OBJECT_POINTERS SectionObject
;
464 ERESOURCE MainResource
;
465 ERESOURCE PagingIoResource
;
466 // end FCB header required by NT
468 // Identifier for this structure
469 RFSD_IDENTIFIER Identifier
;
470 } RFSD_FCBVCB
, *PRFSD_FCBVCB
;
473 // RFSD_VCB Volume Control Block
475 // Data that represents a mounted logical volume
476 // It is allocated as the device extension of the volume device object
478 typedef struct _RFSD_VCB
{
480 // FCB header required by NT
481 // The VCB is also used as an FCB for file objects
482 // that represents the volume itself
483 FSRTL_COMMON_FCB_HEADER Header
;
484 SECTION_OBJECT_POINTERS SectionObject
;
485 ERESOURCE MainResource
;
486 ERESOURCE PagingIoResource
;
487 // end FCB header required by NT
489 // Identifier for this structure
490 RFSD_IDENTIFIER Identifier
;
494 // Share Access for the file object
495 SHARE_ACCESS ShareAccess
;
497 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
498 // for files on this volume.
499 ULONG OpenFileHandleCount
;
501 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
502 // for both files on this volume and open instances of the
504 ULONG ReferenceCount
;
505 ULONG OpenHandleCount
;
513 // Pointer to the VPB in the target device object
516 // The FileObject of Volume used to lock the volume
517 PFILE_OBJECT LockFile
;
519 // List of FCBs for open files on this volume
522 // List of IRPs pending on directory change notify requests
523 LIST_ENTRY NotifyList
;
525 // Pointer to syncronization primitive for this list
526 PNOTIFY_SYNC NotifySync
;
528 // This volumes device object
529 PDEVICE_OBJECT DeviceObject
;
531 // The physical device object (the disk)
532 PDEVICE_OBJECT TargetDeviceObject
;
534 // The physical device object (the disk)
535 PDEVICE_OBJECT RealDevice
;
537 // Information about the physical device object
538 DISK_GEOMETRY DiskGeometry
;
539 PARTITION_INFORMATION PartitionInformation
;
541 PRFSD_SUPER_BLOCK SuperBlock
;
542 PVOID GroupDesc
; // (NOTE: unused in ReiserFS, but preserved in order to minimize changes to existing code)
543 // PVOID GroupDescBcb;
545 // Number of Group Decsciptions
548 // Bitmap Block per group
549 PRTL_BITMAP BlockBitMaps;
550 PRTL_BITMAP InodeBitMaps;
552 // Block / Cluster size
555 // Sector size in bits (NOTE: unused in ReiserFS)
558 ULONG dwData
[RFSD_BLOCK_TYPES
];
559 ULONG dwMeta
[RFSD_BLOCK_TYPES
];
561 // Flags for the volume
564 // Streaming File Object
565 PFILE_OBJECT StreamObj
;
567 // Resource Lock for Mcb
568 ERESOURCE McbResource
;
570 // Dirty Mcbs of modifications for volume stream
573 // Entry of Mcb Tree (Root Node)
577 } RFSD_VCB
, *PRFSD_VCB
;
580 // Flags for RFSD_VCB
582 #define VCB_INITIALIZED 0x00000001
583 #define VCB_VOLUME_LOCKED 0x00000002
584 #define VCB_MOUNTED 0x00000004
585 #define VCB_DISMOUNT_PENDING 0x00000008
586 #define VCB_READ_ONLY 0x00000010
588 #define VCB_WRITE_PROTECTED 0x10000000
589 #define VCB_FLOPPY_DISK 0x20000000
590 #define VCB_REMOVAL_PREVENTED 0x40000000
591 #define VCB_REMOVABLE_MEDIA 0x80000000
594 #define IsMounted(Vcb) (IsFlagOn(Vcb->Flags, VCB_MOUNTED))
597 // RFSD_FCB File Control Block
599 // Data that represents an open file
600 // There is a single instance of the FCB for every open file
602 typedef struct _RFSD_FCB
{
604 // FCB header required by NT
605 FSRTL_COMMON_FCB_HEADER Header
;
606 SECTION_OBJECT_POINTERS SectionObject
;
607 ERESOURCE MainResource
;
608 ERESOURCE PagingIoResource
;
609 // end FCB header required by NT
611 // Identifier for this structure
612 RFSD_IDENTIFIER Identifier
;
614 // List of FCBs for this volume
617 // Share Access for the file object
618 SHARE_ACCESS ShareAccess
;
620 // List of byte-range locks for this file
621 FILE_LOCK FileLockAnchor
;
623 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
624 ULONG OpenHandleCount
;
626 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
627 ULONG ReferenceCount
;
629 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
630 // But only for Files with FO_NO_INTERMEDIATE_BUFFERING flag
631 ULONG NonCachedOpenCount
;
636 // Pointer to the inode / stat data structure
639 // Hint block for next allocation
650 UNICODE_STRING LongName
;
653 // The Ansi Filename for debugging
654 OEM_STRING AnsiFileName
;
658 } RFSD_FCB
, *PRFSD_FCB
;
662 // Flags for RFSD_FCB
664 #define FCB_FROM_POOL 0x00000001
665 #define FCB_PAGE_FILE 0x00000002
666 #define FCB_DELETE_ON_CLOSE 0x00000004
667 #define FCB_DELETE_PENDING 0x00000008
668 #define FCB_FILE_DELETED 0x00000010
669 #define FCB_FILE_MODIFIED 0x00000020
675 // Identifier for this structure
676 RFSD_IDENTIFIER Identifier
;
683 PRFSD_MCB Parent
; // Parent
684 PRFSD_MCB Child
; // Children
685 PRFSD_MCB Next
; // Brothers
693 UNICODE_STRING ShortName
;
695 // Inode number (ReiserFS uses 128-bit keys instead of inode numbers)
696 RFSD_KEY_IN_MEMORY Key
;
698 // Dir entry offset in parent (relative to the start of the directory listing)
704 // List Link to Vcb->McbList
711 #define MCB_FROM_POOL 0x00000001
712 #define MCB_IN_TREE 0x00000002
713 #define MCB_IN_USE 0x00000004
715 #define IsMcbUsed(Mcb) IsFlagOn(Mcb->Flags, MCB_IN_USE)
718 // RFSD_CCB Context Control Block
720 // Data that represents one instance of an open file
721 // There is one instance of the CCB for every instance of an open file
723 typedef struct _RFSD_CCB
{
725 // Identifier for this structure
726 RFSD_IDENTIFIER Identifier
;
731 // State that may need to be maintained
732 ULONG CurrentByteOffset
;
734 UNICODE_STRING DirectorySearchPattern
;
736 } RFSD_CCB
, *PRFSD_CCB
;
742 #define CCB_FROM_POOL 0x00000001
744 #define CCB_ALLOW_EXTENDED_DASD_IO 0x80000000
749 // Used to pass information about a request between the drivers functions
751 typedef struct _RFSD_IRP_CONTEXT
{
753 // Identifier for this structure
754 RFSD_IDENTIFIER Identifier
;
756 // Pointer to the IRP this request describes
762 // The major and minor function code for the request
767 PDEVICE_OBJECT DeviceObject
;
769 // The real device object
770 PDEVICE_OBJECT RealDevice
;
773 PFILE_OBJECT FileObject
;
778 // If the request is synchronous (we are allowed to block)
779 BOOLEAN IsSynchronous
;
781 // If the request is top level
784 // Used if the request needs to be queued for later processing
785 WORK_QUEUE_ITEM WorkQueueItem
;
787 // If an exception is currently in progress
788 BOOLEAN ExceptionInProgress
;
790 // The exception code when an exception is in progress
791 NTSTATUS ExceptionCode
;
793 // Repinned BCBs List
794 RFSD_REPINNED_BCBS Repinned
;
796 } RFSD_IRP_CONTEXT
, *PRFSD_IRP_CONTEXT
;
799 #define IRP_CONTEXT_FLAG_FROM_POOL (0x00000001)
800 #define IRP_CONTEXT_FLAG_WAIT (0x00000002)
801 #define IRP_CONTEXT_FLAG_WRITE_THROUGH (0x00000004)
802 #define IRP_CONTEXT_FLAG_FLOPPY (0x00000008)
803 #define IRP_CONTEXT_FLAG_RECURSIVE_CALL (0x00000010)
804 #define IRP_CONTEXT_FLAG_DISABLE_POPUPS (0x00000020)
805 #define IRP_CONTEXT_FLAG_DEFERRED (0x00000040)
806 #define IRP_CONTEXT_FLAG_VERIFY_READ (0x00000080)
807 #define IRP_CONTEXT_STACK_IO_CONTEXT (0x00000100)
808 #define IRP_CONTEXT_FLAG_REQUEUED (0x00000200)
809 #define IRP_CONTEXT_FLAG_USER_IO (0x00000400)
810 #define IRP_CONTEXT_FLAG_DELAY_CLOSE (0x00000800)
815 // In the checked version of the driver this header is put in the beginning of
816 // every memory allocation
818 typedef struct _RFSD_ALLOC_HEADER
{
819 RFSD_IDENTIFIER Identifier
;
820 } RFSD_ALLOC_HEADER
, *PRFSD_ALLOC_HEADER
;
822 typedef struct _FCB_LIST_ENTRY
{
825 } FCB_LIST_ENTRY
, *PFCB_LIST_ENTRY
;
828 // Block Description List
829 typedef struct _RFSD_BDL
{
834 } RFSD_BDL
, *PRFSD_BDL
;
839 /* FUNCTIONS DECLARATION *****************************************************/
842 // The following macro is used to determine if an FSD thread can block
843 // for I/O or wait for a resource. It returns TRUE if the thread can
844 // block and FALSE otherwise. This attribute can then be used to call
845 // the FSD & FSP common work routine with the proper wait value.
848 #define CanRfsdWait(IRP) IoIsOperationSynchronous(Irp)
851 #define max(a,b) (((a) > (b)) ? (a) : (b))
855 #define min(a,b) (((a) < (b)) ? (a) : (b))
862 // TODO move allocate and load block here
865 RfsdFindItemHeaderInBlock(
867 IN PRFSD_KEY_IN_MEMORY pKey
, // The key to match against
868 IN PUCHAR pBlockBuffer
, // A filled disk block, provided by the caller
869 OUT PRFSD_ITEM_HEAD
* ppTargetItemHeader
, // A pointer to a PRFSD_ITEM_HEAD. The PRFSD_ITEM_HEAD will point to the item head matching Key, or NULL if there was no such item head in the given block.
870 IN
RFSD_KEY_COMPARISON (*fpComparisonFunction
)(PRFSD_KEY_IN_MEMORY
, PRFSD_KEY_IN_MEMORY
)
876 IN PRFSD_KEY_IN_MEMORY pItemKey
, // The key of the item to find
877 OUT PRFSD_ITEM_HEAD
* ppMatchingItemHeader
,
878 OUT PUCHAR
* ppItemBuffer
,
879 OUT PUCHAR
* ppBlockBuffer
, // Block buffer, which backs the other output data structures. The caller must free this (even in the case of an error)!
880 OUT PULONG pBlockNumber
, // The ordinal disk block number at which the item was found
881 IN
RFSD_KEY_COMPARISON (*fpComparisonFunction
)(PRFSD_KEY_IN_MEMORY
, PRFSD_KEY_IN_MEMORY
)
891 IN LOCK_OPERATION Operation
);
893 RfsdGetUserBuffer (IN PIRP Irp
);
898 IN PRFSD_IRP_CONTEXT IrpContext
,
900 IN PRFSD_BDL RfsdBDL
,
903 IN BOOLEAN bVerify
);
906 RfsdAllocateAndLoadBlock(
908 IN ULONG BlockIndex
);
916 IN BOOLEAN bVerify
);
924 IN BOOLEAN bVerify
);
928 IN PDEVICE_OBJECT DeviceOjbect
,
930 IN PVOID InputBuffer
,
931 IN ULONG InputBufferSize
,
932 IN OUT PVOID OutputBuffer
,
933 IN OUT PULONG OutputBufferSize
);
936 RfsdMediaEjectControl (
937 IN PRFSD_IRP_CONTEXT IrpContext
,
939 IN BOOLEAN bPrevent
);
942 RfsdDiskShutDown(PRFSD_VCB Vcb
);
949 RfsdCleanup (IN PRFSD_IRP_CONTEXT IrpContext
);
955 RfsdClose (IN PRFSD_IRP_CONTEXT IrpContext
);
958 RfsdQueueCloseRequest (IN PRFSD_IRP_CONTEXT IrpContext
);
961 IO_WORKITEM_ROUTINE RfsdDeQueueCloseRequest
;
965 RfsdDeQueueCloseRequest (IN PVOID Context
);
972 RfsdAcquireForLazyWrite (
976 RfsdReleaseFromLazyWrite (IN PVOID Context
);
979 RfsdAcquireForReadAhead (
989 RfsdNoOpRelease (IN PVOID Fcb
);
992 RfsdReleaseFromReadAhead (IN PVOID Context
);
1004 RfsdScanDir (IN PRFSD_VCB Vcb
,
1005 IN PRFSD_MCB ParentMcb
, // Mcb of the directory to be scanned
1006 IN PUNICODE_STRING FileName
, // Short file name (not necisarilly null-terminated!)
1007 IN OUT PULONG Index
, // Offset (in bytes) of the dentry relative to the start of the directory listing
1008 IN OUT PRFSD_DENTRY_HEAD rfsd_dir
); // Directory entry of the found item
1011 RfsdLookupFileName (
1013 IN PUNICODE_STRING FullFileName
,
1014 IN PRFSD_MCB ParentMcb
,
1015 OUT PRFSD_MCB
* RfsdMcb
,
1016 IN OUT PRFSD_INODE Inode
);
1020 IN PRFSD_IRP_CONTEXT IrpContext
,
1025 IN PRFSD_IRP_CONTEXT IrpContext
,
1029 RfsdCreate (IN PRFSD_IRP_CONTEXT IrpContext
);
1033 IN PRFSD_IRP_CONTEXT IrpContext
,
1035 IN PRFSD_FCB pParentFcb
,
1038 IN PUNICODE_STRING FileName
);
1041 RfsdSupersedeOrOverWriteFile(
1042 IN PRFSD_IRP_CONTEXT IrpContext
,
1045 IN ULONG Disposition
);
1059 #define RfsdPrint(arg) RfsdPrintf arg
1060 #define RfsdPrintNoIndent(arg) RfsdNIPrintf arg
1062 #define RfsdCompleteRequest(Irp, bPrint, PriorityBoost) \
1063 RfsdDbgPrintComplete(Irp, bPrint); \
1064 IoCompleteRequest(Irp, PriorityBoost)
1068 #define RfsdPrint(arg)
1069 #define RfsdPrintNoIndent(arg)
1071 #define RfsdCompleteRequest(Irp, bPrint, PriorityBoost) \
1072 IoCompleteRequest(Irp, PriorityBoost)
1079 LONG DebugPrintLevel
,
1087 LONG DebugPrintLevel
,
1092 extern ULONG ProcessNameOffset
;
1094 #define RfsdGetCurrentProcessName() ( \
1095 (PUCHAR) PsGetCurrentProcess() + ProcessNameOffset \
1099 RfsdGetProcessNameOffset (VOID
);
1103 IN PDEVICE_OBJECT DeviceObject
,
1107 RfsdDbgPrintComplete (
1113 RfsdNtStatusToString (IN NTSTATUS Status
);
1120 RfsdDeviceControlNormal (IN PRFSD_IRP_CONTEXT IrpContext
);
1123 RfsdPrepareToUnload (IN PRFSD_IRP_CONTEXT IrpContext
);
1126 RfsdDeviceControl (IN PRFSD_IRP_CONTEXT IrpContext
);
1133 RfsdGetInfoLength(IN FILE_INFORMATION_CLASS FileInformationClass
);
1136 RfsdProcessDirEntry(
1138 IN FILE_INFORMATION_CLASS FileInformationClass
,
1139 IN __u32 Key_ParentID
,
1140 IN __u32 Key_ObjectID
,
1142 IN ULONG UsedLength
,
1145 IN PUNICODE_STRING pName
,
1147 IN PVOID pPreviousEntry
);
1150 RfsdQueryDirectory (IN PRFSD_IRP_CONTEXT IrpContext
);
1153 RfsdNotifyChangeDirectory (
1154 IN PRFSD_IRP_CONTEXT IrpContext
1158 RfsdNotifyReportChange (
1159 IN PRFSD_IRP_CONTEXT IrpContext
,
1167 RfsdDirectoryControl (IN PRFSD_IRP_CONTEXT IrpContext
);
1170 RfsdIsDirectoryEmpty (
1180 RfsdQueueRequest (IN PRFSD_IRP_CONTEXT IrpContext
);
1183 IO_WORKITEM_ROUTINE RfsdDeQueueRequest
;
1187 RfsdDeQueueRequest (IN PVOID Context
);
1190 RfsdDispatchRequest (IN PRFSD_IRP_CONTEXT IrpContext
);
1193 __drv_dispatchType(IRP_MJ_CREATE
)
1194 __drv_dispatchType(IRP_MJ_CLOSE
)
1195 __drv_dispatchType(IRP_MJ_READ
)
1196 __drv_dispatchType(IRP_MJ_WRITE
)
1197 __drv_dispatchType(IRP_MJ_FLUSH_BUFFERS
)
1198 __drv_dispatchType(IRP_MJ_QUERY_INFORMATION
)
1199 __drv_dispatchType(IRP_MJ_SET_INFORMATION
)
1200 __drv_dispatchType(IRP_MJ_QUERY_VOLUME_INFORMATION
)
1201 __drv_dispatchType(IRP_MJ_SET_VOLUME_INFORMATION
)
1202 __drv_dispatchType(IRP_MJ_DIRECTORY_CONTROL
)
1203 __drv_dispatchType(IRP_MJ_FILE_SYSTEM_CONTROL
)
1204 __drv_dispatchType(IRP_MJ_DEVICE_CONTROL
)
1205 __drv_dispatchType(IRP_MJ_LOCK_CONTROL
)
1206 __drv_dispatchType(IRP_MJ_CLEANUP
)
1207 __drv_dispatchType(IRP_MJ_PNP
)
1208 __drv_dispatchType(IRP_MJ_SHUTDOWN
)
1209 DRIVER_DISPATCH RfsdBuildRequest
;
1214 IN PDEVICE_OBJECT DeviceObject
,
1223 RfsdExceptionFilter (
1224 IN PRFSD_IRP_CONTEXT IrpContext
,
1225 IN PEXCEPTION_POINTERS ExceptionPointer
1229 RfsdExceptionHandler (IN PRFSD_IRP_CONTEXT IrpContext
);
1244 IN PRFSD_IRP_CONTEXT IrpContext
,
1249 RfsdLoadGroup(IN PRFSD_VCB Vcb
);
1253 IN PRFSD_IRP_CONTEXT IrpContext
,
1259 RfsdGetInodeLba (IN PRFSD_VCB Vcb
,
1260 IN __u32 DirectoryID
,
1262 OUT PLONGLONG offset
);
1265 RfsdLoadInode (IN PRFSD_VCB Vcb
,
1266 IN PRFSD_KEY_IN_MEMORY pKey
,
1267 IN OUT PRFSD_INODE Inode
);
1270 RfsdLoadInode2 (IN PRFSD_VCB Vcb
,
1273 IN OUT PRFSD_INODE Inode
);
1276 IN PRFSD_IRP_CONTEXT IrpContext
,
1279 IN PRFSD_INODE Inode
1291 IN PRFSD_IRP_CONTEXT IrpContext
,
1299 IN PRFSD_IRP_CONTEXT IrpContext
,
1308 IN PRFSD_IRP_CONTEXT IrpContext
,
1319 IN PRFSD_IRP_CONTEXT IrpContext
,
1322 IN PRFSD_INODE Inode
,
1331 IN PRFSD_KEY_IN_MEMORY pKey
,
1332 IN PRFSD_INODE pInode
,
1333 OUT PULONG out_Count
,
1334 OUT PRFSD_BDL
* out_ppBdl
);
1338 IN PRFSD_IRP_CONTEXT IrpContext
,
1340 IN PRFSD_KEY_IN_MEMORY InodeNo
,
1341 IN PRFSD_INODE Inode
,
1342 IN ULONGLONG Offset
,
1345 OUT PRFSD_BDL
* Bdls
,
1351 PRFSD_IRP_CONTEXT IrpContext
,
1359 PRFSD_IRP_CONTEXT IrpContext
,
1365 PRFSD_IRP_CONTEXT IrpContext
,
1377 PRFSD_IRP_CONTEXT IrpContext
,
1384 PRFSD_IRP_CONTEXT IrpContext
,
1392 PRFSD_IRP_CONTEXT IrpContext
,
1399 IN PRFSD_IRP_CONTEXT IrpContext
,
1404 IN PUNICODE_STRING FileName
);
1408 IN PRFSD_IRP_CONTEXT IrpContext
,
1415 RfsdSetParentEntry (
1416 IN PRFSD_IRP_CONTEXT IrpContext
,
1420 IN ULONG NewParent
);
1425 IN PRFSD_IRP_CONTEXT IrpContext
,
1431 OUT BOOLEAN
*bFreed
);
1435 IN PRFSD_IRP_CONTEXT IrpContext
,
1443 IN LONGLONG Length
);
1446 RfsdRemoveMcbEntry (
1449 IN LONGLONG Length
);
1452 RfsdLookupMcbEntry (
1455 OUT PLONGLONG Lba OPTIONAL
,
1456 OUT PLONGLONG Length OPTIONAL
,
1457 OUT PLONGLONG RunStart OPTIONAL
,
1458 OUT PLONGLONG RunLength OPTIONAL
,
1459 OUT PULONG Index OPTIONAL
);
1462 SuperblockContainsMagicKey(PRFSD_SUPER_BLOCK sb
);
1465 ConvertKeyTypeUniqueness(__u32 k_uniqueness
);
1469 IN PRFSD_KEY_ON_DISK pKeyOnDisk
,
1470 IN RFSD_KEY_VERSION KeyVersion
,
1471 IN OUT PRFSD_KEY_IN_MEMORY pKeyInMemory
);
1473 RFSD_KEY_VERSION
DetermineOnDiskKeyFormat(const PRFSD_KEY_ON_DISK key
);
1477 IN PRFSD_KEY_IN_MEMORY a
,
1478 IN PRFSD_KEY_IN_MEMORY b
);
1481 CompareKeysWithoutOffset(
1482 IN PRFSD_KEY_IN_MEMORY a
,
1483 IN PRFSD_KEY_IN_MEMORY b
);
1487 IN PRFSD_KEY_IN_MEMORY a
,
1488 IN PRFSD_KEY_IN_MEMORY b
);
1493 IN PRFSD_KEY_IN_MEMORY Key
,
1494 IN ULONG StartingBlockNumber
,
1495 OUT PULONG out_NextBlockNumber
);
1498 RfsdParseFilesystemTree(
1500 IN PRFSD_KEY_IN_MEMORY Key
, // Key to search for.
1501 IN ULONG StartingBlockNumber
, // Block number of an internal or leaf node, to start the search from
1502 IN
RFSD_CALLBACK(fpDirectoryCallback
), // A function ptr to trigger on hitting a matching leaf block
1508 _NavigateToLeafNode(
1510 IN PRFSD_KEY_IN_MEMORY Key
,
1511 IN ULONG StartingBlockNumber
,
1512 OUT PULONG out_NextBlockNumber
,
1513 IN BOOLEAN ReturnOnFirstMatch
,
1514 IN
RFSD_KEY_COMPARISON (*fpComparisonFunction
)(PRFSD_KEY_IN_MEMORY
, PRFSD_KEY_IN_MEMORY
),
1515 RFSD_CALLBACK(fpDirectoryCallback
),
1525 FAST_IO_CHECK_IF_POSSIBLE RfsdFastIoCheckIfPossible
;
1529 RfsdFastIoCheckIfPossible (
1530 IN PFILE_OBJECT FileObject
,
1531 IN PLARGE_INTEGER FileOffset
,
1535 IN BOOLEAN CheckForReadOperation
,
1536 OUT PIO_STATUS_BLOCK IoStatus
,
1537 IN PDEVICE_OBJECT DeviceObject
);
1540 FAST_IO_READ RfsdFastIoRead
;
1544 RfsdFastIoRead (IN PFILE_OBJECT FileObject
,
1545 IN PLARGE_INTEGER FileOffset
,
1550 OUT PIO_STATUS_BLOCK IoStatus
,
1551 IN PDEVICE_OBJECT DeviceObject
);
1554 FAST_IO_WRITE RfsdFastIoWrite
;
1559 IN PFILE_OBJECT FileObject
,
1560 IN PLARGE_INTEGER FileOffset
,
1565 OUT PIO_STATUS_BLOCK IoStatus
,
1566 IN PDEVICE_OBJECT DeviceObject
);
1569 FAST_IO_QUERY_BASIC_INFO RfsdFastIoQueryBasicInfo
;
1573 RfsdFastIoQueryBasicInfo (
1574 IN PFILE_OBJECT FileObject
,
1576 OUT PFILE_BASIC_INFORMATION Buffer
,
1577 OUT PIO_STATUS_BLOCK IoStatus
,
1578 IN PDEVICE_OBJECT DeviceObject
);
1581 FAST_IO_QUERY_STANDARD_INFO RfsdFastIoQueryStandardInfo
;
1585 RfsdFastIoQueryStandardInfo (
1586 IN PFILE_OBJECT FileObject
,
1588 OUT PFILE_STANDARD_INFORMATION Buffer
,
1589 OUT PIO_STATUS_BLOCK IoStatus
,
1590 IN PDEVICE_OBJECT DeviceObject
);
1593 FAST_IO_LOCK RfsdFastIoLock
;
1598 IN PFILE_OBJECT FileObject
,
1599 IN PLARGE_INTEGER FileOffset
,
1600 IN PLARGE_INTEGER Length
,
1601 IN PEPROCESS Process
,
1603 IN BOOLEAN FailImmediately
,
1604 IN BOOLEAN ExclusiveLock
,
1605 OUT PIO_STATUS_BLOCK IoStatus
,
1606 IN PDEVICE_OBJECT DeviceObject
1610 FAST_IO_UNLOCK_SINGLE RfsdFastIoUnlockSingle
;
1614 RfsdFastIoUnlockSingle (
1615 IN PFILE_OBJECT FileObject
,
1616 IN PLARGE_INTEGER FileOffset
,
1617 IN PLARGE_INTEGER Length
,
1618 IN PEPROCESS Process
,
1620 OUT PIO_STATUS_BLOCK IoStatus
,
1621 IN PDEVICE_OBJECT DeviceObject
1625 FAST_IO_UNLOCK_ALL RfsdFastIoUnlockAll
;
1629 RfsdFastIoUnlockAll (
1630 IN PFILE_OBJECT FileObject
,
1631 IN PEPROCESS Process
,
1632 OUT PIO_STATUS_BLOCK IoStatus
,
1633 IN PDEVICE_OBJECT DeviceObject
1637 FAST_IO_UNLOCK_ALL_BY_KEY RfsdFastIoUnlockAllByKey
;
1641 RfsdFastIoUnlockAllByKey (
1642 IN PFILE_OBJECT FileObject
,
1646 IN PEPROCESS Process
,
1649 OUT PIO_STATUS_BLOCK IoStatus
,
1650 IN PDEVICE_OBJECT DeviceObject
1654 FAST_IO_QUERY_NETWORK_OPEN_INFO RfsdFastIoQueryNetworkOpenInfo
;
1658 RfsdFastIoQueryNetworkOpenInfo (
1659 IN PFILE_OBJECT FileObject
,
1661 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer
,
1662 OUT PIO_STATUS_BLOCK IoStatus
,
1663 IN PDEVICE_OBJECT DeviceObject
);
1672 RfsdQueryInformation (IN PRFSD_IRP_CONTEXT IrpContext
);
1675 RfsdSetInformation (IN PRFSD_IRP_CONTEXT IrpContext
);
1679 PRFSD_IRP_CONTEXT IrpContext
,
1682 PLARGE_INTEGER AllocationSize
);
1686 PRFSD_IRP_CONTEXT IrpContext
,
1689 PLARGE_INTEGER AllocationSize
);
1692 RfsdSetDispositionInfo(
1693 PRFSD_IRP_CONTEXT IrpContext
,
1700 PRFSD_IRP_CONTEXT IrpContext
,
1706 PRFSD_IRP_CONTEXT IrpContext
,
1716 RfsdFlushFiles (IN PRFSD_VCB Vcb
, BOOLEAN bShutDown
);
1719 RfsdFlushVolume (IN PRFSD_VCB Vcb
, BOOLEAN bShutDown
);
1722 RfsdFlushFile (IN PRFSD_FCB Fcb
);
1725 RfsdFlush (IN PRFSD_IRP_CONTEXT IrpContext
);
1734 RfsdSetVpbFlag (IN PVPB Vpb
,
1738 RfsdClearVpbFlag (IN PVPB Vpb
,
1743 IN PRFSD_IRP_CONTEXT IrpContext
,
1745 IN BOOLEAN bForce
);
1747 __drv_mustHoldCriticalRegion
1749 RfsdPurgeVolume (IN PRFSD_VCB Vcb
,
1750 IN BOOLEAN FlushBeforePurge
);
1752 __drv_mustHoldCriticalRegion
1754 RfsdPurgeFile (IN PRFSD_FCB Fcb
,
1755 IN BOOLEAN FlushBeforePurge
);
1758 RfsdIsHandleCountZero(IN PRFSD_VCB Vcb
);
1761 RfsdLockVcb (IN PRFSD_VCB Vcb
,
1762 IN PFILE_OBJECT FileObject
);
1765 RfsdLockVolume (IN PRFSD_IRP_CONTEXT IrpContext
);
1768 RfsdUnlockVcb (IN PRFSD_VCB Vcb
,
1769 IN PFILE_OBJECT FileObject
);
1772 RfsdUnlockVolume (IN PRFSD_IRP_CONTEXT IrpContext
);
1775 RfsdAllowExtendedDasdIo(IN PRFSD_IRP_CONTEXT IrpContext
);
1778 RfsdUserFsRequest (IN PRFSD_IRP_CONTEXT IrpContext
);
1781 RfsdMountVolume (IN PRFSD_IRP_CONTEXT IrpContext
);
1784 RfsdVerifyVolume (IN PRFSD_IRP_CONTEXT IrpContext
);
1786 __drv_mustHoldCriticalRegion
1788 RfsdIsVolumeMounted (IN PRFSD_IRP_CONTEXT IrpContext
);
1790 __drv_mustHoldCriticalRegion
1792 RfsdDismountVolume (IN PRFSD_IRP_CONTEXT IrpContext
);
1795 RfsdFileSystemControl (IN PRFSD_IRP_CONTEXT IrpContext
);
1803 RfsdQueryParameters (IN PUNICODE_STRING RegistryPath
);
1806 DRIVER_INITIALIZE DriverEntry
;
1810 DRIVER_UNLOAD DriverUnload
;
1814 DriverUnload (IN PDRIVER_OBJECT DriverObject
);
1822 RfsdLockControl (IN PRFSD_IRP_CONTEXT IrpContext
);
1829 RfsdAllocateIrpContext (IN PDEVICE_OBJECT DeviceObject
,
1833 RfsdFreeIrpContext (IN PRFSD_IRP_CONTEXT IrpContext
);
1837 RfsdAllocateFcb (IN PRFSD_VCB Vcb
,
1838 IN PRFSD_MCB RfsdMcb
,
1839 IN PRFSD_INODE Inode
);
1842 RfsdFreeFcb (IN PRFSD_FCB Fcb
);
1845 RfsdAllocateCcb (VOID
);
1848 RfsdFreeMcb (IN PRFSD_MCB Mcb
);
1851 RfsdCreateFcbFromMcb(PRFSD_VCB Vcb
, PRFSD_MCB Mcb
);
1854 RfsdFreeCcb (IN PRFSD_CCB Ccb
);
1857 RfsdAllocateMcb ( PRFSD_VCB
,
1858 PUNICODE_STRING FileName
,
1862 RfsdSearchMcbTree( PRFSD_VCB Vcb
,
1864 PRFSD_KEY_IN_MEMORY Key
);
1867 RfsdSearchMcb( PRFSD_VCB Vcb
, PRFSD_MCB Parent
,
1868 PUNICODE_STRING FileName
);
1871 RfsdGetFullFileName( PRFSD_MCB Mcb
,
1872 PUNICODE_STRING FileName
);
1875 RfsdRefreshMcb(PRFSD_VCB Vcb
, PRFSD_MCB Mcb
);
1878 RfsdAddMcbNode( PRFSD_VCB Vcb
,
1889 RfsdFreeMcbTree(PRFSD_MCB McbTree
);
1892 RfsdCheckSetBlock( PRFSD_IRP_CONTEXT IrpContext
,
1893 PRFSD_VCB Vcb
, ULONG Block
);
1896 RfsdCheckBitmapConsistency( PRFSD_IRP_CONTEXT IrpContext
,
1900 RfsdInsertVcb(PRFSD_VCB Vcb
);
1903 RfsdRemoveVcb(PRFSD_VCB Vcb
);
1907 PRFSD_IRP_CONTEXT IrpContext
,
1909 PRFSD_SUPER_BLOCK RfsdSb
,
1910 PDEVICE_OBJECT TargetDevice
,
1911 PDEVICE_OBJECT VolumeDevice
,
1915 RfsdFreeVcb (IN PRFSD_VCB Vcb
);
1920 IN PRFSD_IRP_CONTEXT IrpContext
,
1924 RfsdUnpinRepinnedBcbs (
1925 IN PRFSD_IRP_CONTEXT IrpContext
);
1929 RfsdCompleteIrpContext (
1930 IN PRFSD_IRP_CONTEXT IrpContext
,
1931 IN NTSTATUS Status
);
1934 RfsdSyncUninitializeCacheMap (
1935 IN PFILE_OBJECT FileObject
);
1941 /** Returns the length of a string (not including a terminating null), or MaximumLength if no terminator is found within MaximumLength characters. */
1942 static inline USHORT
RfsdStringLength(PUCHAR buffer
, USHORT MaximumLength
)
1945 while ((i
< MaximumLength
) && (buffer
[i
] != '\0')) { i
++; }
1950 RfsdLog2(ULONG Value
);
1953 RfsdSysTime (IN ULONG i_time
);
1956 RfsdInodeTime (IN LARGE_INTEGER SysTime
);
1959 RfsdOEMToUnicodeSize(
1965 IN OUT PUNICODE_STRING Oem
,
1966 IN POEM_STRING Unicode
1970 RfsdUnicodeToOEMSize(
1971 IN PUNICODE_STRING Unicode
1976 IN OUT POEM_STRING Oem
,
1977 IN PUNICODE_STRING Unicode
1994 __drv_mustHoldCriticalRegion
1996 RfsdPnp(IN PRFSD_IRP_CONTEXT IrpContext
);
1998 __drv_mustHoldCriticalRegion
2001 PRFSD_IRP_CONTEXT IrpContext
,
2004 __drv_mustHoldCriticalRegion
2007 PRFSD_IRP_CONTEXT IrpContext
,
2010 __drv_mustHoldCriticalRegion
2012 RfsdPnpCancelRemove(
2013 PRFSD_IRP_CONTEXT IrpContext
,
2016 __drv_mustHoldCriticalRegion
2018 RfsdPnpSurpriseRemove(
2019 PRFSD_IRP_CONTEXT IrpContext
,
2029 IN PFILE_OBJECT FileObject
,
2030 IN PLARGE_INTEGER FileOffset
,
2034 OUT PIO_STATUS_BLOCK IoStatus
);
2039 IN PRFSD_IRP_CONTEXT IrpContext
,
2041 IN PRFSD_KEY_IN_MEMORY Key
,
2042 IN PRFSD_INODE Inode
,
2043 IN ULONGLONG Offset
,
2050 RfsdRead (IN PRFSD_IRP_CONTEXT IrpContext
);
2057 RfsdShutDown (IN PRFSD_IRP_CONTEXT IrpContext
);
2064 RfsdQueryVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext
);
2067 RfsdSetVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext
);
2076 IN PRFSD_IRP_CONTEXT IrpContext
,
2079 IN PRFSD_INODE Inode
,
2080 IN ULONGLONG Offset
,
2083 IN BOOLEAN bWriteToDisk
,
2088 RfsdStartFloppyFlushDpc (
2091 PFILE_OBJECT FileObject
);
2095 IN PRFSD_IRP_CONTEXT IrpContext
,
2097 IN PFILE_OBJECT FileObject
,
2099 IN LONGLONG Count
);
2102 RfsdWrite (IN PRFSD_IRP_CONTEXT IrpContext
);
2104 #endif /* _RFSD_HEADER_ */