1 /*++ NDK Version: 0098 2 3 Copyright (c) Alex Ionescu. All rights reserved. 4 5 Header Name: 6 7 cctypes.h 8 9 Abstract: 10 11 Type definitions for the Cache Controller. 12 13 Author: 14 15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 16 17 --*/ 18 19 #ifndef _CCTYPES_H 20 #define _CCTYPES_H 21 22 // 23 // Dependencies 24 // 25 #include <umtypes.h> 26 27 #ifndef NTOS_MODE_USER 28 29 // 30 // Kernel Exported CcData 31 // 32 extern ULONG NTSYSAPI CcFastReadNotPossible; 33 extern ULONG NTSYSAPI CcFastReadWait; 34 extern ULONG NTSYSAPI CcFastReadResourceMiss; 35 extern ULONG NTSYSAPI CcFastReadNoWait; 36 extern ULONG NTSYSAPI CcFastMdlReadNotPossible; 37 38 // 39 // Virtual Address Control BLock 40 // 41 typedef struct _VACB 42 { 43 PVOID BaseAddress; 44 struct _SHARED_CACHE_MAP *SharedCacheMap; 45 union 46 { 47 LARGE_INTEGER FileOffset; 48 USHORT ActiveCount; 49 } Overlay; 50 LIST_ENTRY LruList; 51 } VACB, *PVACB; 52 53 // 54 // Private Cache Map Structure and Flags 55 // 56 typedef struct _PRIVATE_CACHE_MAP_FLAGS 57 { 58 ULONG DontUse:16; 59 ULONG ReadAheadActive:1; 60 ULONG ReadAheadEnabled:1; 61 ULONG Available:14; 62 } PRIVATE_CACHE_MAP_FLAGS; 63 64 #define PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE (1 << 16) 65 #define PRIVATE_CACHE_MAP_READ_AHEAD_ENABLED (1 << 17) 66 67 typedef struct _PRIVATE_CACHE_MAP 68 { 69 union 70 { 71 CSHORT NodeTypeCode; 72 PRIVATE_CACHE_MAP_FLAGS Flags; 73 ULONG UlongFlags; 74 }; 75 ULONG ReadAheadMask; 76 PFILE_OBJECT FileObject; 77 LARGE_INTEGER FileOffset1; 78 LARGE_INTEGER BeyondLastByte1; 79 LARGE_INTEGER FileOffset2; 80 LARGE_INTEGER BeyondLastByte2; 81 LARGE_INTEGER ReadAheadOffset[2]; 82 ULONG ReadAheadLength[2]; 83 KSPIN_LOCK ReadAheadSpinLock; 84 LIST_ENTRY PrivateLinks; 85 PVOID ReadAheadWorkItem; 86 } PRIVATE_CACHE_MAP, *PPRIVATE_CACHE_MAP; 87 88 typedef struct _BITMAP_RANGE 89 { 90 LIST_ENTRY Links; 91 LONGLONG BasePage; 92 ULONG FirstDirtyPage; 93 ULONG LastDirtyPage; 94 ULONG DirtyPages; 95 PULONG Bitmap; 96 } BITMAP_RANGE, *PBITMAP_RANGE; 97 98 typedef struct _MBCB 99 { 100 CSHORT NodeTypeCode; 101 CSHORT NodeIsInZone; 102 ULONG PagesToWrite; 103 ULONG DirtyPages; 104 ULONG Reserved; 105 LIST_ENTRY BitmapRanges; 106 LONGLONG ResumeWritePage; 107 BITMAP_RANGE BitmapRange1; 108 BITMAP_RANGE BitmapRange2; 109 BITMAP_RANGE BitmapRange3; 110 } MBCB, *PMBCB; 111 112 #ifdef _NTIFS_INCLUDED_ 113 114 // 115 // Shared Cache Map 116 // 117 typedef struct _SHARED_CACHE_MAP 118 { 119 CSHORT NodeTypeCode; 120 CSHORT NodeByteSize; 121 ULONG OpenCount; 122 LARGE_INTEGER FileSize; 123 LIST_ENTRY BcbList; 124 LARGE_INTEGER SectionSize; 125 LARGE_INTEGER ValidDataLength; 126 LARGE_INTEGER ValidDataGoal; 127 PVACB InitialVacbs[4]; 128 PVACB *Vacbs; 129 PFILE_OBJECT FileObject; 130 PVACB ActiveVacb; 131 PVOID NeedToZero; 132 ULONG ActivePage; 133 ULONG NeedToZeroPage; 134 KSPIN_LOCK ActiveVacbSpinLock; 135 ULONG VacbActiveCount; 136 ULONG DirtyPages; 137 LIST_ENTRY SharedCacheMapLinks; 138 ULONG Flags; 139 LONG Status; 140 PMBCB Mbcb; 141 PVOID Section; 142 PKEVENT CreateEvent; 143 PKEVENT WaitOnActiveCount; 144 ULONG PagesToWrite; 145 LONGLONG BeyondLastFlush; 146 PCACHE_MANAGER_CALLBACKS Callbacks; 147 PVOID LazyWriteContext; 148 LIST_ENTRY PrivateList; 149 PVOID LogHandle; 150 PFLUSH_TO_LSN FlushToLsnRoutine; 151 ULONG DirtyPageThreshold; 152 ULONG LazyWritePassCount; 153 PCACHE_UNINITIALIZE_EVENT UninitializeEvent; 154 PVACB NeedToZeroVacb; 155 KSPIN_LOCK BcbSpinLock; 156 PVOID Reserved; 157 KEVENT Event; 158 EX_PUSH_LOCK VacbPushLock; 159 PRIVATE_CACHE_MAP PrivateCacheMap; 160 } SHARED_CACHE_MAP, *PSHARED_CACHE_MAP; 161 162 #endif /* _NTIFS_INCLUDED_ */ 163 164 // 165 // Deferred Write list entry 166 // 167 typedef struct _DEFERRED_WRITE 168 { 169 CSHORT NodeTypeCode; 170 CSHORT NodeByteSize; 171 PFILE_OBJECT FileObject; 172 ULONG BytesToWrite; 173 LIST_ENTRY DeferredWriteLinks; 174 PKEVENT Event; 175 PCC_POST_DEFERRED_WRITE PostRoutine; 176 PVOID Context1; 177 PVOID Context2; 178 BOOLEAN LimitModifiedPages; 179 } DEFERRED_WRITE, *PDEFERRED_WRITE; 180 181 #endif /* NTOS_MODE_USER */ 182 #endif /* _CCTYPES_H */ 183 184