abb1c31e986193cae2376d14f1b6f80f64aafea3
[reactos.git] / reactos / ntoskrnl / include / internal / fsrtl.h
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/include/fsrtl.h
5 * PURPOSE: Internal header for the File System Runtime Library
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 #ifndef TAG
10 #define TAG(w,x,y,z) (((w)<<24)|((x)<<16)|((y)<<8)|(z))
11 #endif
12
13 //
14 // Define this if you want debugging support
15 //
16 #define _FSRTL_DEBUG_ 0x00
17
18 //
19 // These define the Debug Masks Supported
20 //
21 #define FSRTL_FASTIO_DEBUG 0x01
22 #define FSRTL_OPLOCK_DEBUG 0x02
23 #define FSRTL_TUNNEL_DEBUG 0x04
24 #define FSRTL_MCB_DEBUG 0x08
25 #define FSRTL_NAME_DEBUG 0x10
26 #define FSRTL_NOTIFY_DEBUG 0x20
27 #define FSRTL_FILELOCK_DEBUG 0x40
28 #define FSRTL_UNC_DEBUG 0x80
29 #define FSRTL_FILTER_DEBUG 0x100
30 #define FSRTL_CONTEXT_DEBUG 0x200
31
32 //
33 // Debug/Tracing support
34 //
35 #if _FSRTL_DEBUG_
36 #ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
37 #define FSTRACE DbgPrintEx
38 #else
39 #define FSTRACE(x, ...) \
40 if (x & FsRtlpTraceLevel) DbgPrint(__VA_ARGS__)
41 #endif
42 #else
43 #define FSTRACE(x, ...) DPRINT(__VA_ARGS__)
44 #endif
45
46 //
47 // Number of internal ERESOURCE structures allocated for callers to request
48 //
49 #define FSRTL_MAX_RESOURCES 16
50
51 //
52 // Number of maximum pair count per MCB
53 //
54 #define MAXIMUM_PAIR_COUNT 15
55
56 //
57 // Notifications flags
58 //
59 #define CLEANUP_IN_PROCESS 4
60
61 //
62 // Internal structure for NOTIFY_SYNC
63 //
64 typedef struct _REAL_NOTIFY_SYNC
65 {
66 FAST_MUTEX FastMutex;
67 ULONG_PTR OwningThread;
68 ULONG OwnerCount;
69 } REAL_NOTIFY_SYNC, * PREAL_NOTIFY_SYNC;
70
71 //
72 // Internal structure for notifications
73 //
74 typedef struct _NOTIFY_CHANGE
75 {
76 PREAL_NOTIFY_SYNC NotifySync;
77 PVOID FsContext;
78 PVOID StreamID;
79 PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback;
80 PSECURITY_SUBJECT_CONTEXT SubjectContext;
81 PSTRING FullDirectoryName;
82 PLIST_ENTRY NotifyList;
83 PLIST_ENTRY NotifyIrps;
84 PFILTER_REPORT_CHANGE FilterCallback;
85 USHORT Flags;
86 UCHAR CharacterSize;
87 ULONG CompletionFilter;
88 PVOID AllocatedBuffer;
89 PVOID Buffer;
90 ULONG BufferLength;
91 ULONG ThisBufferLength;
92 ULONG DataLength;
93 ULONG LastEntry;
94 ULONG ReferenceCount;
95 PEPROCESS OwningProcess;
96 } NOTIFY_CHANGE, *PNOTIFY_CHANGE;
97
98 //
99 // Internal structure for MCB Mapping pointer
100 //
101 typedef struct _INT_MAPPING
102 {
103 VBN Vbn;
104 LBN Lbn;
105 } INT_MAPPING, *PINT_MAPPING;
106
107 //
108 // Initialization Routines
109 //
110 VOID
111 NTAPI
112 FsRtlInitializeLargeMcbs(
113 VOID
114 );
115
116 //
117 // File contexts Routines
118 //
119 VOID
120 NTAPI
121 FsRtlPTeardownPerFileObjectContexts(
122 IN PFILE_OBJECT FileObject
123 );
124
125 BOOLEAN
126 NTAPI
127 FsRtlInitSystem(
128 VOID
129 );
130
131 //
132 // Global data inside the File System Runtime Library
133 //
134 extern PERESOURCE FsRtlPagingIoResources;
135 extern PUCHAR _FsRtlLegalAnsiCharacterArray;
136 extern PAGED_LOOKASIDE_LIST FsRtlFileLockLookasideList;