2f36e786c47634a45bcc9e0387036aab5899bbc9
[reactos.git] / drivers / filesystems / reiserfs / inc / rfsd.h
1 /*
2 * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3 * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4 * FILE: rfsd.h
5 * PURPOSE: Header file: rfsd structures.
6 * PROGRAMMER: Mark Piper, Matt Wu, Bo Brantén.
7 * HOMEPAGE:
8 * UPDATE HISTORY:
9 */
10
11 #ifndef _RFSD_HEADER_
12 #define _RFSD_HEADER_
13
14 #ifdef _MSC_VER
15 #ifndef _PREFAST_
16 #pragma warning(disable:4068)
17 #define __drv_mustHoldCriticalRegion
18 #endif // !_PREFAST_
19 #endif
20
21 /* INCLUDES *************************************************************/
22
23 #include <linux/module.h>
24 //#include <linux/reiserfs_fs.h> // Full ReiserFS header
25 #include "reiserfs.h" // Simplified ReiserFS header
26 #ifdef __REACTOS__
27 #include <ndk/rtlfuncs.h>
28 #include <pseh/pseh2.h>
29 #endif
30
31 typedef struct reiserfs_super_block_v1 RFSD_SUPER_BLOCK, *PRFSD_SUPER_BLOCK;
32 typedef struct stat_data RFSD_INODE, *PRFSD_INODE;
33
34 #define RFSD_CALLBACK(name) NTSTATUS(* name )(ULONG BlockNumber, PVOID pContext)
35
36
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;
43
44 #define RFSD_NAME_LEN 255 /// Default length of buffers for filenames (although filenames may be longer)
45
46 #define SUPER_BLOCK_OFFSET REISERFS_DISK_OFFSET_IN_BYTES
47 #define SUPER_BLOCK_SIZE sizeof(RFSD_SUPER_BLOCK)
48
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)
53
54 typedef short RFSD_KEY_COMPARISON;
55 typedef __u16 RFSD_KEY_VERSION;
56
57 #define RFSD_KEY_VERSION_1 0
58 #define RFSD_KEY_VERSION_2 1
59 #define RFSD_KEY_VERSION_UNKNOWN 7
60
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
65
66
67 #define RFSD_LEAF_BLOCK_LEVEL 1
68
69 #include <ntdddisk.h>
70
71 #pragma pack(1)
72
73 /* DEBUG ****************************************************************/
74 #if DBG
75 #define DbgBreak() DbgPrint("rfsd: breakpoint requested.\n");DbgBreakPoint()
76 #else
77 #define DbgBreak() DbgPrint("rfsd: breakpoint ignored.\n")
78 #endif
79
80 /* STRUCTS & CONSTS******************************************************/
81
82 #define RFSD_VERSION "0.26"
83
84 //
85 // Rfsd build options
86 //
87
88 // To build read-only driver
89
90 #define RFSD_READ_ONLY TRUE
91
92 // To support driver dynamics unload
93
94 #define RFSD_UNLOAD TRUE
95
96 // The Pool Tag
97
98 #define RFSD_POOL_TAG 'dsfR'
99
100 //
101 // Constants
102 //
103
104 #define RFSD_BLOCK_TYPES (0x04)
105
106 #define MAXIMUM_RECORD_LENGTH (0x10000)
107
108 #define SECTOR_BITS (Vcb->SectorBits)
109 #define SECTOR_SIZE (Vcb->DiskGeometry.BytesPerSector)
110 #define DEFAULT_SECTOR_SIZE (0x200)
111
112 #define READ_AHEAD_GRANULARITY (0x10000)
113
114 #define SUPER_BLOCK (Vcb->SuperBlock)
115
116 #define BLOCK_SIZE (Vcb->BlockSize)
117 #define BLOCK_BITS (SUPER_BLOCK->s_log_block_size + 10)
118
119 #define INODES_COUNT (Vcb->SuperBlock->s_inodes_count)
120
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)
124
125 #define RFSD_FIRST_DATA_BLOCK (SUPER_BLOCK->s_first_data_block)
126
127
128
129 #define CEILING_ALIGNED(A, B) (((A) + (B) - 1) & (~((B) - 1)))
130
131
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__)
137
138
139 /* File System Releated *************************************************/
140
141 #define DRIVER_NAME "Rfsd"
142 #define DEVICE_NAME L"\\Rfsd"
143
144 // Registry
145
146 #define PARAMETERS_KEY L"\\Parameters"
147
148 #define WRITING_SUPPORT L"WritingSupport"
149 #define CHECKING_BITMAP L"CheckingBitmap"
150 #define EXT3_FORCEWRITING L"Ext3ForceWriting"
151 #define EXT3_CODEPAGE L"CodePage"
152
153 // To support rfsd unload routine
154 #if RFSD_UNLOAD
155
156 #define DOS_DEVICE_NAME L"\\DosDevices\\Rfsd"
157
158 //
159 // Private IOCTL to make the driver ready to unload
160 //
161 #define IOCTL_PREPARE_TO_UNLOAD \
162 CTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_NEITHER, FILE_WRITE_ACCESS)
163
164 #endif // RFSD_UNLOAD
165
166 #ifndef SetFlag
167 #define SetFlag(x,f) ((x) |= (f))
168 #endif
169
170 #ifndef ClearFlag
171 #define ClearFlag(x,f) ((x) &= ~(f))
172 #endif
173
174 #define IsFlagOn(a,b) ((BOOLEAN)(FlagOn(a,b) == b))
175
176 #define RfsdRaiseStatus(IRPCONTEXT,STATUS) { \
177 (IRPCONTEXT)->ExceptionCode = (STATUS); \
178 ExRaiseStatus( (STATUS) ); \
179 }
180
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)); \
185 }
186
187 //
188 // Define IsEndofFile for read and write operations
189 //
190
191 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
192 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
193
194 #define IsEndOfFile(Pos) ((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
195 (Pos.HighPart == FILE_USE_FILE_POINTER_POSITION ))
196
197 #define IsDirectory(Fcb) IsFlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
198
199 //
200 // Bug Check Codes Definitions
201 //
202
203 #define RFSD_FILE_SYSTEM (FILE_SYSTEM)
204
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)
228
229 #define RFSD_BUGCHK_LAST (0x00170000)
230
231 #define RfsdBugCheck(A,B,C,D) { KeBugCheckEx(RFSD_FILE_SYSTEM, A | __LINE__, B, C, D ); }
232
233
234 /* Rfsd file system definions *******************************************/
235
236 #define RFSD_MIN_BLOCK 1024
237 #define RFSD_MIN_FRAG 1024
238
239 //
240 // Inode flags (Linux uses octad number, but why ? strange!!!)
241 //
242
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 */
254
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)
263
264 #define S_IPERMISSION_MASK 0x1FF /* */
265
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 */
270
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 */
275
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 */
280
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)
286
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))
289
290 #define RfsdSetReadable(m) (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))
291 #define RfsdSetWritable(m) (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))
292
293 #define RfsdSetReadOnly(m) (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))
294 #define RfsdIsReadOnly(m) (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))
295
296 //
297 // Inode state bits
298 //
299
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 */
303 #define I_LOCK 8
304 #define I_FREEING 16
305 #define I_CLEAR 32
306
307 #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
308
309
310 //
311 // Rfsd Driver Definitions
312 //
313
314 //
315 // RFSD_IDENTIFIER_TYPE
316 //
317 // Identifiers used to mark the structures
318 //
319
320 typedef enum _RFSD_IDENTIFIER_TYPE {
321 RFSDFGD = ':DGF',
322 RFSDVCB = ':BCV',
323 RFSDFCB = ':BCF',
324 RFSDCCB = ':BCC',
325 RFSDICX = ':XCI',
326 RFSDMCB = ':BCM'
327 } RFSD_IDENTIFIER_TYPE;
328
329 //
330 // RFSD_IDENTIFIER
331 //
332 // Header used to mark the structures
333 //
334 typedef struct _RFSD_IDENTIFIER {
335 RFSD_IDENTIFIER_TYPE Type;
336 ULONG Size;
337 } RFSD_IDENTIFIER, *PRFSD_IDENTIFIER;
338
339
340 #define NodeType(Ptr) (*((RFSD_IDENTIFIER_TYPE *)(Ptr)))
341
342 typedef struct _RFSD_MCB RFSD_MCB, *PRFSD_MCB;
343
344
345 typedef PVOID PBCB;
346
347 //
348 // REPINNED_BCBS List
349 //
350
351 #define RFSD_REPINNED_BCBS_ARRAY_SIZE (8)
352
353 typedef struct _RFSD_REPINNED_BCBS {
354
355 //
356 // A pointer to the next structure contains additional repinned bcbs
357 //
358
359 struct _RFSD_REPINNED_BCBS *Next;
360
361 //
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.
366 //
367
368 PBCB Bcb[ RFSD_REPINNED_BCBS_ARRAY_SIZE ];
369
370 } RFSD_REPINNED_BCBS, *PRFSD_REPINNED_BCBS;
371
372
373 #define CODEPAGE_MAXLEN 0x20
374
375 //
376 // RFSD_GLOBAL_DATA
377 //
378 // Data that is not specific to a mounted volume
379 //
380
381 typedef struct _RFSD_GLOBAL {
382
383 // Identifier for this structure
384 RFSD_IDENTIFIER Identifier;
385
386 // Syncronization primitive for this structure
387 ERESOURCE Resource;
388
389 // Syncronization primitive for Counting
390 ERESOURCE CountResource;
391
392 // Syncronization primitive for LookAside Lists
393 ERESOURCE LAResource;
394
395 // Table of pointers to the fast I/O entry points
396 FAST_IO_DISPATCH FastIoDispatch;
397
398 // Table of pointers to the Cache Manager callbacks
399 CACHE_MANAGER_CALLBACKS CacheManagerCallbacks;
400 CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks;
401
402 // Pointer to the driver object
403 PDRIVER_OBJECT DriverObject;
404
405 // Pointer to the main device object
406 PDEVICE_OBJECT DeviceObject;
407
408 // List of mounted volumes
409 LIST_ENTRY VcbList;
410
411 // Look Aside table of IRP_CONTEXT, FCB, MCB, CCB
412 USHORT MaxDepth;
413 NPAGED_LOOKASIDE_LIST RfsdIrpContextLookasideList;
414 NPAGED_LOOKASIDE_LIST RfsdFcbLookasideList;
415 NPAGED_LOOKASIDE_LIST RfsdCcbLookasideList;
416 PAGED_LOOKASIDE_LIST RfsdMcbLookasideList;
417
418 // Mcb Count ...
419 USHORT McbAllocated;
420
421 #if DBG
422 // Fcb Count
423 USHORT FcbAllocated;
424
425 // IRP_MJ_CLOSE : FCB
426 USHORT IRPCloseCount;
427 #endif
428
429 // Global flags for the driver
430 ULONG Flags;
431
432 // User specified codepage name
433 struct {
434 WCHAR UniName[CODEPAGE_MAXLEN];
435 UCHAR AnsiName[CODEPAGE_MAXLEN];
436 struct nls_table * PageTable;
437 } CodePage;
438
439 } RFSD_GLOBAL, *PRFSD_GLOBAL;
440
441 #define PAGE_TABLE RfsdGlobal->CodePage.PageTable
442
443 //
444 // Flags for RFSD_GLOBAL_DATA
445 //
446 #define RFSD_UNLOAD_PENDING 0x00000001
447 #define RFSD_SUPPORT_WRITING 0x00000002
448 #define EXT3_FORCE_WRITING 0x00000004
449 #define RFSD_CHECKING_BITMAP 0x00000008
450
451 //
452 // Driver Extension define
453 //
454 typedef struct {
455 RFSD_GLOBAL RfsdGlobal;
456 } RFSDFS_EXT, *PRFSDFS_EXT;
457
458
459 typedef struct _RFSD_FCBVCB {
460
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
467
468 // Identifier for this structure
469 RFSD_IDENTIFIER Identifier;
470 } RFSD_FCBVCB, *PRFSD_FCBVCB;
471
472 //
473 // RFSD_VCB Volume Control Block
474 //
475 // Data that represents a mounted logical volume
476 // It is allocated as the device extension of the volume device object
477 //
478 typedef struct _RFSD_VCB {
479
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
488
489 // Identifier for this structure
490 RFSD_IDENTIFIER Identifier;
491
492 LIST_ENTRY Next;
493
494 // Share Access for the file object
495 SHARE_ACCESS ShareAccess;
496
497 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
498 // for files on this volume.
499 ULONG OpenFileHandleCount;
500
501 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
502 // for both files on this volume and open instances of the
503 // volume itself.
504 ULONG ReferenceCount;
505 ULONG OpenHandleCount;
506
507 //
508 // Disk change count
509 //
510
511 ULONG ChangeCount;
512
513 // Pointer to the VPB in the target device object
514 PVPB Vpb;
515
516 // The FileObject of Volume used to lock the volume
517 PFILE_OBJECT LockFile;
518
519 // List of FCBs for open files on this volume
520 LIST_ENTRY FcbList;
521
522 // List of IRPs pending on directory change notify requests
523 LIST_ENTRY NotifyList;
524
525 // Pointer to syncronization primitive for this list
526 PNOTIFY_SYNC NotifySync;
527
528 // This volumes device object
529 PDEVICE_OBJECT DeviceObject;
530
531 // The physical device object (the disk)
532 PDEVICE_OBJECT TargetDeviceObject;
533
534 // The physical device object (the disk)
535 PDEVICE_OBJECT RealDevice;
536
537 // Information about the physical device object
538 DISK_GEOMETRY DiskGeometry;
539 PARTITION_INFORMATION PartitionInformation;
540
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;
544
545 // Number of Group Decsciptions
546 ULONG NumOfGroups;
547 /*
548 // Bitmap Block per group
549 PRTL_BITMAP BlockBitMaps;
550 PRTL_BITMAP InodeBitMaps;
551 */
552 // Block / Cluster size
553 ULONG BlockSize;
554
555 // Sector size in bits (NOTE: unused in ReiserFS)
556 //ULONG SectorBits;
557
558 ULONG dwData[RFSD_BLOCK_TYPES];
559 ULONG dwMeta[RFSD_BLOCK_TYPES];
560
561 // Flags for the volume
562 ULONG Flags;
563
564 // Streaming File Object
565 PFILE_OBJECT StreamObj;
566
567 // Resource Lock for Mcb
568 ERESOURCE McbResource;
569
570 // Dirty Mcbs of modifications for volume stream
571 LARGE_MCB DirtyMcbs;
572
573 // Entry of Mcb Tree (Root Node)
574 PRFSD_MCB McbTree;
575 LIST_ENTRY McbList;
576
577 } RFSD_VCB, *PRFSD_VCB;
578
579 //
580 // Flags for RFSD_VCB
581 //
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
587
588 #define VCB_WRITE_PROTECTED 0x10000000
589 #define VCB_FLOPPY_DISK 0x20000000
590 #define VCB_REMOVAL_PREVENTED 0x40000000
591 #define VCB_REMOVABLE_MEDIA 0x80000000
592
593
594 #define IsMounted(Vcb) (IsFlagOn(Vcb->Flags, VCB_MOUNTED))
595
596 //
597 // RFSD_FCB File Control Block
598 //
599 // Data that represents an open file
600 // There is a single instance of the FCB for every open file
601 //
602 typedef struct _RFSD_FCB {
603
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
610
611 // Identifier for this structure
612 RFSD_IDENTIFIER Identifier;
613
614 // List of FCBs for this volume
615 LIST_ENTRY Next;
616
617 // Share Access for the file object
618 SHARE_ACCESS ShareAccess;
619
620 // List of byte-range locks for this file
621 FILE_LOCK FileLockAnchor;
622
623 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
624 ULONG OpenHandleCount;
625
626 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
627 ULONG ReferenceCount;
628
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;
632
633 // Flags for the FCB
634 ULONG Flags;
635
636 // Pointer to the inode / stat data structure
637 PRFSD_INODE Inode;
638
639 // Hint block for next allocation
640 ULONG BlkHint;
641
642 // Vcb
643
644 PRFSD_VCB Vcb;
645
646 // Mcb Node ...
647 PRFSD_MCB RfsdMcb;
648
649 // Full Path Name
650 UNICODE_STRING LongName;
651
652 #if DBG
653 // The Ansi Filename for debugging
654 OEM_STRING AnsiFileName;
655 #endif
656
657
658 } RFSD_FCB, *PRFSD_FCB;
659
660
661 //
662 // Flags for RFSD_FCB
663 //
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
670
671 // Mcb Node
672
673 struct _RFSD_MCB {
674
675 // Identifier for this structure
676 RFSD_IDENTIFIER Identifier;
677
678 // Flags
679 ULONG Flags;
680
681 // Link List Info
682
683 PRFSD_MCB Parent; // Parent
684 PRFSD_MCB Child; // Children
685 PRFSD_MCB Next; // Brothers
686
687 // Mcb Node Info
688
689 // -> Fcb
690 PRFSD_FCB RfsdFcb;
691
692 // Short name
693 UNICODE_STRING ShortName;
694
695 // Inode number (ReiserFS uses 128-bit keys instead of inode numbers)
696 RFSD_KEY_IN_MEMORY Key;
697
698 // Dir entry offset in parent (relative to the start of the directory listing)
699 ULONG DeOffset;
700
701 // File attribute
702 ULONG FileAttr;
703
704 // List Link to Vcb->McbList
705 LIST_ENTRY Link;
706 };
707
708 //
709 // Flags for MCB
710 //
711 #define MCB_FROM_POOL 0x00000001
712 #define MCB_IN_TREE 0x00000002
713 #define MCB_IN_USE 0x00000004
714
715 #define IsMcbUsed(Mcb) IsFlagOn(Mcb->Flags, MCB_IN_USE)
716
717 //
718 // RFSD_CCB Context Control Block
719 //
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
722 //
723 typedef struct _RFSD_CCB {
724
725 // Identifier for this structure
726 RFSD_IDENTIFIER Identifier;
727
728 // Flags
729 ULONG Flags;
730
731 // State that may need to be maintained
732 ULONG CurrentByteOffset;
733 USHORT deh_location;
734 UNICODE_STRING DirectorySearchPattern;
735
736 } RFSD_CCB, *PRFSD_CCB;
737
738 //
739 // Flags for CCB
740 //
741
742 #define CCB_FROM_POOL 0x00000001
743
744 #define CCB_ALLOW_EXTENDED_DASD_IO 0x80000000
745
746 //
747 // RFSD_IRP_CONTEXT
748 //
749 // Used to pass information about a request between the drivers functions
750 //
751 typedef struct _RFSD_IRP_CONTEXT {
752
753 // Identifier for this structure
754 RFSD_IDENTIFIER Identifier;
755
756 // Pointer to the IRP this request describes
757 PIRP Irp;
758
759 // Flags
760 ULONG Flags;
761
762 // The major and minor function code for the request
763 UCHAR MajorFunction;
764 UCHAR MinorFunction;
765
766 // The device object
767 PDEVICE_OBJECT DeviceObject;
768
769 // The real device object
770 PDEVICE_OBJECT RealDevice;
771
772 // The file object
773 PFILE_OBJECT FileObject;
774
775 PRFSD_FCB Fcb;
776 PRFSD_CCB Ccb;
777
778 // If the request is synchronous (we are allowed to block)
779 BOOLEAN IsSynchronous;
780
781 // If the request is top level
782 BOOLEAN IsTopLevel;
783
784 // Used if the request needs to be queued for later processing
785 WORK_QUEUE_ITEM WorkQueueItem;
786
787 // If an exception is currently in progress
788 BOOLEAN ExceptionInProgress;
789
790 // The exception code when an exception is in progress
791 NTSTATUS ExceptionCode;
792
793 // Repinned BCBs List
794 RFSD_REPINNED_BCBS Repinned;
795
796 } RFSD_IRP_CONTEXT, *PRFSD_IRP_CONTEXT;
797
798
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)
811
812 //
813 // RFSD_ALLOC_HEADER
814 //
815 // In the checked version of the driver this header is put in the beginning of
816 // every memory allocation
817 //
818 typedef struct _RFSD_ALLOC_HEADER {
819 RFSD_IDENTIFIER Identifier;
820 } RFSD_ALLOC_HEADER, *PRFSD_ALLOC_HEADER;
821
822 typedef struct _FCB_LIST_ENTRY {
823 PRFSD_FCB Fcb;
824 LIST_ENTRY Next;
825 } FCB_LIST_ENTRY, *PFCB_LIST_ENTRY;
826
827
828 // Block Description List
829 typedef struct _RFSD_BDL {
830 ULONGLONG Lba;
831 ULONGLONG Offset;
832 ULONG Length;
833 PIRP Irp;
834 } RFSD_BDL, *PRFSD_BDL;
835
836 #pragma pack()
837
838
839 /* FUNCTIONS DECLARATION *****************************************************/
840
841 //
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.
846 //
847
848 #define CanRfsdWait(IRP) IoIsOperationSynchronous(Irp)
849
850 #ifndef max
851 #define max(a,b) (((a) > (b)) ? (a) : (b))
852 #endif
853
854 #ifndef min
855 #define min(a,b) (((a) < (b)) ? (a) : (b))
856 #endif
857
858 //
859 // RfsdBlock.c
860 //
861
862 // TODO move allocate and load block here
863
864 NTSTATUS
865 RfsdFindItemHeaderInBlock(
866 IN PRFSD_VCB Vcb,
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)
871 );
872
873 NTSTATUS
874 RfsdLoadItem(
875 IN PRFSD_VCB Vcb,
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)
882 );
883 //
884 // Block.c
885 //
886
887 NTSTATUS
888 RfsdLockUserBuffer (
889 IN PIRP Irp,
890 IN ULONG Length,
891 IN LOCK_OPERATION Operation);
892 PVOID
893 RfsdGetUserBuffer (IN PIRP Irp);
894
895
896 NTSTATUS
897 RfsdReadWriteBlocks(
898 IN PRFSD_IRP_CONTEXT IrpContext,
899 IN PRFSD_VCB Vcb,
900 IN PRFSD_BDL RfsdBDL,
901 IN ULONG Length,
902 IN ULONG Count,
903 IN BOOLEAN bVerify );
904
905 PUCHAR
906 RfsdAllocateAndLoadBlock(
907 IN PRFSD_VCB Vcb,
908 IN ULONG BlockIndex );
909
910 NTSTATUS
911 RfsdReadSync(
912 IN PRFSD_VCB Vcb,
913 IN ULONGLONG Offset,
914 IN ULONG Length,
915 OUT PVOID Buffer,
916 IN BOOLEAN bVerify );
917
918 NTSTATUS
919 RfsdReadDisk(
920 IN PRFSD_VCB Vcb,
921 IN ULONGLONG Offset,
922 IN ULONG Size,
923 IN PVOID Buffer,
924 IN BOOLEAN bVerify );
925
926 NTSTATUS
927 RfsdDiskIoControl (
928 IN PDEVICE_OBJECT DeviceOjbect,
929 IN ULONG IoctlCode,
930 IN PVOID InputBuffer,
931 IN ULONG InputBufferSize,
932 IN OUT PVOID OutputBuffer,
933 IN OUT PULONG OutputBufferSize );
934
935 VOID
936 RfsdMediaEjectControl (
937 IN PRFSD_IRP_CONTEXT IrpContext,
938 IN PRFSD_VCB Vcb,
939 IN BOOLEAN bPrevent );
940
941 NTSTATUS
942 RfsdDiskShutDown(PRFSD_VCB Vcb);
943
944
945 //
946 // Cleanup.c
947 //
948 NTSTATUS
949 RfsdCleanup (IN PRFSD_IRP_CONTEXT IrpContext);
950
951 //
952 // Close.c
953 //
954 NTSTATUS
955 RfsdClose (IN PRFSD_IRP_CONTEXT IrpContext);
956
957 VOID
958 RfsdQueueCloseRequest (IN PRFSD_IRP_CONTEXT IrpContext);
959
960 #ifdef _PREFAST_
961 IO_WORKITEM_ROUTINE RfsdDeQueueCloseRequest;
962 #endif // _PREFAST_
963
964 VOID NTAPI
965 RfsdDeQueueCloseRequest (IN PVOID Context);
966
967 //
968 // Cmcb.c
969 //
970
971 BOOLEAN NTAPI
972 RfsdAcquireForLazyWrite (
973 IN PVOID Context,
974 IN BOOLEAN Wait );
975 VOID NTAPI
976 RfsdReleaseFromLazyWrite (IN PVOID Context);
977
978 BOOLEAN NTAPI
979 RfsdAcquireForReadAhead (
980 IN PVOID Context,
981 IN BOOLEAN Wait );
982
983 BOOLEAN NTAPI
984 RfsdNoOpAcquire (
985 IN PVOID Fcb,
986 IN BOOLEAN Wait );
987
988 VOID NTAPI
989 RfsdNoOpRelease (IN PVOID Fcb );
990
991 VOID NTAPI
992 RfsdReleaseFromReadAhead (IN PVOID Context);
993
994 //
995 // Create.c
996 //
997
998 PRFSD_FCB
999 RfsdSearchFcbList(
1000 IN PRFSD_VCB Vcb,
1001 IN ULONG inode);
1002
1003 NTSTATUS
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
1009
1010 NTSTATUS
1011 RfsdLookupFileName (
1012 IN PRFSD_VCB Vcb,
1013 IN PUNICODE_STRING FullFileName,
1014 IN PRFSD_MCB ParentMcb,
1015 OUT PRFSD_MCB * RfsdMcb,
1016 IN OUT PRFSD_INODE Inode);
1017
1018 NTSTATUS
1019 RfsdCreateFile(
1020 IN PRFSD_IRP_CONTEXT IrpContext,
1021 IN PRFSD_VCB Vcb );
1022
1023 NTSTATUS
1024 RfsdCreateVolume(
1025 IN PRFSD_IRP_CONTEXT IrpContext,
1026 IN PRFSD_VCB Vcb );
1027
1028 NTSTATUS
1029 RfsdCreate (IN PRFSD_IRP_CONTEXT IrpContext);
1030
1031 NTSTATUS
1032 RfsdCreateInode(
1033 IN PRFSD_IRP_CONTEXT IrpContext,
1034 IN PRFSD_VCB Vcb,
1035 IN PRFSD_FCB pParentFcb,
1036 IN ULONG Type,
1037 IN ULONG FileAttr,
1038 IN PUNICODE_STRING FileName);
1039
1040 NTSTATUS
1041 RfsdSupersedeOrOverWriteFile(
1042 IN PRFSD_IRP_CONTEXT IrpContext,
1043 IN PRFSD_VCB Vcb,
1044 IN PRFSD_FCB Fcb,
1045 IN ULONG Disposition);
1046
1047 //
1048 // Debug.c
1049 //
1050
1051 #define DBG_VITAL 0
1052 #define DBG_ERROR 1
1053 #define DBG_USER 2
1054 #define DBG_TRACE 3
1055 #define DBG_INFO 4
1056 #define DBG_FUNC 5
1057
1058 #if DBG
1059 #define RfsdPrint(arg) RfsdPrintf arg
1060 #define RfsdPrintNoIndent(arg) RfsdNIPrintf arg
1061
1062 #define RfsdCompleteRequest(Irp, bPrint, PriorityBoost) \
1063 RfsdDbgPrintComplete(Irp, bPrint); \
1064 IoCompleteRequest(Irp, PriorityBoost)
1065
1066 #else
1067
1068 #define RfsdPrint(arg)
1069 #define RfsdPrintNoIndent(arg)
1070
1071 #define RfsdCompleteRequest(Irp, bPrint, PriorityBoost) \
1072 IoCompleteRequest(Irp, PriorityBoost)
1073
1074 #endif // DBG
1075
1076 VOID
1077 __cdecl
1078 RfsdPrintf(
1079 LONG DebugPrintLevel,
1080 PCHAR DebugMessage,
1081 ...
1082 );
1083
1084 VOID
1085 __cdecl
1086 RfsdNIPrintf(
1087 LONG DebugPrintLevel,
1088 PCHAR DebugMessage,
1089 ...
1090 );
1091
1092 extern ULONG ProcessNameOffset;
1093
1094 #define RfsdGetCurrentProcessName() ( \
1095 (PUCHAR) PsGetCurrentProcess() + ProcessNameOffset \
1096 )
1097
1098 ULONG
1099 RfsdGetProcessNameOffset (VOID);
1100
1101 VOID
1102 RfsdDbgPrintCall (
1103 IN PDEVICE_OBJECT DeviceObject,
1104 IN PIRP Irp );
1105
1106 VOID
1107 RfsdDbgPrintComplete (
1108 IN PIRP Irp,
1109 IN BOOLEAN bPrint
1110 );
1111
1112 PUCHAR
1113 RfsdNtStatusToString (IN NTSTATUS Status );
1114
1115 //
1116 // Devctl.c
1117 //
1118
1119 NTSTATUS
1120 RfsdDeviceControlNormal (IN PRFSD_IRP_CONTEXT IrpContext);
1121
1122 NTSTATUS
1123 RfsdPrepareToUnload (IN PRFSD_IRP_CONTEXT IrpContext);
1124
1125 NTSTATUS
1126 RfsdDeviceControl (IN PRFSD_IRP_CONTEXT IrpContext);
1127
1128 //
1129 // Dirctl.c
1130 //
1131
1132 ULONG
1133 RfsdGetInfoLength(IN FILE_INFORMATION_CLASS FileInformationClass);
1134
1135 ULONG
1136 RfsdProcessDirEntry(
1137 IN PRFSD_VCB Vcb,
1138 IN FILE_INFORMATION_CLASS FileInformationClass,
1139 IN __u32 Key_ParentID,
1140 IN __u32 Key_ObjectID,
1141 IN PVOID Buffer,
1142 IN ULONG UsedLength,
1143 IN ULONG Length,
1144 IN ULONG FileIndex,
1145 IN PUNICODE_STRING pName,
1146 IN BOOLEAN Single,
1147 IN PVOID pPreviousEntry );
1148
1149 NTSTATUS
1150 RfsdQueryDirectory (IN PRFSD_IRP_CONTEXT IrpContext);
1151
1152 NTSTATUS
1153 RfsdNotifyChangeDirectory (
1154 IN PRFSD_IRP_CONTEXT IrpContext
1155 );
1156
1157 VOID
1158 RfsdNotifyReportChange (
1159 IN PRFSD_IRP_CONTEXT IrpContext,
1160 IN PRFSD_VCB Vcb,
1161 IN PRFSD_FCB Fcb,
1162 IN ULONG Filter,
1163 IN ULONG Action
1164 );
1165
1166 NTSTATUS
1167 RfsdDirectoryControl (IN PRFSD_IRP_CONTEXT IrpContext);
1168
1169 BOOLEAN
1170 RfsdIsDirectoryEmpty (
1171 IN PRFSD_VCB Vcb,
1172 IN PRFSD_FCB Fcb
1173 );
1174
1175 //
1176 // Dispatch.c
1177 //
1178
1179 NTSTATUS
1180 RfsdQueueRequest (IN PRFSD_IRP_CONTEXT IrpContext);
1181
1182 #ifdef _PREFAST_
1183 IO_WORKITEM_ROUTINE RfsdDeQueueRequest;
1184 #endif // _PREFAST_
1185
1186 VOID NTAPI
1187 RfsdDeQueueRequest (IN PVOID Context);
1188
1189 NTSTATUS
1190 RfsdDispatchRequest (IN PRFSD_IRP_CONTEXT IrpContext);
1191
1192 #ifdef _PREFAST_
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;
1210 #endif // _PREFAST_
1211
1212 NTSTATUS NTAPI
1213 RfsdBuildRequest (
1214 IN PDEVICE_OBJECT DeviceObject,
1215 IN PIRP Irp
1216 );
1217
1218 //
1219 // Except.c
1220 //
1221
1222 NTSTATUS
1223 RfsdExceptionFilter (
1224 IN PRFSD_IRP_CONTEXT IrpContext,
1225 IN PEXCEPTION_POINTERS ExceptionPointer
1226 );
1227
1228 NTSTATUS
1229 RfsdExceptionHandler (IN PRFSD_IRP_CONTEXT IrpContext);
1230
1231
1232 //
1233 // Rfsd.c
1234 //
1235
1236 PRFSD_SUPER_BLOCK
1237 RfsdLoadSuper(
1238 IN PRFSD_VCB Vcb,
1239 IN BOOLEAN bVerify
1240 );
1241
1242 BOOLEAN
1243 RfsdSaveSuper(
1244 IN PRFSD_IRP_CONTEXT IrpContext,
1245 IN PRFSD_VCB Vcb
1246 );
1247
1248 BOOLEAN
1249 RfsdLoadGroup(IN PRFSD_VCB Vcb);
1250
1251 BOOLEAN
1252 RfsdSaveGroup(
1253 IN PRFSD_IRP_CONTEXT IrpContext,
1254 IN PRFSD_VCB Vcb,
1255 IN ULONG Group
1256 );
1257
1258 BOOLEAN
1259 RfsdGetInodeLba (IN PRFSD_VCB Vcb,
1260 IN __u32 DirectoryID,
1261 IN __u32 ParentID,
1262 OUT PLONGLONG offset);
1263
1264 BOOLEAN
1265 RfsdLoadInode (IN PRFSD_VCB Vcb,
1266 IN PRFSD_KEY_IN_MEMORY pKey,
1267 IN OUT PRFSD_INODE Inode);
1268
1269 BOOLEAN
1270 RfsdLoadInode2 (IN PRFSD_VCB Vcb,
1271 IN __u32 a,
1272 IN __u32 b,
1273 IN OUT PRFSD_INODE Inode);
1274 BOOLEAN
1275 RfsdSaveInode (
1276 IN PRFSD_IRP_CONTEXT IrpContext,
1277 IN PRFSD_VCB Vcb,
1278 IN ULONG inode,
1279 IN PRFSD_INODE Inode
1280 );
1281
1282 BOOLEAN
1283 RfsdLoadBlock (
1284 IN PRFSD_VCB Vcb,
1285 IN ULONG dwBlk,
1286 IN PVOID Buffer
1287 );
1288
1289 BOOLEAN
1290 RfsdSaveBlock (
1291 IN PRFSD_IRP_CONTEXT IrpContext,
1292 IN PRFSD_VCB Vcb,
1293 IN ULONG dwBlk,
1294 IN PVOID Buf
1295 );
1296
1297 BOOLEAN
1298 RfsdSaveBuffer(
1299 IN PRFSD_IRP_CONTEXT IrpContext,
1300 IN PRFSD_VCB Vcb,
1301 IN LONGLONG Offset,
1302 IN ULONG Size,
1303 IN PVOID Buf
1304 );
1305
1306 NTSTATUS
1307 RfsdGetBlock(
1308 IN PRFSD_IRP_CONTEXT IrpContext,
1309 IN PRFSD_VCB Vcb,
1310 IN ULONG dwContent,
1311 IN ULONG Index,
1312 IN ULONG Layer,
1313 IN BOOLEAN bAlloc,
1314 OUT PULONG pBlock
1315 );
1316
1317 NTSTATUS
1318 RfsdBlockMap(
1319 IN PRFSD_IRP_CONTEXT IrpContext,
1320 IN PRFSD_VCB Vcb,
1321 IN ULONG InodeNo,
1322 IN PRFSD_INODE Inode,
1323 IN ULONG Index,
1324 IN BOOLEAN bAlloc,
1325 OUT PULONG pBlock
1326 );
1327
1328 NTSTATUS
1329 RfsdBuildBDL2(
1330 IN PRFSD_VCB Vcb,
1331 IN PRFSD_KEY_IN_MEMORY pKey,
1332 IN PRFSD_INODE pInode,
1333 OUT PULONG out_Count,
1334 OUT PRFSD_BDL* out_ppBdl );
1335
1336 NTSTATUS
1337 RfsdBuildBDL(
1338 IN PRFSD_IRP_CONTEXT IrpContext,
1339 IN PRFSD_VCB Vcb,
1340 IN PRFSD_KEY_IN_MEMORY InodeNo,
1341 IN PRFSD_INODE Inode,
1342 IN ULONGLONG Offset,
1343 IN ULONG Size,
1344 IN BOOLEAN bAlloc,
1345 OUT PRFSD_BDL * Bdls,
1346 OUT PULONG Count
1347 );
1348
1349 NTSTATUS
1350 RfsdNewBlock(
1351 PRFSD_IRP_CONTEXT IrpContext,
1352 PRFSD_VCB Vcb,
1353 ULONG GroupHint,
1354 ULONG BlockHint,
1355 PULONG dwRet );
1356
1357 NTSTATUS
1358 RfsdFreeBlock(
1359 PRFSD_IRP_CONTEXT IrpContext,
1360 PRFSD_VCB Vcb,
1361 ULONG Block );
1362
1363 NTSTATUS
1364 RfsdExpandBlock(
1365 PRFSD_IRP_CONTEXT IrpContext,
1366 PRFSD_VCB Vcb,
1367 PRFSD_FCB Fcb,
1368 ULONG dwContent,
1369 ULONG Index,
1370 ULONG layer,
1371 BOOLEAN bNew,
1372 ULONG *dwRet );
1373
1374
1375 NTSTATUS
1376 RfsdExpandInode(
1377 PRFSD_IRP_CONTEXT IrpContext,
1378 PRFSD_VCB Vcb,
1379 PRFSD_FCB Fcb,
1380 ULONG *dwRet );
1381
1382 NTSTATUS
1383 RfsdNewInode(
1384 PRFSD_IRP_CONTEXT IrpContext,
1385 PRFSD_VCB Vcb,
1386 ULONG GroupHint,
1387 ULONG mode,
1388 PULONG Inode );
1389
1390 BOOLEAN
1391 RfsdFreeInode(
1392 PRFSD_IRP_CONTEXT IrpContext,
1393 PRFSD_VCB Vcb,
1394 ULONG Inode,
1395 ULONG Type );
1396
1397 NTSTATUS
1398 RfsdAddEntry (
1399 IN PRFSD_IRP_CONTEXT IrpContext,
1400 IN PRFSD_VCB Vcb,
1401 IN PRFSD_FCB Dcb,
1402 IN ULONG FileType,
1403 IN ULONG Inode,
1404 IN PUNICODE_STRING FileName );
1405
1406 NTSTATUS
1407 RfsdRemoveEntry (
1408 IN PRFSD_IRP_CONTEXT IrpContext,
1409 IN PRFSD_VCB Vcb,
1410 IN PRFSD_FCB Dcb,
1411 IN ULONG FileType,
1412 IN ULONG Inode );
1413
1414 NTSTATUS
1415 RfsdSetParentEntry (
1416 IN PRFSD_IRP_CONTEXT IrpContext,
1417 IN PRFSD_VCB Vcb,
1418 IN PRFSD_FCB Dcb,
1419 IN ULONG OldParent,
1420 IN ULONG NewParent );
1421
1422
1423 NTSTATUS
1424 RfsdTruncateBlock(
1425 IN PRFSD_IRP_CONTEXT IrpContext,
1426 IN PRFSD_VCB Vcb,
1427 IN PRFSD_FCB Fcb,
1428 IN ULONG dwContent,
1429 IN ULONG Index,
1430 IN ULONG layer,
1431 OUT BOOLEAN *bFreed );
1432
1433 NTSTATUS
1434 RfsdTruncateInode(
1435 IN PRFSD_IRP_CONTEXT IrpContext,
1436 IN PRFSD_VCB Vcb,
1437 IN PRFSD_FCB Fcb );
1438
1439 BOOLEAN
1440 RfsdAddMcbEntry (
1441 IN PRFSD_VCB Vcb,
1442 IN LONGLONG Lba,
1443 IN LONGLONG Length );
1444
1445 VOID
1446 RfsdRemoveMcbEntry (
1447 IN PRFSD_VCB Vcb,
1448 IN LONGLONG Lba,
1449 IN LONGLONG Length );
1450
1451 BOOLEAN
1452 RfsdLookupMcbEntry (
1453 IN PRFSD_VCB Vcb,
1454 IN LONGLONG Offset,
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 );
1460
1461 BOOLEAN
1462 SuperblockContainsMagicKey(PRFSD_SUPER_BLOCK sb);
1463
1464 __u32
1465 ConvertKeyTypeUniqueness(__u32 k_uniqueness);
1466
1467 void
1468 FillInMemoryKey(
1469 IN PRFSD_KEY_ON_DISK pKeyOnDisk,
1470 IN RFSD_KEY_VERSION KeyVersion,
1471 IN OUT PRFSD_KEY_IN_MEMORY pKeyInMemory );
1472
1473 RFSD_KEY_VERSION DetermineOnDiskKeyFormat(const PRFSD_KEY_ON_DISK key);
1474
1475 RFSD_KEY_COMPARISON
1476 CompareShortKeys(
1477 IN PRFSD_KEY_IN_MEMORY a,
1478 IN PRFSD_KEY_IN_MEMORY b );
1479
1480 RFSD_KEY_COMPARISON
1481 CompareKeysWithoutOffset(
1482 IN PRFSD_KEY_IN_MEMORY a,
1483 IN PRFSD_KEY_IN_MEMORY b );
1484
1485 RFSD_KEY_COMPARISON
1486 CompareKeys(
1487 IN PRFSD_KEY_IN_MEMORY a,
1488 IN PRFSD_KEY_IN_MEMORY b );
1489
1490 NTSTATUS
1491 NavigateToLeafNode(
1492 IN PRFSD_VCB Vcb,
1493 IN PRFSD_KEY_IN_MEMORY Key,
1494 IN ULONG StartingBlockNumber,
1495 OUT PULONG out_NextBlockNumber );
1496
1497 NTSTATUS
1498 RfsdParseFilesystemTree(
1499 IN PRFSD_VCB Vcb,
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
1503 IN PVOID Context
1504 );
1505
1506
1507 NTSTATUS
1508 _NavigateToLeafNode(
1509 IN PRFSD_VCB Vcb,
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),
1516 IN PVOID pContext
1517 );
1518
1519
1520 //
1521 // Fastio.c
1522 //
1523
1524 #ifdef _PREFAST_
1525 FAST_IO_CHECK_IF_POSSIBLE RfsdFastIoCheckIfPossible;
1526 #endif // _PREFAST_
1527
1528 BOOLEAN NTAPI
1529 RfsdFastIoCheckIfPossible (
1530 IN PFILE_OBJECT FileObject,
1531 IN PLARGE_INTEGER FileOffset,
1532 IN ULONG Length,
1533 IN BOOLEAN Wait,
1534 IN ULONG LockKey,
1535 IN BOOLEAN CheckForReadOperation,
1536 OUT PIO_STATUS_BLOCK IoStatus,
1537 IN PDEVICE_OBJECT DeviceObject );
1538
1539 #ifdef _PREFAST_
1540 FAST_IO_READ RfsdFastIoRead;
1541 #endif // _PREFAST_
1542
1543 BOOLEAN NTAPI
1544 RfsdFastIoRead (IN PFILE_OBJECT FileObject,
1545 IN PLARGE_INTEGER FileOffset,
1546 IN ULONG Length,
1547 IN BOOLEAN Wait,
1548 IN ULONG LockKey,
1549 OUT PVOID Buffer,
1550 OUT PIO_STATUS_BLOCK IoStatus,
1551 IN PDEVICE_OBJECT DeviceObject);
1552
1553 #ifdef _PREFAST_
1554 FAST_IO_WRITE RfsdFastIoWrite;
1555 #endif // _PREFAST_
1556
1557 BOOLEAN NTAPI
1558 RfsdFastIoWrite (
1559 IN PFILE_OBJECT FileObject,
1560 IN PLARGE_INTEGER FileOffset,
1561 IN ULONG Length,
1562 IN BOOLEAN Wait,
1563 IN ULONG LockKey,
1564 OUT PVOID Buffer,
1565 OUT PIO_STATUS_BLOCK IoStatus,
1566 IN PDEVICE_OBJECT DeviceObject);
1567
1568 #ifdef _PREFAST_
1569 FAST_IO_QUERY_BASIC_INFO RfsdFastIoQueryBasicInfo;
1570 #endif // _PREFAST_
1571
1572 BOOLEAN NTAPI
1573 RfsdFastIoQueryBasicInfo (
1574 IN PFILE_OBJECT FileObject,
1575 IN BOOLEAN Wait,
1576 OUT PFILE_BASIC_INFORMATION Buffer,
1577 OUT PIO_STATUS_BLOCK IoStatus,
1578 IN PDEVICE_OBJECT DeviceObject);
1579
1580 #ifdef _PREFAST_
1581 FAST_IO_QUERY_STANDARD_INFO RfsdFastIoQueryStandardInfo;
1582 #endif // _PREFAST_
1583
1584 BOOLEAN NTAPI
1585 RfsdFastIoQueryStandardInfo (
1586 IN PFILE_OBJECT FileObject,
1587 IN BOOLEAN Wait,
1588 OUT PFILE_STANDARD_INFORMATION Buffer,
1589 OUT PIO_STATUS_BLOCK IoStatus,
1590 IN PDEVICE_OBJECT DeviceObject);
1591
1592 #ifdef _PREFAST_
1593 FAST_IO_LOCK RfsdFastIoLock;
1594 #endif // _PREFAST_
1595
1596 BOOLEAN NTAPI
1597 RfsdFastIoLock (
1598 IN PFILE_OBJECT FileObject,
1599 IN PLARGE_INTEGER FileOffset,
1600 IN PLARGE_INTEGER Length,
1601 IN PEPROCESS Process,
1602 IN ULONG Key,
1603 IN BOOLEAN FailImmediately,
1604 IN BOOLEAN ExclusiveLock,
1605 OUT PIO_STATUS_BLOCK IoStatus,
1606 IN PDEVICE_OBJECT DeviceObject
1607 );
1608
1609 #ifdef _PREFAST_
1610 FAST_IO_UNLOCK_SINGLE RfsdFastIoUnlockSingle;
1611 #endif // _PREFAST_
1612
1613 BOOLEAN NTAPI
1614 RfsdFastIoUnlockSingle (
1615 IN PFILE_OBJECT FileObject,
1616 IN PLARGE_INTEGER FileOffset,
1617 IN PLARGE_INTEGER Length,
1618 IN PEPROCESS Process,
1619 IN ULONG Key,
1620 OUT PIO_STATUS_BLOCK IoStatus,
1621 IN PDEVICE_OBJECT DeviceObject
1622 );
1623
1624 #ifdef _PREFAST_
1625 FAST_IO_UNLOCK_ALL RfsdFastIoUnlockAll;
1626 #endif // _PREFAST_
1627
1628 BOOLEAN NTAPI
1629 RfsdFastIoUnlockAll (
1630 IN PFILE_OBJECT FileObject,
1631 IN PEPROCESS Process,
1632 OUT PIO_STATUS_BLOCK IoStatus,
1633 IN PDEVICE_OBJECT DeviceObject
1634 );
1635
1636 #ifdef _PREFAST_
1637 FAST_IO_UNLOCK_ALL_BY_KEY RfsdFastIoUnlockAllByKey;
1638 #endif // _PREFAST_
1639
1640 BOOLEAN NTAPI
1641 RfsdFastIoUnlockAllByKey (
1642 IN PFILE_OBJECT FileObject,
1643 #ifdef __REACTOS__
1644 IN PVOID Process,
1645 #else
1646 IN PEPROCESS Process,
1647 #endif
1648 IN ULONG Key,
1649 OUT PIO_STATUS_BLOCK IoStatus,
1650 IN PDEVICE_OBJECT DeviceObject
1651 );
1652
1653 #ifdef _PREFAST_
1654 FAST_IO_QUERY_NETWORK_OPEN_INFO RfsdFastIoQueryNetworkOpenInfo;
1655 #endif // _PREFAST_
1656
1657 BOOLEAN NTAPI
1658 RfsdFastIoQueryNetworkOpenInfo (
1659 IN PFILE_OBJECT FileObject,
1660 IN BOOLEAN Wait,
1661 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
1662 OUT PIO_STATUS_BLOCK IoStatus,
1663 IN PDEVICE_OBJECT DeviceObject );
1664
1665
1666 //
1667 // FileInfo.c
1668 //
1669
1670
1671 NTSTATUS
1672 RfsdQueryInformation (IN PRFSD_IRP_CONTEXT IrpContext);
1673
1674 NTSTATUS
1675 RfsdSetInformation (IN PRFSD_IRP_CONTEXT IrpContext);
1676
1677 NTSTATUS
1678 RfsdExpandFile (
1679 PRFSD_IRP_CONTEXT IrpContext,
1680 PRFSD_VCB Vcb,
1681 PRFSD_FCB Fcb,
1682 PLARGE_INTEGER AllocationSize );
1683
1684 NTSTATUS
1685 RfsdTruncateFile (
1686 PRFSD_IRP_CONTEXT IrpContext,
1687 PRFSD_VCB Vcb,
1688 PRFSD_FCB Fcb,
1689 PLARGE_INTEGER AllocationSize );
1690
1691 NTSTATUS
1692 RfsdSetDispositionInfo(
1693 PRFSD_IRP_CONTEXT IrpContext,
1694 PRFSD_VCB Vcb,
1695 PRFSD_FCB Fcb,
1696 BOOLEAN bDelete);
1697
1698 NTSTATUS
1699 RfsdSetRenameInfo(
1700 PRFSD_IRP_CONTEXT IrpContext,
1701 PRFSD_VCB Vcb,
1702 PRFSD_FCB Fcb );
1703
1704 NTSTATUS
1705 RfsdDeleteFile(
1706 PRFSD_IRP_CONTEXT IrpContext,
1707 PRFSD_VCB Vcb,
1708 PRFSD_FCB Fcb );
1709
1710
1711 //
1712 // Flush.c
1713 //
1714
1715 NTSTATUS
1716 RfsdFlushFiles (IN PRFSD_VCB Vcb, BOOLEAN bShutDown);
1717
1718 NTSTATUS
1719 RfsdFlushVolume (IN PRFSD_VCB Vcb, BOOLEAN bShutDown);
1720
1721 NTSTATUS
1722 RfsdFlushFile (IN PRFSD_FCB Fcb);
1723
1724 NTSTATUS
1725 RfsdFlush (IN PRFSD_IRP_CONTEXT IrpContext);
1726
1727
1728 //
1729 // Fsctl.c
1730 //
1731
1732
1733 VOID
1734 RfsdSetVpbFlag (IN PVPB Vpb,
1735 IN USHORT Flag );
1736
1737 VOID
1738 RfsdClearVpbFlag (IN PVPB Vpb,
1739 IN USHORT Flag );
1740
1741 BOOLEAN
1742 RfsdCheckDismount (
1743 IN PRFSD_IRP_CONTEXT IrpContext,
1744 IN PRFSD_VCB Vcb,
1745 IN BOOLEAN bForce );
1746
1747 __drv_mustHoldCriticalRegion
1748 NTSTATUS
1749 RfsdPurgeVolume (IN PRFSD_VCB Vcb,
1750 IN BOOLEAN FlushBeforePurge);
1751
1752 __drv_mustHoldCriticalRegion
1753 NTSTATUS
1754 RfsdPurgeFile (IN PRFSD_FCB Fcb,
1755 IN BOOLEAN FlushBeforePurge);
1756
1757 BOOLEAN
1758 RfsdIsHandleCountZero(IN PRFSD_VCB Vcb);
1759
1760 NTSTATUS
1761 RfsdLockVcb (IN PRFSD_VCB Vcb,
1762 IN PFILE_OBJECT FileObject);
1763
1764 NTSTATUS
1765 RfsdLockVolume (IN PRFSD_IRP_CONTEXT IrpContext);
1766
1767 NTSTATUS
1768 RfsdUnlockVcb (IN PRFSD_VCB Vcb,
1769 IN PFILE_OBJECT FileObject);
1770
1771 NTSTATUS
1772 RfsdUnlockVolume (IN PRFSD_IRP_CONTEXT IrpContext);
1773
1774 NTSTATUS
1775 RfsdAllowExtendedDasdIo(IN PRFSD_IRP_CONTEXT IrpContext);
1776
1777 NTSTATUS
1778 RfsdUserFsRequest (IN PRFSD_IRP_CONTEXT IrpContext);
1779
1780 NTSTATUS
1781 RfsdMountVolume (IN PRFSD_IRP_CONTEXT IrpContext);
1782
1783 NTSTATUS
1784 RfsdVerifyVolume (IN PRFSD_IRP_CONTEXT IrpContext);
1785
1786 __drv_mustHoldCriticalRegion
1787 NTSTATUS
1788 RfsdIsVolumeMounted (IN PRFSD_IRP_CONTEXT IrpContext);
1789
1790 __drv_mustHoldCriticalRegion
1791 NTSTATUS
1792 RfsdDismountVolume (IN PRFSD_IRP_CONTEXT IrpContext);
1793
1794 NTSTATUS
1795 RfsdFileSystemControl (IN PRFSD_IRP_CONTEXT IrpContext);
1796
1797
1798 //
1799 // Init.c
1800 //
1801
1802 BOOLEAN
1803 RfsdQueryParameters (IN PUNICODE_STRING RegistryPath);
1804
1805 #ifdef _PREFAST_
1806 DRIVER_INITIALIZE DriverEntry;
1807 #endif // _PREFAST_
1808
1809 #ifdef _PREFAST_
1810 DRIVER_UNLOAD DriverUnload;
1811 #endif // _PREFAST_
1812
1813 VOID NTAPI
1814 DriverUnload (IN PDRIVER_OBJECT DriverObject);
1815
1816
1817 //
1818 // Lock.c
1819 //
1820
1821 NTSTATUS
1822 RfsdLockControl (IN PRFSD_IRP_CONTEXT IrpContext);
1823
1824 //
1825 // Memory.c
1826 //
1827
1828 PRFSD_IRP_CONTEXT
1829 RfsdAllocateIrpContext (IN PDEVICE_OBJECT DeviceObject,
1830 IN PIRP Irp );
1831
1832 VOID
1833 RfsdFreeIrpContext (IN PRFSD_IRP_CONTEXT IrpContext);
1834
1835
1836 PRFSD_FCB
1837 RfsdAllocateFcb (IN PRFSD_VCB Vcb,
1838 IN PRFSD_MCB RfsdMcb,
1839 IN PRFSD_INODE Inode );
1840
1841 VOID
1842 RfsdFreeFcb (IN PRFSD_FCB Fcb);
1843
1844 PRFSD_CCB
1845 RfsdAllocateCcb (VOID);
1846
1847 VOID
1848 RfsdFreeMcb (IN PRFSD_MCB Mcb);
1849
1850 PRFSD_FCB
1851 RfsdCreateFcbFromMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb);
1852
1853 VOID
1854 RfsdFreeCcb (IN PRFSD_CCB Ccb);
1855
1856 PRFSD_MCB
1857 RfsdAllocateMcb ( PRFSD_VCB,
1858 PUNICODE_STRING FileName,
1859 ULONG FileAttr);
1860
1861 PRFSD_MCB
1862 RfsdSearchMcbTree( PRFSD_VCB Vcb,
1863 PRFSD_MCB RfsdMcb,
1864 PRFSD_KEY_IN_MEMORY Key);
1865
1866 PRFSD_MCB
1867 RfsdSearchMcb( PRFSD_VCB Vcb, PRFSD_MCB Parent,
1868 PUNICODE_STRING FileName);
1869
1870 BOOLEAN
1871 RfsdGetFullFileName( PRFSD_MCB Mcb,
1872 PUNICODE_STRING FileName);
1873
1874 VOID
1875 RfsdRefreshMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb);
1876
1877 VOID
1878 RfsdAddMcbNode( PRFSD_VCB Vcb,
1879 PRFSD_MCB Parent,
1880 PRFSD_MCB Child );
1881
1882 BOOLEAN
1883 RfsdDeleteMcbNode(
1884 PRFSD_VCB Vcb,
1885 PRFSD_MCB McbTree,
1886 PRFSD_MCB RfsdMcb);
1887
1888 VOID
1889 RfsdFreeMcbTree(PRFSD_MCB McbTree);
1890
1891 BOOLEAN
1892 RfsdCheckSetBlock( PRFSD_IRP_CONTEXT IrpContext,
1893 PRFSD_VCB Vcb, ULONG Block);
1894
1895 BOOLEAN
1896 RfsdCheckBitmapConsistency( PRFSD_IRP_CONTEXT IrpContext,
1897 PRFSD_VCB Vcb);
1898
1899 VOID
1900 RfsdInsertVcb(PRFSD_VCB Vcb);
1901
1902 VOID
1903 RfsdRemoveVcb(PRFSD_VCB Vcb);
1904
1905 NTSTATUS
1906 RfsdInitializeVcb(
1907 PRFSD_IRP_CONTEXT IrpContext,
1908 PRFSD_VCB Vcb,
1909 PRFSD_SUPER_BLOCK RfsdSb,
1910 PDEVICE_OBJECT TargetDevice,
1911 PDEVICE_OBJECT VolumeDevice,
1912 PVPB Vpb );
1913
1914 VOID
1915 RfsdFreeVcb (IN PRFSD_VCB Vcb );
1916
1917
1918 VOID
1919 RfsdRepinBcb (
1920 IN PRFSD_IRP_CONTEXT IrpContext,
1921 IN PBCB Bcb );
1922
1923 VOID
1924 RfsdUnpinRepinnedBcbs (
1925 IN PRFSD_IRP_CONTEXT IrpContext);
1926
1927
1928 NTSTATUS
1929 RfsdCompleteIrpContext (
1930 IN PRFSD_IRP_CONTEXT IrpContext,
1931 IN NTSTATUS Status );
1932
1933 VOID
1934 RfsdSyncUninitializeCacheMap (
1935 IN PFILE_OBJECT FileObject );
1936
1937 //
1938 // Misc.c
1939 //
1940
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)
1943 {
1944 USHORT i = 0;
1945 while ((i < MaximumLength) && (buffer[i] != '\0')) { i++; }
1946 return i;
1947 }
1948
1949 ULONG
1950 RfsdLog2(ULONG Value);
1951
1952 LARGE_INTEGER
1953 RfsdSysTime (IN ULONG i_time);
1954
1955 ULONG
1956 RfsdInodeTime (IN LARGE_INTEGER SysTime);
1957
1958 ULONG
1959 RfsdOEMToUnicodeSize(
1960 IN PANSI_STRING Oem
1961 );
1962
1963 NTSTATUS
1964 RfsdOEMToUnicode(
1965 IN OUT PUNICODE_STRING Oem,
1966 IN POEM_STRING Unicode
1967 );
1968
1969 ULONG
1970 RfsdUnicodeToOEMSize(
1971 IN PUNICODE_STRING Unicode
1972 );
1973
1974 NTSTATUS
1975 RfsdUnicodeToOEM (
1976 IN OUT POEM_STRING Oem,
1977 IN PUNICODE_STRING Unicode
1978 );
1979
1980 //
1981 // nls/nls_rtl.c
1982 //
1983
1984 int
1985 RfsdLoadAllNls();
1986
1987 VOID
1988 RfsdUnloadAllNls();
1989
1990 //
1991 // Pnp.c
1992 //
1993
1994 __drv_mustHoldCriticalRegion
1995 NTSTATUS
1996 RfsdPnp(IN PRFSD_IRP_CONTEXT IrpContext);
1997
1998 __drv_mustHoldCriticalRegion
1999 NTSTATUS
2000 RfsdPnpQueryRemove(
2001 PRFSD_IRP_CONTEXT IrpContext,
2002 PRFSD_VCB Vcb );
2003
2004 __drv_mustHoldCriticalRegion
2005 NTSTATUS
2006 RfsdPnpRemove(
2007 PRFSD_IRP_CONTEXT IrpContext,
2008 PRFSD_VCB Vcb );
2009
2010 __drv_mustHoldCriticalRegion
2011 NTSTATUS
2012 RfsdPnpCancelRemove(
2013 PRFSD_IRP_CONTEXT IrpContext,
2014 PRFSD_VCB Vcb );
2015
2016 __drv_mustHoldCriticalRegion
2017 NTSTATUS
2018 RfsdPnpSurpriseRemove(
2019 PRFSD_IRP_CONTEXT IrpContext,
2020 PRFSD_VCB Vcb );
2021
2022
2023 //
2024 // Read.c
2025 //
2026
2027 BOOLEAN
2028 RfsdCopyRead(
2029 IN PFILE_OBJECT FileObject,
2030 IN PLARGE_INTEGER FileOffset,
2031 IN ULONG Length,
2032 IN BOOLEAN Wait,
2033 OUT PVOID Buffer,
2034 OUT PIO_STATUS_BLOCK IoStatus );
2035
2036
2037 NTSTATUS
2038 RfsdReadInode (
2039 IN PRFSD_IRP_CONTEXT IrpContext,
2040 IN PRFSD_VCB Vcb,
2041 IN PRFSD_KEY_IN_MEMORY Key,
2042 IN PRFSD_INODE Inode,
2043 IN ULONGLONG Offset,
2044 IN PVOID Buffer,
2045 IN ULONG Size,
2046 OUT PULONG dwReturn
2047 );
2048
2049 NTSTATUS
2050 RfsdRead (IN PRFSD_IRP_CONTEXT IrpContext);
2051
2052 //
2053 // Shutdown.c
2054 //
2055
2056 NTSTATUS
2057 RfsdShutDown (IN PRFSD_IRP_CONTEXT IrpContext);
2058
2059 //
2060 // Volinfo.c
2061 //
2062
2063 NTSTATUS
2064 RfsdQueryVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext);
2065
2066 NTSTATUS
2067 RfsdSetVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext);
2068
2069
2070 //
2071 // Write.c
2072 //
2073
2074 NTSTATUS
2075 RfsdWriteInode (
2076 IN PRFSD_IRP_CONTEXT IrpContext,
2077 IN PRFSD_VCB Vcb,
2078 IN ULONG InodeNo,
2079 IN PRFSD_INODE Inode,
2080 IN ULONGLONG Offset,
2081 IN PVOID Buffer,
2082 IN ULONG Size,
2083 IN BOOLEAN bWriteToDisk,
2084 OUT PULONG dwReturn
2085 );
2086
2087 VOID
2088 RfsdStartFloppyFlushDpc (
2089 PRFSD_VCB Vcb,
2090 PRFSD_FCB Fcb,
2091 PFILE_OBJECT FileObject );
2092
2093 BOOLEAN
2094 RfsdZeroHoles (
2095 IN PRFSD_IRP_CONTEXT IrpContext,
2096 IN PRFSD_VCB Vcb,
2097 IN PFILE_OBJECT FileObject,
2098 IN LONGLONG Offset,
2099 IN LONGLONG Count );
2100
2101 NTSTATUS
2102 RfsdWrite (IN PRFSD_IRP_CONTEXT IrpContext);
2103
2104 #endif /* _RFSD_HEADER_ */