[NTOS:CC] Add some debug prints

svn path=/trunk/; revision=65529
This commit is contained in:
Hervé Poussineau 2014-11-29 21:43:39 +00:00
parent bac6bdb719
commit 1cec297066
7 changed files with 147 additions and 0 deletions

View file

@ -101,6 +101,9 @@ CcSetAdditionalCacheAttributes (
IN BOOLEAN DisableWriteBehind
)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p DisableReadAhead=%d DisableWriteBehind=%d\n",
FileObject, DisableReadAhead, DisableWriteBehind);
UNIMPLEMENTED;
}
@ -114,6 +117,9 @@ CcSetBcbOwnerPointer (
IN PVOID Owner
)
{
CCTRACE(CC_API_DEBUG, "Bcb=%p Owner=%p\n",
Bcb, Owner);
UNIMPLEMENTED;
}
@ -127,6 +133,9 @@ CcSetDirtyPageThreshold (
IN ULONG DirtyPageThreshold
)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p DirtyPageThreshold=%lu\n",
FileObject, DirtyPageThreshold);
UNIMPLEMENTED;
}
@ -140,5 +149,8 @@ CcSetReadAheadGranularity (
IN ULONG Granularity
)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p Granularity=%lu\n",
FileObject, Granularity);
UNIMPLEMENTED;
}

View file

@ -26,6 +26,7 @@ typedef enum _CC_COPY_OPERATION
CcOperationZero
} CC_COPY_OPERATION;
ULONG CcRosTraceLevel = 0;
ULONG CcFastMdlReadWait;
ULONG CcFastMdlReadNotPossible;
ULONG CcFastReadNotPossible;
@ -339,6 +340,8 @@ CcCanIWrite (
IN BOOLEAN Wait,
IN BOOLEAN Retrying)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p BytesToWrite=%lu Wait=%d Retrying=%d\n",
FileObject, BytesToWrite, Wait, Retrying);
UNIMPLEMENTED;
return FALSE;
}
@ -356,6 +359,9 @@ CcCopyRead (
OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu Wait=%d\n",
FileObject, FileOffset->QuadPart, Length, Wait);
DPRINT("CcCopyRead(FileObject 0x%p, FileOffset %I64x, "
"Length %lu, Wait %u, Buffer 0x%p, IoStatus 0x%p)\n",
FileObject, FileOffset->QuadPart, Length, Wait,
@ -384,6 +390,9 @@ CcCopyWrite (
{
IO_STATUS_BLOCK IoStatus;
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu Wait=%d Buffer=%p\n",
FileObject, FileOffset->QuadPart, Length, Wait, Buffer);
DPRINT("CcCopyWrite(FileObject 0x%p, FileOffset %I64x, "
"Length %lu, Wait %u, Buffer 0x%p)\n",
FileObject, FileOffset->QuadPart, Length, Wait, Buffer);
@ -410,6 +419,9 @@ CcDeferWrite (
IN ULONG BytesToWrite,
IN BOOLEAN Retrying)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p PostRoutine=%p Context1=%p Context2=%p BytesToWrite=%lu Retrying=%d\n",
FileObject, PostRoutine, Context1, Context2, BytesToWrite, Retrying);
UNIMPLEMENTED;
}
@ -426,6 +438,9 @@ CcFastCopyRead (
OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%lu Length=%lu PageCount=%lu Buffer=%p\n",
FileObject, FileOffset, Length, PageCount, Buffer);
UNIMPLEMENTED;
}
/*
@ -439,6 +454,9 @@ CcFastCopyWrite (
IN ULONG Length,
IN PVOID Buffer)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%lu Length=%lu Buffer=%p\n",
FileObject, FileOffset, Length, Buffer);
UNIMPLEMENTED;
}
@ -474,6 +492,9 @@ CcZeroData (
IO_STATUS_BLOCK Iosb;
KEVENT Event;
CCTRACE(CC_API_DEBUG, "FileObject=%p StartOffset=%I64u EndOffset=%I64u Wait=%d\n",
FileObject, StartOffset->QuadPart, EndOffset->QuadPart, Wait);
DPRINT("CcZeroData(FileObject 0x%p, StartOffset %I64x, EndOffset %I64x, "
"Wait %u)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
Wait);

View file

@ -38,6 +38,10 @@ CcGetDirtyPages (
IN PVOID Context2)
{
LARGE_INTEGER i;
CCTRACE(CC_API_DEBUG, "LogHandle=%p DirtyPageRoutine=%p Context1=%p Context2=%p\n",
LogHandle, DirtyPageRoutine, Context1, Context2);
UNIMPLEMENTED;
i.QuadPart = 0;
return i;
@ -52,6 +56,9 @@ CcGetFileObjectFromBcb (
IN PVOID Bcb)
{
PINTERNAL_BCB iBcb = (PINTERNAL_BCB)Bcb;
CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
return iBcb->Vacb->SharedCacheMap->FileObject;
}
@ -65,6 +72,9 @@ CcGetLsnForFileObject (
OUT PLARGE_INTEGER OldestLsn OPTIONAL)
{
LARGE_INTEGER i;
CCTRACE(CC_API_DEBUG, "FileObject=%p\n", FileObject);
UNIMPLEMENTED;
i.QuadPart = 0;
return i;
@ -85,6 +95,9 @@ CcInitializeCacheMap (
ASSERT(FileObject);
ASSERT(FileSizes);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileSizes=%p PinAccess=%d CallBacks=%p LazyWriterContext=%p\n",
FileObject, FileSizes, PinAccess, CallBacks, LazyWriterContext);
/* Call old ROS cache init function */
CcRosInitializeFileCache(FileObject,
FileSizes,
@ -100,6 +113,8 @@ NTAPI
CcIsThereDirtyData (
IN PVPB Vpb)
{
CCTRACE(CC_API_DEBUG, "Vpb=%p\n", Vpb);
UNIMPLEMENTED;
return FALSE;
}
@ -115,6 +130,9 @@ CcPurgeCacheSection (
IN ULONG Length,
IN BOOLEAN UninitializeCacheMaps)
{
CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu UninitializeCacheMaps=%d",
SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
//UNIMPLEMENTED;
return FALSE;
}
@ -135,6 +153,9 @@ CcSetFileSizes (
LIST_ENTRY FreeListHead;
NTSTATUS Status;
CCTRACE(CC_API_DEBUG, "FileObject=%p FileSizes=%p\n",
FileObject, FileSizes);
DPRINT("CcSetFileSizes(FileObject 0x%p, FileSizes 0x%p)\n",
FileObject, FileSizes);
DPRINT("AllocationSize %I64d, FileSize %I64d, ValidDataLength %I64d\n",
@ -222,6 +243,9 @@ CcSetLogHandleForFile (
IN PVOID LogHandle,
IN PFLUSH_TO_LSN FlushToLsnRoutine)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p LogHandle=%p FlushToLsnRoutine=%p\n",
FileObject, LogHandle, FlushToLsnRoutine);
UNIMPLEMENTED;
}
@ -237,6 +261,9 @@ CcUninitializeCacheMap (
{
NTSTATUS Status;
CCTRACE(CC_API_DEBUG, "FileObject=%p TruncateSize=%p UninitializeCompleteEvent=%p\n",
FileObject, TruncateSize, UninitializeCompleteEvent);
Status = CcRosReleaseFileCache(FileObject);
if (UninitializeCompleteEvent)
KeSetEvent(&UninitializeCompleteEvent->Event, IO_NO_INCREMENT, FALSE);

View file

@ -28,6 +28,9 @@ CcMdlRead (
OUT PIO_STATUS_BLOCK IoStatus
)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
FileObject, FileOffset->QuadPart, Length);
UNIMPLEMENTED;
}
@ -173,5 +176,8 @@ CcPrepareMdlWrite (
OUT PMDL * MdlChain,
OUT PIO_STATUS_BLOCK IoStatus)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
FileObject, FileOffset->QuadPart, Length);
UNIMPLEMENTED;
}

View file

@ -59,6 +59,8 @@ CcMapData (
if (ReadOffset % VACB_MAPPING_GRANULARITY + Length > VACB_MAPPING_GRANULARITY)
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
FileObject, FileOffset, Length, Flags);
return FALSE;
}
@ -70,6 +72,8 @@ CcMapData (
&Vacb);
if (!NT_SUCCESS(Status))
{
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
FileObject, FileOffset, Length, Flags);
return FALSE;
}
@ -78,12 +82,16 @@ CcMapData (
if (!(Flags & MAP_WAIT))
{
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
FileObject, FileOffset, Length, Flags);
return FALSE;
}
if (!NT_SUCCESS(CcReadVirtualAddress(Vacb)))
{
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
FileObject, FileOffset, Length, Flags);
return FALSE;
}
}
@ -93,6 +101,8 @@ CcMapData (
if (iBcb == NULL)
{
CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
FileObject, FileOffset, Length, Flags);
return FALSE;
}
@ -106,6 +116,8 @@ CcMapData (
iBcb->RefCount = 1;
*pBcb = (PVOID)iBcb;
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> TRUE Bcb=%p\n",
FileObject, FileOffset, Length, Flags, iBcb);
return TRUE;
}
@ -121,6 +133,9 @@ CcPinMappedData (
IN ULONG Flags,
OUT PVOID * Bcb)
{
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
FileObject, FileOffset, Length, Flags);
/* no-op for current implementation. */
return TRUE;
}
@ -138,6 +153,9 @@ CcPinRead (
OUT PVOID * Bcb,
OUT PVOID * Buffer)
{
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
FileObject, FileOffset, Length, Flags);
if (CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer))
{
if (CcPinMappedData(FileObject, FileOffset, Length, Flags, Bcb))
@ -162,6 +180,9 @@ CcPreparePinWrite (
OUT PVOID * Bcb,
OUT PVOID * Buffer)
{
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Zero=%d Flags=0x%lx\n",
FileObject, FileOffset, Length, Zero, Flags);
/*
* FIXME: This is function is similar to CcPinRead, but doesn't
* read the data if they're not present. Instead it should just
@ -182,6 +203,10 @@ CcSetDirtyPinnedData (
IN PLARGE_INTEGER Lsn)
{
PINTERNAL_BCB iBcb = Bcb;
CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n",
Bcb, Lsn);
iBcb->Dirty = TRUE;
}
@ -195,6 +220,8 @@ CcUnpinData (
{
PINTERNAL_BCB iBcb = Bcb;
CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
CcRosReleaseVacb(iBcb->Vacb->SharedCacheMap,
iBcb->Vacb,
TRUE,
@ -215,6 +242,8 @@ CcUnpinDataForThread (
IN PVOID Bcb,
IN ERESOURCE_THREAD ResourceThreadId)
{
CCTRACE(CC_API_DEBUG, "Bcb=%p ResourceThreadId=%lu\n", Bcb, ResourceThreadId);
UNIMPLEMENTED;
}
@ -227,6 +256,9 @@ CcRepinBcb (
IN PVOID Bcb)
{
PINTERNAL_BCB iBcb = Bcb;
CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
iBcb->RefCount++;
}
@ -242,6 +274,8 @@ CcUnpinRepinnedBcb (
{
PINTERNAL_BCB iBcb = Bcb;
CCTRACE(CC_API_DEBUG, "Bcb=%p WriteThrough=%d\n", Bcb, WriteThrough);
IoStatus->Status = STATUS_SUCCESS;
if (--iBcb->RefCount == 0)
{

View file

@ -909,6 +909,9 @@ CcFlushCache (
NTSTATUS Status;
KIRQL oldIrql;
CCTRACE(CC_API_DEBUG, "SectionObjectPointers=%p FileOffset=%p Length=%lu\n",
SectionObjectPointers, FileOffset, Length);
DPRINT("CcFlushCache(SectionObjectPointers 0x%p, FileOffset 0x%p, Length %lu, IoStatus 0x%p)\n",
SectionObjectPointers, FileOffset, Length, IoStatus);
@ -1209,6 +1212,9 @@ CcGetFileObjectFromSectionPtrs (
IN PSECTION_OBJECT_POINTERS SectionObjectPointers)
{
PROS_SHARED_CACHE_MAP SharedCacheMap;
CCTRACE(CC_API_DEBUG, "SectionObjectPointers=%p\n", SectionObjectPointers);
if (SectionObjectPointers && SectionObjectPointers->SharedCacheMap)
{
SharedCacheMap = SectionObjectPointers->SharedCacheMap;

View file

@ -1,5 +1,46 @@
#pragma once
//
// Define this if you want debugging support
//
#define _CC_DEBUG_ 0x00
//
// 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;
typedef struct _PF_SCENARIO_ID
{
WCHAR ScenName[30];