BCB,CACHE_SEGMENT: Disabled for libcaptive as we use only PUBLIC_BCB
[reactos.git] / ntoskrnl / include / internal / cc.h
1 #ifndef __INCLUDE_INTERNAL_CC_H
2 #define __INCLUDE_INTERNAL_CC_H
3 /* $Id$ */
4 #include <ddk/ntifs.h>
5
6 #ifndef LIBCAPTIVE
7
8 typedef struct _BCB
9 {
10   LIST_ENTRY BcbSegmentListHead;
11   PFILE_OBJECT FileObject;
12   ULONG CacheSegmentSize;
13   LARGE_INTEGER AllocationSize;
14   LARGE_INTEGER FileSize;
15   KSPIN_LOCK BcbLock;
16   ULONG RefCount;
17 } BCB;
18
19 typedef struct _CACHE_SEGMENT
20 {
21   /* Base address of the region where the cache segment data is mapped. */
22   PVOID BaseAddress;
23   /* 
24    * Memory area representing the region where the cache segment data is 
25    * mapped. 
26    */
27   struct _MEMORY_AREA* MemoryArea;
28   /* Are the contents of the cache segment data valid. */
29   BOOLEAN Valid;
30   /* Are the contents of the cache segment data newer than those on disk. */
31   BOOLEAN Dirty;
32   ULONG MappedCount;
33   /* Entry in the list of segments for this BCB. */
34   LIST_ENTRY BcbSegmentListEntry;
35   /* Entry in the list of segments which are dirty. */
36   LIST_ENTRY DirtySegmentListEntry;
37   /* Entry in the list of segments. */
38   LIST_ENTRY CacheSegmentListEntry;
39   LIST_ENTRY CacheSegmentLRUListEntry;
40   /* Offset in the file which this cache segment maps. */
41   ULONG FileOffset;
42   /* Lock. */
43   FAST_MUTEX Lock;
44   /* Number of references. */
45   ULONG ReferenceCount;
46   /* Pointer to the BCB for the file which this cache segment maps data for. */
47   PBCB Bcb;
48   /* Pointer to the next cache segment in a chain. */
49   struct _CACHE_SEGMENT* NextInChain;
50 } CACHE_SEGMENT;
51
52 #endif /* LIBCAPTIVE */
53
54 VOID STDCALL
55 CcMdlReadCompleteDev (IN        PMDL            MdlChain,
56                       IN        PDEVICE_OBJECT  DeviceObject);
57 NTSTATUS
58 CcRosGetCacheSegment(PBCB Bcb,
59                   ULONG FileOffset,
60                   PULONG BaseOffset,
61                   PVOID* BaseAddress,
62                   PBOOLEAN UptoDate,
63                   PCACHE_SEGMENT* CacheSeg);
64 VOID
65 CcInitView(VOID);
66
67
68 NTSTATUS STDCALL CcRosFreeCacheSegment(PBCB, PCACHE_SEGMENT);
69
70 NTSTATUS ReadCacheSegment(PCACHE_SEGMENT CacheSeg);
71
72 NTSTATUS WriteCacheSegment(PCACHE_SEGMENT CacheSeg);
73
74 VOID CcInit(VOID);
75 NTSTATUS
76 CcRosUnmapCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty);
77 NTSTATUS
78 CcRosSuggestFreeCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty);
79 NTSTATUS
80 CcRosGetCacheSegmentChain(PBCB Bcb,
81                           ULONG FileOffset,
82                           ULONG Length,
83                           PCACHE_SEGMENT* CacheSeg);
84 VOID CcInitCacheZeroPage(VOID);
85 NTSTATUS
86 CcRosMarkDirtyCacheSegment(PBCB Bcb, ULONG FileOffset);
87 NTSTATUS
88 CcRosFlushDirtyPages(ULONG Target, PULONG Count);
89
90 VOID CcRosDereferenceCache(PFILE_OBJECT FileObject);
91 VOID CcRosReferenceCache(PFILE_OBJECT FileObject);
92
93 #endif