Windows: Runtime RDR Trace Toggle
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 9 Apr 2013 01:51:48 +0000 (21:51 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 9 Apr 2013 17:36:17 +0000 (10:36 -0700)
Modify the IOCTL_AFS_CONFIG_LIBRARY_TRACE DeviceIoControl message
to pass an AFSDebugTraceConfigCB which is used to toggle the value
of the Library's AFSDebugTraceFnc pointer.   When the trace log is
enabled, the AFSDbgLogMsg parameter is non-NULL and when the log is
disabled, the parameter is NULL.

Change-Id: I71b951f244b760487f2ece94409cefaa7a73ea31
Reviewed-on: http://gerrit.openafs.org/9748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSDevControl.cpp

index 6bde1b4..bdde338 100644 (file)
@@ -945,10 +945,21 @@ AFSConfigLibraryDebug()
 
             if ( pDevExt->Specific.Control.LibraryDeviceObject != NULL)
             {
+
                 RtlZeroMemory( &stConfigLib,
                                sizeof( AFSDebugTraceConfigCB));
 
-                stConfigLib.AFSDbgLogMsg = AFSDebugTraceFnc;
+                if ( BooleanFlagOn( AFSDebugFlags, AFS_DBG_TRACE_TO_DEBUGGER) ||
+                     AFSDbgBufferLength > 0)
+                {
+
+                    stConfigLib.AFSDbgLogMsg = AFSDebugTraceFnc;
+                }
+                else
+                {
+
+                    stConfigLib.AFSDbgLogMsg = NULL;
+                }
 
                 ntStatus = AFSSendDeviceIoControl( pDevExt->Specific.Control.LibraryDeviceObject,
                                                    IOCTL_AFS_CONFIG_LIBRARY_TRACE,
index b66e605..e330296 100644 (file)
@@ -442,10 +442,21 @@ AFSDevControl( IN PDEVICE_OBJECT LibDeviceObject,
 
             case IOCTL_AFS_CONFIG_LIBRARY_TRACE:
             {
+                AFSDebugTraceConfigCB *pConfigLib;
+
+                if ( pIrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof( AFSDebugTraceConfigCB))
+                {
+
+                    ntStatus = STATUS_INVALID_PARAMETER;
+
+                    break;
+                }
+
+                pConfigLib = (AFSDebugTraceConfigCB *)Irp->AssociatedIrp.SystemBuffer;
 
                 InterlockedCompareExchangePointer( (PVOID *)&AFSDebugTraceFnc,
-                                                   NULL,
-                                                   (void *)AFSDbgLogMsg);
+                                                   pConfigLib->AFSDbgLogMsg,
+                                                   (void *)pConfigLib->AFSDbgLogMsg);
 
                 break;
             }