Author: fireball
Date: Fri Jan 2 06:26:07 2009
New Revision: 38506
URL:
http://svn.reactos.org/svn/reactos?rev=38506&view=rev
Log:
- CcCanIWrite reports TRUE now, since we don't have situations yet when writing is not
possible.
- CcSetReadAheadGranularity is ignored for now and won't spam debug log with
unimplemented messages.
- CcMapData ignores the MAP_WAIT flag, it's not much of a deal for now.
Modified:
branches/cache_manager_rewrite/cc/cacheman.c
branches/cache_manager_rewrite/cc/copy.c
branches/cache_manager_rewrite/cc/pin.c
Modified: branches/cache_manager_rewrite/cc/cacheman.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/cc/cachem…
==============================================================================
--- branches/cache_manager_rewrite/cc/cacheman.c [iso-8859-1] (original)
+++ branches/cache_manager_rewrite/cc/cacheman.c [iso-8859-1] Fri Jan 2 06:26:07 2009
@@ -113,8 +113,8 @@
* @unimplemented
*/
VOID NTAPI
-CcSetReadAheadGranularity (IN PFILE_OBJECT FileObject,
+CcSetReadAheadGranularity (IN PFILE_OBJECT FileObject,
IN ULONG Granularity)
{
- UNIMPLEMENTED;
+ DPRINT("CcSetReadAheadGranularity(0x%p 0x%x)\n", FileObject, Granularity);
}
Modified: branches/cache_manager_rewrite/cc/copy.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/cc/copy.c…
==============================================================================
--- branches/cache_manager_rewrite/cc/copy.c [iso-8859-1] (original)
+++ branches/cache_manager_rewrite/cc/copy.c [iso-8859-1] Fri Jan 2 06:26:07 2009
@@ -67,18 +67,18 @@
* @unimplemented
*/
BOOLEAN NTAPI
-CcCanIWrite (IN PFILE_OBJECT FileObject,
- IN ULONG BytesToWrite,
- IN BOOLEAN Wait,
+CcCanIWrite (IN PFILE_OBJECT FileObject,
+ IN ULONG BytesToWrite,
+ IN BOOLEAN Wait,
IN BOOLEAN Retrying)
{
- UNIMPLEMENTED;
- return FALSE;
+ /* Our cache is always ready for writes */
+ return TRUE;
}
BOOLEAN NTAPI
CcCopyRead (IN PFILE_OBJECT FileObject,
- IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
IN BOOLEAN Wait,
OUT PVOID Buffer,
Modified: branches/cache_manager_rewrite/cc/pin.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/cc/pin.c?…
==============================================================================
--- branches/cache_manager_rewrite/cc/pin.c [iso-8859-1] (original)
+++ branches/cache_manager_rewrite/cc/pin.c [iso-8859-1] Fri Jan 2 06:26:07 2009
@@ -53,14 +53,14 @@
ASSERT (FileOffset);
ASSERT (piBcb);
ASSERT (pBuffer);
- ASSERT (Flags & MAP_WAIT);
+ //ASSERT (Flags & MAP_WAIT);
if (!(Flags & MAP_WAIT))
{
- DPRINT1("Reading without MAP_WAIT flag is not implented yet.\n");
- *piBcb = NULL;
- *pBuffer = NULL;
- return FALSE;
+ DPRINT1("Reading without MAP_WAIT flag!\n");
+ //*piBcb = NULL;
+ //*pBuffer = NULL;
+ //return FALSE;
}
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
@@ -263,7 +263,7 @@
* @unimplemented
*/
VOID NTAPI
-CcUnpinDataForThread (IN PVOID Bcb,
+CcUnpinDataForThread (IN PVOID Bcb,
IN ERESOURCE_THREAD ResourceThreadId)
{
UNIMPLEMENTED;
@@ -275,18 +275,39 @@
VOID NTAPI
CcRepinBcb (IN PVOID Bcb)
{
-// PINTERNAL_BCB iBcb = Bcb;
+#if 0
+ PINTERNAL_BCB iBcb = Bcb;
// iBcb->RefCount++;
- UNIMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-VOID NTAPI
-CcUnpinRepinnedBcb (IN PVOID Bcb,
- IN BOOLEAN WriteThrough,
- IN PIO_STATUS_BLOCK IoStatus)
-{
- KeBugCheck(CACHE_MANAGER);
-}
+ ExAcquireFastMutex (&CcCacheViewLock);
+ iBcb->Bcb->CacheView[iBcb->Index]->RefCount++;
+ ExReleaseFastMutex (&CcCacheViewLock);
+#endif
+}
+
+/*
+ * @implemented
+ */
+VOID NTAPI
+CcUnpinRepinnedBcb (IN PVOID Bcb,
+ IN BOOLEAN WriteThrough,
+ OUT PIO_STATUS_BLOCK IoStatus)
+{
+#if 0
+ PINTERNAL_BCB iBcb = Bcb;
+
+ DPRINT ("CcUnpinRepinnedBcb(%x)\n", Bcb);
+
+ ExAcquireFastMutex (&CcCacheViewLock);
+ iBcb->Bcb->CacheView[iBcb->Index]->RefCount--;
+ if (iBcb->Bcb->CacheView[iBcb->Index]->RefCount == 0)
+ {
+ RemoveEntryList (&iBcb->Bcb->CacheView[iBcb->Index]->ListEntry);
+ InsertHeadList (&CcFreeCacheViewListHead,
&iBcb->Bcb->CacheView[iBcb->Index]->ListEntry);
+ }
+ ExReleaseFastMutex (&CcCacheViewLock);
+ ExFreeToNPagedLookasideList (&iBcbLookasideList, iBcb);
+#endif
+ IoStatus->Status = STATUS_SUCCESS;
+
+ DPRINT ("CcUnpinRepinnedBcb done\n");
+}