[NTOSKRNL]
[reactos.git] / ntoskrnl / cc / cacheman.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/cc/cacheman.c
5 * PURPOSE: Cache manager
6 *
7 * PROGRAMMERS: David Welch (welch@cwcom.net)
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15
16 BOOLEAN CcPfEnablePrefetcher;
17 PFSN_PREFETCHER_GLOBALS CcPfGlobals;
18
19 /* FUNCTIONS *****************************************************************/
20
21 VOID
22 NTAPI
23 INIT_FUNCTION
24 CcPfInitializePrefetcher(VOID)
25 {
26 /* Notify debugger */
27 DbgPrintEx(DPFLTR_PREFETCHER_ID,
28 DPFLTR_TRACE_LEVEL,
29 "CCPF: InitializePrefetecher()\n");
30
31 /* Setup the Prefetcher Data */
32 InitializeListHead(&CcPfGlobals.ActiveTraces);
33 InitializeListHead(&CcPfGlobals.CompletedTraces);
34 ExInitializeFastMutex(&CcPfGlobals.CompletedTracesLock);
35
36 /* FIXME: Setup the rest of the prefetecher */
37 }
38
39 BOOLEAN
40 NTAPI
41 INIT_FUNCTION
42 CcInitializeCacheManager(VOID)
43 {
44 CcInitView();
45 return TRUE;
46 }
47
48 /*
49 * @unimplemented
50 */
51 LARGE_INTEGER
52 NTAPI
53 CcGetFlushedValidData (
54 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
55 IN BOOLEAN BcbListHeld
56 )
57 {
58 LARGE_INTEGER i;
59
60 UNIMPLEMENTED;
61
62 i.QuadPart = 0;
63 return i;
64 }
65
66 /*
67 * @unimplemented
68 */
69 PVOID
70 NTAPI
71 CcRemapBcb (
72 IN PVOID Bcb
73 )
74 {
75 UNIMPLEMENTED;
76
77 return 0;
78 }
79
80 /*
81 * @unimplemented
82 */
83 VOID
84 NTAPI
85 CcScheduleReadAhead (
86 IN PFILE_OBJECT FileObject,
87 IN PLARGE_INTEGER FileOffset,
88 IN ULONG Length
89 )
90 {
91 UNIMPLEMENTED;
92 }
93
94 /*
95 * @unimplemented
96 */
97 VOID
98 NTAPI
99 CcSetAdditionalCacheAttributes (
100 IN PFILE_OBJECT FileObject,
101 IN BOOLEAN DisableReadAhead,
102 IN BOOLEAN DisableWriteBehind
103 )
104 {
105 CCTRACE(CC_API_DEBUG, "FileObject=%p DisableReadAhead=%d DisableWriteBehind=%d\n",
106 FileObject, DisableReadAhead, DisableWriteBehind);
107
108 UNIMPLEMENTED;
109 }
110
111 /*
112 * @unimplemented
113 */
114 VOID
115 NTAPI
116 CcSetBcbOwnerPointer (
117 IN PVOID Bcb,
118 IN PVOID Owner
119 )
120 {
121 PINTERNAL_BCB iBcb = Bcb;
122
123 CCTRACE(CC_API_DEBUG, "Bcb=%p Owner=%p\n",
124 Bcb, Owner);
125
126 if (!ExIsResourceAcquiredExclusiveLite(&iBcb->Lock) && !ExIsResourceAcquiredSharedLite(&iBcb->Lock))
127 {
128 DPRINT1("Current thread doesn't own resource!\n");
129 return;
130 }
131
132 ExSetResourceOwnerPointer(&iBcb->Lock, Owner);
133 }
134
135 /*
136 * @unimplemented
137 */
138 VOID
139 NTAPI
140 CcSetDirtyPageThreshold (
141 IN PFILE_OBJECT FileObject,
142 IN ULONG DirtyPageThreshold
143 )
144 {
145 CCTRACE(CC_API_DEBUG, "FileObject=%p DirtyPageThreshold=%lu\n",
146 FileObject, DirtyPageThreshold);
147
148 UNIMPLEMENTED;
149 }
150
151 /*
152 * @unimplemented
153 */
154 VOID
155 NTAPI
156 CcSetReadAheadGranularity (
157 IN PFILE_OBJECT FileObject,
158 IN ULONG Granularity
159 )
160 {
161 static ULONG Warn;
162
163 CCTRACE(CC_API_DEBUG, "FileObject=%p Granularity=%lu\n",
164 FileObject, Granularity);
165
166 if (!Warn++) UNIMPLEMENTED;
167 }