Windows: IOCTL_AFS_GET_DEBUG_TRACE
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 17 Apr 2013 22:21:40 +0000 (18:21 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 8 May 2013 00:40:11 +0000 (17:40 -0700)
Pemrit the active Debug Flags and Trace Configuration to be
queried by administrators.

Change-Id: I0c798bd2eb8f2445c81a0b45c112bbaf72d15522
Reviewed-on: http://gerrit.openafs.org/9798
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/common/AFSUserIoctl.h
src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/fs/AFSLogSupport.cpp
src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h

index 8cf87c6..938c32f 100644 (file)
@@ -95,4 +95,6 @@
 
 #define IOCTL_AFS_GET_REPARSE_POLICY            CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101D, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
+#define IOCTL_AFS_GET_DEBUG_TRACE               CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101E, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
 #endif /* _AFS_USER_IOCTL_H */
index 614004b..b60ab7e 100644 (file)
@@ -435,9 +435,11 @@ AFSCheckIoctlPermissions( IN ULONG ControlCode)
             return STATUS_SUCCESS;
 
         case IOCTL_AFS_CONFIGURE_DEBUG_TRACE:
+       case IOCTL_AFS_GET_DEBUG_TRACE:
         case IOCTL_AFS_GET_TRACE_BUFFER:
         case IOCTL_AFS_FORCE_CRASH:
 
+
             //
             // Any admin can call these
             //
@@ -701,6 +703,31 @@ AFSProcessControlRequest( IN PIRP Irp)
                 break;
             }
 
+           case IOCTL_AFS_GET_DEBUG_TRACE:
+           {
+
+               AFSTraceConfigCB *pTraceInfo = (AFSTraceConfigCB *)Irp->AssociatedIrp.SystemBuffer;
+
+               if( pTraceInfo == NULL ||
+                   pIrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof( AFSTraceConfigCB))
+               {
+
+                   ntStatus = STATUS_INVALID_PARAMETER;
+
+                   break;
+               }
+
+               ntStatus = AFSGetTraceConfig( pTraceInfo);
+
+               if ( NT_SUCCESS( ntStatus))
+               {
+
+                   Irp->IoStatus.Information = sizeof( AFSTraceConfigCB);
+               }
+
+               break;
+           }
+
             case IOCTL_AFS_GET_TRACE_BUFFER:
             {
 
index eb52f18..779c090 100644 (file)
@@ -421,6 +421,31 @@ try_exit:
 }
 
 NTSTATUS
+AFSGetTraceConfig( OUT AFSTraceConfigCB *TraceInfo)
+{
+    NTSTATUS ntStatus = STATUS_SUCCESS;
+
+    __Enter
+    {
+
+       AFSAcquireExcl( &AFSDbgLogLock,
+                       TRUE);
+
+       TraceInfo->TraceLevel = AFSTraceLevel;
+
+       TraceInfo->TraceBufferLength = AFSDbgBufferLength;
+
+       TraceInfo->Subsystem = AFSTraceComponent;
+
+       TraceInfo->DebugFlags = AFSDebugFlags;
+
+       AFSReleaseResource( &AFSDbgLogLock);
+    }
+
+    return ntStatus;
+}
+
+NTSTATUS
 AFSGetTraceBuffer( IN ULONG TraceBufferLength,
                    OUT void *TraceBuffer,
                    OUT ULONG_PTR *CopiedLength)
index c51a5f8..55ab756 100644 (file)
@@ -787,6 +787,9 @@ NTSTATUS
 AFSConfigureTrace( IN AFSTraceConfigCB *TraceInfo);
 
 NTSTATUS
+AFSGetTraceConfig( OUT AFSTraceConfigCB *TraceInfo);
+
+NTSTATUS
 AFSGetTraceBuffer( IN ULONG TraceBufferLength,
                    OUT void *TraceBuffer,
                    OUT ULONG_PTR *CopiedLength);