+ntoskrnl/cc/view.c
authorshort <>
Sun, 10 Nov 2002 20:47:37 +0000 (20:47 +0000)
committershort <>
Sun, 10 Nov 2002 20:47:37 +0000 (20:47 +0000)
 - +CcRosReleaseCacheSegment()
 - +CcRosLookupCacheSegment()
 - +CcRosCreateCacheSegment()
 - +CcRosGetCacheSegment()
 - +CcRosRequestCacheSegment()
 - +CcInitView()

ntoskrnl/cc/view.c

index 7a91f81..e0baf85 100644 (file)
@@ -75,13 +75,17 @@ static LIST_ENTRY CacheSegmentLRUListHead;
 
 static FAST_MUTEX ViewLock;
 
+#ifndef LIBCAPTIVE
 void * alloca(size_t size);
 
 NTSTATUS STDCALL
 CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg);
+#endif /* LIBCAPTIVE */
 
 /* FUNCTIONS *****************************************************************/
 
+#ifndef LIBCAPTIVE
+
 NTSTATUS STATIC
 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment)
 {
@@ -217,6 +221,8 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
   return(STATUS_SUCCESS);
 }
 
+#endif /* LIBCAPTIVE */
+
 NTSTATUS STDCALL 
 CcRosReleaseCacheSegment(PBCB Bcb,
                         PCACHE_SEGMENT CacheSeg,
@@ -289,6 +295,8 @@ PCACHE_SEGMENT CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
   return(NULL);
 }
 
+#ifndef LIBCAPTIVE
+
 NTSTATUS
 CcRosMarkDirtyCacheSegment(PBCB Bcb, ULONG FileOffset)
 {
@@ -368,13 +376,17 @@ CcRosUnmapCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty)
   return(STATUS_SUCCESS);
 }
 
+#endif /* LIBCAPTIVE */
+
 NTSTATUS STATIC
 CcRosCreateCacheSegment(PBCB Bcb,
                        ULONG FileOffset,
                        PCACHE_SEGMENT* CacheSeg,
                        BOOLEAN Lock)
 {
+#ifndef LIBCAPTIVE
   ULONG i;
+#endif /* LIBCAPTIVE */
   PCACHE_SEGMENT current;
   PLIST_ENTRY current_entry;
   NTSTATUS Status;
@@ -448,6 +460,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
   {
      KeBugCheck(0);
   }
+#ifndef LIBCAPTIVE
   for (i = 0; i < (Bcb->CacheSegmentSize / PAGE_SIZE); i++)
   {
      PHYSICAL_ADDRESS Page;
@@ -468,6 +481,9 @@ CcRosCreateCacheSegment(PBCB Bcb,
        KeBugCheck(0);
      }
   }
+#else /* !LIBCAPTIVE */
+  /* libcaptive MmCreateMemoryArea() returns already allocated memory */
+#endif /* !LIBCAPTIVE */
   if (!Lock)
   {
      ExReleaseFastMutex(&current->Lock);
@@ -476,6 +492,8 @@ CcRosCreateCacheSegment(PBCB Bcb,
   return(STATUS_SUCCESS);
 }
 
+#ifndef LIBCAPTIVE
+
 NTSTATUS
 CcRosGetCacheSegmentChain(PBCB Bcb,
                          ULONG FileOffset,
@@ -531,6 +549,8 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
   return(STATUS_SUCCESS);
 }
 
+#endif /* LIBCAPTIVE */
+
 NTSTATUS
 CcRosGetCacheSegment(PBCB Bcb,
                     ULONG FileOffset,
@@ -597,6 +617,8 @@ CcRosRequestCacheSegment(PBCB Bcb,
                           CacheSeg));
 }
 
+#ifndef LIBCAPTIVE
+
 STATIC VOID 
 CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, 
                PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry, BOOLEAN Dirty)
@@ -894,6 +916,8 @@ CcGetFileObjectFromSectionPtrs(IN PSECTION_OBJECT_POINTERS SectionObjectPointers
    return NULL;
 }
 
+#endif /* LIBCAPTIVE */
+
 VOID
 CcInitView(VOID)
 {
@@ -902,8 +926,10 @@ CcInitView(VOID)
   InitializeListHead(&DirtySegmentListHead);
   InitializeListHead(&CacheSegmentLRUListHead);
   ExInitializeFastMutex(&ViewLock);
+#ifndef LIBCAPTIVE
   MmInitializeMemoryConsumer(MC_CACHE, CcRosTrimCache);
   CcInitCacheZeroPage();
+#endif /* LIBCAPTIVE */
 }
 
 /* EOF */