2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2001-04-09 02:45:04 +00:00
|
|
|
|
2014-11-29 21:43:39 +00:00
|
|
|
//
|
|
|
|
// Define this if you want debugging support
|
|
|
|
//
|
2021-02-02 09:06:00 +00:00
|
|
|
#define _CC_DEBUG_ 0x00
|
2014-11-29 21:43:39 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// These define the Debug Masks Supported
|
|
|
|
//
|
|
|
|
#define CC_API_DEBUG 0x01
|
|
|
|
|
|
|
|
//
|
|
|
|
// Debug/Tracing support
|
|
|
|
//
|
|
|
|
#if _CC_DEBUG_
|
|
|
|
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
|
|
|
|
#define CCTRACE(x, ...) \
|
|
|
|
{ \
|
|
|
|
DbgPrintEx("%s [%.16s] - ", \
|
|
|
|
__FUNCTION__, \
|
|
|
|
PsGetCurrentProcess()->ImageFileName); \
|
|
|
|
DbgPrintEx(__VA_ARGS__); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define CCTRACE(x, ...) \
|
|
|
|
if (x & CcRosTraceLevel) \
|
|
|
|
{ \
|
|
|
|
DbgPrint("%s [%.16s] - ", \
|
|
|
|
__FUNCTION__, \
|
|
|
|
PsGetCurrentProcess()->ImageFileName); \
|
|
|
|
DbgPrint(__VA_ARGS__); \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define CCTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Global Cc Data
|
|
|
|
//
|
|
|
|
extern ULONG CcRosTraceLevel;
|
2018-01-15 22:20:53 +00:00
|
|
|
extern LIST_ENTRY DirtyVacbListHead;
|
2018-01-23 21:56:23 +00:00
|
|
|
extern ULONG CcDirtyPageThreshold;
|
|
|
|
extern ULONG CcTotalDirtyPages;
|
|
|
|
extern LIST_ENTRY CcDeferredWrites;
|
|
|
|
extern KSPIN_LOCK CcDeferredWriteSpinLock;
|
2018-02-07 17:10:59 +00:00
|
|
|
extern ULONG CcNumberWorkerThreads;
|
|
|
|
extern LIST_ENTRY CcIdleWorkerThreadList;
|
2018-02-09 09:06:17 +00:00
|
|
|
extern LIST_ENTRY CcExpressWorkQueue;
|
2018-02-07 17:10:59 +00:00
|
|
|
extern LIST_ENTRY CcRegularWorkQueue;
|
2018-02-07 17:56:13 +00:00
|
|
|
extern LIST_ENTRY CcPostTickWorkQueue;
|
2018-02-07 17:10:59 +00:00
|
|
|
extern NPAGED_LOOKASIDE_LIST CcTwilightLookasideList;
|
2018-02-07 20:09:36 +00:00
|
|
|
extern LARGE_INTEGER CcIdleDelay;
|
2014-11-29 21:43:39 +00:00
|
|
|
|
2018-02-24 12:35:17 +00:00
|
|
|
//
|
|
|
|
// Counters
|
|
|
|
//
|
|
|
|
extern ULONG CcLazyWritePages;
|
|
|
|
extern ULONG CcLazyWriteIos;
|
|
|
|
extern ULONG CcMapDataWait;
|
|
|
|
extern ULONG CcMapDataNoWait;
|
2018-02-24 12:47:15 +00:00
|
|
|
extern ULONG CcPinReadWait;
|
|
|
|
extern ULONG CcPinReadNoWait;
|
2018-10-13 20:50:49 +00:00
|
|
|
extern ULONG CcPinMappedDataCount;
|
2018-02-24 13:02:33 +00:00
|
|
|
extern ULONG CcDataPages;
|
|
|
|
extern ULONG CcDataFlushes;
|
2018-02-24 12:35:17 +00:00
|
|
|
|
2007-05-09 00:29:38 +00:00
|
|
|
typedef struct _PF_SCENARIO_ID
|
|
|
|
{
|
|
|
|
WCHAR ScenName[30];
|
|
|
|
ULONG HashId;
|
|
|
|
} PF_SCENARIO_ID, *PPF_SCENARIO_ID;
|
|
|
|
|
|
|
|
typedef struct _PF_LOG_ENTRY
|
|
|
|
{
|
|
|
|
ULONG FileOffset:30;
|
|
|
|
ULONG Type:2;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
ULONG FileKey;
|
|
|
|
ULONG FileSequenceNumber;
|
|
|
|
};
|
|
|
|
} PF_LOG_ENTRY, *PPF_LOG_ENTRY;
|
|
|
|
|
|
|
|
typedef struct _PFSN_LOG_ENTRIES
|
|
|
|
{
|
|
|
|
LIST_ENTRY TraceBuffersLink;
|
|
|
|
LONG NumEntries;
|
|
|
|
LONG MaxEntries;
|
|
|
|
PF_LOG_ENTRY Entries[ANYSIZE_ARRAY];
|
|
|
|
} PFSN_LOG_ENTRIES, *PPFSN_LOG_ENTRIES;
|
|
|
|
|
|
|
|
typedef struct _PF_SECTION_INFO
|
|
|
|
{
|
|
|
|
ULONG FileKey;
|
|
|
|
ULONG FileSequenceNumber;
|
|
|
|
ULONG FileIdLow;
|
|
|
|
ULONG FileIdHigh;
|
|
|
|
} PF_SECTION_INFO, *PPF_SECTION_INFO;
|
|
|
|
|
|
|
|
typedef struct _PF_TRACE_HEADER
|
|
|
|
{
|
|
|
|
ULONG Version;
|
|
|
|
ULONG MagicNumber;
|
|
|
|
ULONG Size;
|
|
|
|
PF_SCENARIO_ID ScenarioId;
|
|
|
|
ULONG ScenarioType; // PF_SCENARIO_TYPE
|
|
|
|
ULONG EventEntryIdxs[8];
|
|
|
|
ULONG NumEventEntryIdxs;
|
|
|
|
ULONG TraceBufferOffset;
|
|
|
|
ULONG NumEntries;
|
|
|
|
ULONG SectionInfoOffset;
|
|
|
|
ULONG NumSections;
|
|
|
|
ULONG FaultsPerPeriod[10];
|
|
|
|
LARGE_INTEGER LaunchTime;
|
|
|
|
ULONGLONG Reserved[5];
|
|
|
|
} PF_TRACE_HEADER, *PPF_TRACE_HEADER;
|
|
|
|
|
|
|
|
typedef struct _PFSN_TRACE_DUMP
|
|
|
|
{
|
|
|
|
LIST_ENTRY CompletedTracesLink;
|
|
|
|
PF_TRACE_HEADER Trace;
|
|
|
|
} PFSN_TRACE_DUMP, *PPFSN_TRACE_DUMP;
|
|
|
|
|
|
|
|
typedef struct _PFSN_TRACE_HEADER
|
|
|
|
{
|
|
|
|
ULONG Magic;
|
|
|
|
LIST_ENTRY ActiveTracesLink;
|
|
|
|
PF_SCENARIO_ID ScenarioId;
|
|
|
|
ULONG ScenarioType; // PF_SCENARIO_TYPE
|
|
|
|
ULONG EventEntryIdxs[8];
|
|
|
|
ULONG NumEventEntryIdxs;
|
|
|
|
PPFSN_LOG_ENTRIES CurrentTraceBuffer;
|
|
|
|
LIST_ENTRY TraceBuffersList;
|
|
|
|
ULONG NumTraceBuffers;
|
|
|
|
KSPIN_LOCK TraceBufferSpinLock;
|
|
|
|
KTIMER TraceTimer;
|
|
|
|
LARGE_INTEGER TraceTimerPeriod;
|
|
|
|
KDPC TraceTimerDpc;
|
|
|
|
KSPIN_LOCK TraceTimerSpinLock;
|
|
|
|
ULONG FaultsPerPeriod[10];
|
|
|
|
LONG LastNumFaults;
|
|
|
|
LONG CurPeriod;
|
|
|
|
LONG NumFaults;
|
|
|
|
LONG MaxFaults;
|
|
|
|
PEPROCESS Process;
|
|
|
|
EX_RUNDOWN_REF RefCount;
|
|
|
|
WORK_QUEUE_ITEM EndTraceWorkItem;
|
|
|
|
LONG EndTraceCalled;
|
|
|
|
PPFSN_TRACE_DUMP TraceDump;
|
|
|
|
NTSTATUS TraceDumpStatus;
|
|
|
|
LARGE_INTEGER LaunchTime;
|
|
|
|
PPF_SECTION_INFO SectionInfo;
|
|
|
|
ULONG SectionInfoCount;
|
|
|
|
} PFSN_TRACE_HEADER, *PPFSN_TRACE_HEADER;
|
|
|
|
|
|
|
|
typedef struct _PFSN_PREFETCHER_GLOBALS
|
|
|
|
{
|
|
|
|
LIST_ENTRY ActiveTraces;
|
|
|
|
KSPIN_LOCK ActiveTracesLock;
|
|
|
|
PPFSN_TRACE_HEADER SystemWideTrace;
|
|
|
|
LIST_ENTRY CompletedTraces;
|
|
|
|
FAST_MUTEX CompletedTracesLock;
|
|
|
|
LONG NumCompletedTraces;
|
|
|
|
PKEVENT CompletedTracesEvent;
|
|
|
|
LONG ActivePrefetches;
|
|
|
|
} PFSN_PREFETCHER_GLOBALS, *PPFSN_PREFETCHER_GLOBALS;
|
|
|
|
|
2014-04-12 10:59:48 +00:00
|
|
|
typedef struct _ROS_SHARED_CACHE_MAP
|
2002-09-08 10:23:54 +00:00
|
|
|
{
|
2018-02-08 10:02:07 +00:00
|
|
|
CSHORT NodeTypeCode;
|
|
|
|
CSHORT NodeByteSize;
|
|
|
|
ULONG OpenCount;
|
2005-06-25 17:01:17 +00:00
|
|
|
LARGE_INTEGER FileSize;
|
2018-09-02 12:37:47 +00:00
|
|
|
LIST_ENTRY BcbList;
|
2018-02-08 10:02:07 +00:00
|
|
|
LARGE_INTEGER SectionSize;
|
2021-01-05 17:39:55 +00:00
|
|
|
LARGE_INTEGER ValidDataLength;
|
2018-02-08 10:02:07 +00:00
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
ULONG DirtyPages;
|
|
|
|
LIST_ENTRY SharedCacheMapLinks;
|
2018-02-08 10:49:22 +00:00
|
|
|
ULONG Flags;
|
2020-11-06 08:39:31 +00:00
|
|
|
PVOID Section;
|
|
|
|
PKEVENT CreateEvent;
|
2008-03-08 16:47:41 +00:00
|
|
|
PCACHE_MANAGER_CALLBACKS Callbacks;
|
|
|
|
PVOID LazyWriteContext;
|
2018-02-07 22:18:54 +00:00
|
|
|
LIST_ENTRY PrivateList;
|
2018-01-26 09:40:05 +00:00
|
|
|
ULONG DirtyPageThreshold;
|
2018-09-02 12:37:47 +00:00
|
|
|
KSPIN_LOCK BcbSpinLock;
|
2018-02-09 20:52:41 +00:00
|
|
|
PRIVATE_CACHE_MAP PrivateCacheMap;
|
2018-02-08 10:02:07 +00:00
|
|
|
|
|
|
|
/* ROS specific */
|
|
|
|
LIST_ENTRY CacheMapVacbListHead;
|
|
|
|
BOOLEAN PinAccess;
|
|
|
|
KSPIN_LOCK CacheMapLock;
|
2009-10-17 15:03:54 +00:00
|
|
|
#if DBG
|
2014-04-12 10:59:48 +00:00
|
|
|
BOOLEAN Trace; /* enable extra trace output for this cache map and it's VACBs */
|
2005-08-13 13:11:59 +00:00
|
|
|
#endif
|
2014-04-12 10:59:48 +00:00
|
|
|
} ROS_SHARED_CACHE_MAP, *PROS_SHARED_CACHE_MAP;
|
2002-09-08 10:23:54 +00:00
|
|
|
|
2018-02-08 10:49:22 +00:00
|
|
|
#define READAHEAD_DISABLED 0x1
|
|
|
|
#define WRITEBEHIND_DISABLED 0x2
|
2020-11-06 08:39:31 +00:00
|
|
|
#define SHARED_CACHE_MAP_IN_CREATION 0x4
|
2020-12-22 10:31:51 +00:00
|
|
|
#define SHARED_CACHE_MAP_IN_LAZYWRITE 0x8
|
2018-02-08 10:49:22 +00:00
|
|
|
|
2014-04-12 09:31:07 +00:00
|
|
|
typedef struct _ROS_VACB
|
2001-04-09 02:45:04 +00:00
|
|
|
{
|
2014-04-12 09:31:07 +00:00
|
|
|
/* Base address of the region where the view's data is mapped. */
|
2005-06-25 17:01:17 +00:00
|
|
|
PVOID BaseAddress;
|
2014-04-12 09:31:07 +00:00
|
|
|
/* Are the contents of the view newer than those on disk. */
|
2005-06-25 17:01:17 +00:00
|
|
|
BOOLEAN Dirty;
|
|
|
|
/* Page out in progress */
|
|
|
|
BOOLEAN PageOut;
|
|
|
|
ULONG MappedCount;
|
2014-04-12 10:59:48 +00:00
|
|
|
/* Entry in the list of VACBs for this shared cache map. */
|
|
|
|
LIST_ENTRY CacheMapVacbListEntry;
|
2014-04-12 09:31:07 +00:00
|
|
|
/* Entry in the list of VACBs which are dirty. */
|
|
|
|
LIST_ENTRY DirtyVacbListEntry;
|
|
|
|
/* Entry in the list of VACBs. */
|
|
|
|
LIST_ENTRY VacbLruListEntry;
|
|
|
|
/* Offset in the file which this view maps. */
|
2014-04-12 11:51:46 +00:00
|
|
|
LARGE_INTEGER FileOffset;
|
2005-06-25 17:01:17 +00:00
|
|
|
/* Number of references. */
|
2018-03-24 18:15:16 +00:00
|
|
|
volatile ULONG ReferenceCount;
|
2014-04-12 10:59:48 +00:00
|
|
|
/* Pointer to the shared cache map for the file which this view maps data for. */
|
|
|
|
PROS_SHARED_CACHE_MAP SharedCacheMap;
|
2014-04-12 09:31:07 +00:00
|
|
|
/* Pointer to the next VACB in a chain. */
|
|
|
|
} ROS_VACB, *PROS_VACB;
|
2003-01-11 15:21:09 +00:00
|
|
|
|
|
|
|
typedef struct _INTERNAL_BCB
|
|
|
|
{
|
2016-05-26 12:09:05 +00:00
|
|
|
/* Lock */
|
|
|
|
ERESOURCE Lock;
|
2005-06-25 17:01:17 +00:00
|
|
|
PUBLIC_BCB PFCB;
|
2014-04-12 09:31:07 +00:00
|
|
|
PROS_VACB Vacb;
|
2018-10-05 17:43:10 +00:00
|
|
|
ULONG PinCount;
|
2005-06-25 17:01:17 +00:00
|
|
|
CSHORT RefCount; /* (At offset 0x34 on WinNT4) */
|
2018-09-02 12:37:47 +00:00
|
|
|
LIST_ENTRY BcbEntry;
|
2003-01-11 15:21:09 +00:00
|
|
|
} INTERNAL_BCB, *PINTERNAL_BCB;
|
2001-04-09 02:45:04 +00:00
|
|
|
|
2018-02-07 17:10:59 +00:00
|
|
|
typedef struct _LAZY_WRITER
|
|
|
|
{
|
|
|
|
LIST_ENTRY WorkQueue;
|
|
|
|
KDPC ScanDpc;
|
|
|
|
KTIMER ScanTimer;
|
|
|
|
BOOLEAN ScanActive;
|
|
|
|
BOOLEAN OtherWork;
|
|
|
|
BOOLEAN PendingTeardown;
|
|
|
|
} LAZY_WRITER, *PLAZY_WRITER;
|
|
|
|
|
|
|
|
typedef struct _WORK_QUEUE_ENTRY
|
|
|
|
{
|
|
|
|
LIST_ENTRY WorkQueueLinks;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
FILE_OBJECT *FileObject;
|
|
|
|
} Read;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
SHARED_CACHE_MAP *SharedCacheMap;
|
|
|
|
} Write;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
KEVENT *Event;
|
|
|
|
} Event;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned long Reason;
|
|
|
|
} Notification;
|
|
|
|
} Parameters;
|
|
|
|
unsigned char Function;
|
|
|
|
} WORK_QUEUE_ENTRY, *PWORK_QUEUE_ENTRY;
|
|
|
|
|
2018-02-09 09:06:17 +00:00
|
|
|
typedef enum _WORK_QUEUE_FUNCTIONS
|
|
|
|
{
|
|
|
|
ReadAhead = 1,
|
|
|
|
WriteBehind = 2,
|
2018-12-23 13:43:17 +00:00
|
|
|
LazyScan = 3,
|
2018-02-09 09:06:17 +00:00
|
|
|
SetDone = 4,
|
|
|
|
} WORK_QUEUE_FUNCTIONS, *PWORK_QUEUE_FUNCTIONS;
|
|
|
|
|
2018-02-07 17:10:59 +00:00
|
|
|
extern LAZY_WRITER LazyWriter;
|
|
|
|
|
2018-01-28 10:55:40 +00:00
|
|
|
#define NODE_TYPE_DEFERRED_WRITE 0x02FC
|
2018-02-07 22:18:54 +00:00
|
|
|
#define NODE_TYPE_PRIVATE_MAP 0x02FE
|
2018-02-08 10:02:07 +00:00
|
|
|
#define NODE_TYPE_SHARED_MAP 0x02FF
|
2018-01-28 10:55:40 +00:00
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2007-05-09 00:29:38 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CcPfInitializePrefetcher(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2007-01-21 04:46:38 +00:00
|
|
|
CcMdlReadComplete2(
|
2013-07-16 22:37:01 +00:00
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PMDL MemoryDescriptorList
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2007-02-26 20:22:55 +00:00
|
|
|
CcMdlWriteComplete2(
|
|
|
|
IN PFILE_OBJECT FileObject,
|
2005-06-25 17:01:17 +00:00
|
|
|
IN PLARGE_INTEGER FileOffset,
|
2007-02-26 20:22:55 +00:00
|
|
|
IN PMDL MdlChain
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
2003-01-11 15:21:09 +00:00
|
|
|
|
2004-08-25 15:08:29 +00:00
|
|
|
NTSTATUS
|
2021-05-24 06:56:17 +00:00
|
|
|
CcRosFlushVacb(
|
|
|
|
_In_ PROS_VACB Vacb,
|
|
|
|
_Out_opt_ PIO_STATUS_BLOCK Iosb
|
|
|
|
);
|
2004-08-25 15:08:29 +00:00
|
|
|
|
2001-04-03 17:25:50 +00:00
|
|
|
NTSTATUS
|
2014-04-12 09:31:07 +00:00
|
|
|
CcRosGetVacb(
|
2014-04-12 10:59:48 +00:00
|
|
|
PROS_SHARED_CACHE_MAP SharedCacheMap,
|
2014-08-31 12:56:36 +00:00
|
|
|
LONGLONG FileOffset,
|
2014-04-12 09:31:07 +00:00
|
|
|
PROS_VACB *Vacb
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
|
|
|
|
2020-11-06 08:39:31 +00:00
|
|
|
BOOLEAN
|
|
|
|
CcRosEnsureVacbResident(
|
|
|
|
_In_ PROS_VACB Vacb,
|
|
|
|
_In_ BOOLEAN Wait,
|
|
|
|
_In_ BOOLEAN NoRead,
|
|
|
|
_In_ ULONG Offset,
|
|
|
|
_In_ ULONG Length
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-02-07 17:10:59 +00:00
|
|
|
VOID
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
2001-04-09 02:45:04 +00:00
|
|
|
CcInitView(VOID);
|
|
|
|
|
2018-01-23 18:07:25 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CcShutdownLazyWriter(VOID);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2007-01-25 17:51:45 +00:00
|
|
|
BOOLEAN
|
2006-10-08 04:05:27 +00:00
|
|
|
CcInitializeCacheManager(VOID);
|
2003-01-11 15:21:09 +00:00
|
|
|
|
2014-04-12 09:31:07 +00:00
|
|
|
PROS_VACB
|
|
|
|
CcRosLookupVacb(
|
2014-04-12 10:59:48 +00:00
|
|
|
PROS_SHARED_CACHE_MAP SharedCacheMap,
|
2014-08-31 12:56:36 +00:00
|
|
|
LONGLONG FileOffset
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
2003-01-11 15:21:09 +00:00
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
2003-01-11 15:21:09 +00:00
|
|
|
CcInitCacheZeroPage(VOID);
|
|
|
|
|
2018-01-23 20:48:29 +00:00
|
|
|
VOID
|
|
|
|
CcRosMarkDirtyVacb(
|
|
|
|
PROS_VACB Vacb);
|
|
|
|
|
2018-02-01 07:35:27 +00:00
|
|
|
VOID
|
|
|
|
CcRosUnmarkDirtyVacb(
|
|
|
|
PROS_VACB Vacb,
|
|
|
|
BOOLEAN LockViews);
|
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
NTSTATUS
|
2005-06-25 17:01:17 +00:00
|
|
|
CcRosFlushDirtyPages(
|
2005-08-13 13:11:59 +00:00
|
|
|
ULONG Target,
|
2011-12-21 19:46:07 +00:00
|
|
|
PULONG Count,
|
2018-01-23 18:07:25 +00:00
|
|
|
BOOLEAN Wait,
|
|
|
|
BOOLEAN CalledFromLazy
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
2002-08-14 20:58:39 +00:00
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2003-01-11 15:21:09 +00:00
|
|
|
CcRosDereferenceCache(PFILE_OBJECT FileObject);
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2003-01-11 15:21:09 +00:00
|
|
|
CcRosReferenceCache(PFILE_OBJECT FileObject);
|
|
|
|
|
|
|
|
NTSTATUS
|
2014-04-12 09:31:07 +00:00
|
|
|
CcRosReleaseVacb(
|
2014-04-12 10:59:48 +00:00
|
|
|
PROS_SHARED_CACHE_MAP SharedCacheMap,
|
2014-04-12 09:31:07 +00:00
|
|
|
PROS_VACB Vacb,
|
2005-09-14 01:44:19 +00:00
|
|
|
BOOLEAN Dirty,
|
|
|
|
BOOLEAN Mapped
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
|
|
|
|
2005-08-13 13:11:59 +00:00
|
|
|
NTSTATUS
|
2014-04-12 09:31:07 +00:00
|
|
|
CcRosRequestVacb(
|
2014-04-12 10:59:48 +00:00
|
|
|
PROS_SHARED_CACHE_MAP SharedCacheMap,
|
2014-08-31 12:56:36 +00:00
|
|
|
LONGLONG FileOffset,
|
2014-04-12 09:31:07 +00:00
|
|
|
PROS_VACB *Vacb
|
2005-06-25 17:01:17 +00:00
|
|
|
);
|
2003-01-11 15:21:09 +00:00
|
|
|
|
2009-07-24 17:35:28 +00:00
|
|
|
NTSTATUS
|
|
|
|
CcRosInitializeFileCache(
|
|
|
|
PFILE_OBJECT FileObject,
|
2014-08-17 21:47:43 +00:00
|
|
|
PCC_FILE_SIZES FileSizes,
|
2016-05-26 11:50:42 +00:00
|
|
|
BOOLEAN PinAccess,
|
2009-07-24 17:35:28 +00:00
|
|
|
PCACHE_MANAGER_CALLBACKS CallBacks,
|
|
|
|
PVOID LazyWriterContext
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
CcRosReleaseFileCache(
|
|
|
|
PFILE_OBJECT FileObject
|
|
|
|
);
|
|
|
|
|
2018-01-23 18:07:25 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CcShutdownSystem(VOID);
|
|
|
|
|
2018-02-07 17:10:59 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CcWorkerThread(PVOID Parameter);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CcScanDpc(
|
|
|
|
PKDPC Dpc,
|
|
|
|
PVOID DeferredContext,
|
|
|
|
PVOID SystemArgument1,
|
|
|
|
PVOID SystemArgument2);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
CcScheduleLazyWriteScan(BOOLEAN NoDelay);
|
|
|
|
|
2018-02-07 19:27:55 +00:00
|
|
|
VOID
|
|
|
|
CcPostDeferredWrites(VOID);
|
|
|
|
|
2018-02-09 09:06:17 +00:00
|
|
|
VOID
|
|
|
|
CcPostWorkQueue(
|
|
|
|
IN PWORK_QUEUE_ENTRY WorkItem,
|
|
|
|
IN PLIST_ENTRY WorkQueue);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
CcPerformReadAhead(
|
|
|
|
IN PFILE_OBJECT FileObject);
|
|
|
|
|
2016-07-24 17:10:30 +00:00
|
|
|
NTSTATUS
|
2018-04-08 17:09:36 +00:00
|
|
|
CcRosInternalFreeVacb(
|
|
|
|
IN PROS_VACB Vacb);
|
2016-07-24 17:10:30 +00:00
|
|
|
|
2013-09-29 20:52:23 +00:00
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
2014-04-12 09:31:07 +00:00
|
|
|
DoRangesIntersect(
|
2014-08-31 12:56:36 +00:00
|
|
|
_In_ LONGLONG Offset1,
|
|
|
|
_In_ LONGLONG Length1,
|
|
|
|
_In_ LONGLONG Offset2,
|
|
|
|
_In_ LONGLONG Length2)
|
2013-09-29 20:52:23 +00:00
|
|
|
{
|
|
|
|
if (Offset1 + Length1 <= Offset2)
|
|
|
|
return FALSE;
|
|
|
|
if (Offset2 + Length2 <= Offset1)
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
2014-04-12 09:31:07 +00:00
|
|
|
IsPointInRange(
|
2014-08-31 12:56:36 +00:00
|
|
|
_In_ LONGLONG Offset1,
|
|
|
|
_In_ LONGLONG Length1,
|
|
|
|
_In_ LONGLONG Point)
|
2013-09-29 20:52:23 +00:00
|
|
|
{
|
2014-04-12 09:31:07 +00:00
|
|
|
return DoRangesIntersect(Offset1, Length1, Point, 1);
|
2013-09-29 20:52:23 +00:00
|
|
|
}
|
2018-02-07 17:10:59 +00:00
|
|
|
|
|
|
|
#define CcBugCheck(A, B, C) KeBugCheckEx(CACHE_MANAGER, BugCheckFileId | ((ULONG)(__LINE__)), A, B, C)
|
2018-03-17 10:56:25 +00:00
|
|
|
|
|
|
|
#if DBG
|
|
|
|
#define CcRosVacbIncRefCount(vacb) CcRosVacbIncRefCount_(vacb,__FILE__,__LINE__)
|
|
|
|
#define CcRosVacbDecRefCount(vacb) CcRosVacbDecRefCount_(vacb,__FILE__,__LINE__)
|
2018-03-24 18:15:16 +00:00
|
|
|
#define CcRosVacbGetRefCount(vacb) CcRosVacbGetRefCount_(vacb,__FILE__,__LINE__)
|
2018-03-17 10:56:25 +00:00
|
|
|
|
2018-03-24 18:15:16 +00:00
|
|
|
ULONG
|
2018-03-17 10:56:25 +00:00
|
|
|
CcRosVacbIncRefCount_(
|
|
|
|
PROS_VACB vacb,
|
|
|
|
PCSTR file,
|
|
|
|
INT line);
|
|
|
|
|
2018-03-24 18:15:16 +00:00
|
|
|
ULONG
|
2018-03-17 10:56:25 +00:00
|
|
|
CcRosVacbDecRefCount_(
|
|
|
|
PROS_VACB vacb,
|
|
|
|
PCSTR file,
|
|
|
|
INT line);
|
|
|
|
|
2018-03-24 18:15:16 +00:00
|
|
|
ULONG
|
|
|
|
CcRosVacbGetRefCount_(
|
|
|
|
PROS_VACB vacb,
|
|
|
|
PCSTR file,
|
|
|
|
INT line);
|
|
|
|
|
2018-03-17 10:56:25 +00:00
|
|
|
#else
|
2018-03-24 18:15:16 +00:00
|
|
|
#define CcRosVacbIncRefCount(vacb) InterlockedIncrement((PLONG)&(vacb)->ReferenceCount)
|
2018-04-08 17:09:36 +00:00
|
|
|
FORCEINLINE
|
|
|
|
ULONG
|
|
|
|
CcRosVacbDecRefCount(
|
|
|
|
PROS_VACB vacb)
|
|
|
|
{
|
|
|
|
ULONG Refs;
|
|
|
|
|
|
|
|
Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount);
|
|
|
|
if (Refs == 0)
|
|
|
|
{
|
|
|
|
CcRosInternalFreeVacb(vacb);
|
|
|
|
}
|
|
|
|
return Refs;
|
|
|
|
}
|
2018-03-24 18:15:16 +00:00
|
|
|
#define CcRosVacbGetRefCount(vacb) InterlockedCompareExchange((PLONG)&(vacb)->ReferenceCount, 0, 0)
|
2018-03-17 10:56:25 +00:00
|
|
|
#endif
|
2022-10-01 20:48:46 +00:00
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
CcRosFreeOneUnusedVacb(
|
|
|
|
VOID);
|