Author: hpoussin
Date: Mon Dec 17 00:00:44 2007
New Revision: 31286
URL:
http://svn.reactos.org/svn/reactos?rev=31286&view=rev
Log:
Use kernel facilities to change debug level at runtime
Modified:
trunk/reactos/drivers/network/tcpip/include/debug.h
trunk/reactos/drivers/network/tcpip/tcpip/main.c
trunk/reactos/include/ddk/winddk.h
trunk/reactos/lib/drivers/ip/network/routines.c
Modified: trunk/reactos/drivers/network/tcpip/include/debug.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/debug.h (original)
+++ trunk/reactos/drivers/network/tcpip/include/debug.h Mon Dec 17 00:00:44 2007
@@ -9,11 +9,9 @@
#ifndef __DEBUG_H
#define __DEBUG_H
-#define NORMAL_MASK 0x000000FF
-#define SPECIAL_MASK 0xFFFFFF00
-#define MIN_TRACE 0x00000001
-#define MID_TRACE 0x00000002
-#define MAX_TRACE 0x00000003
+#define MIN_TRACE DPFLTR_WARNING_LEVEL
+#define MID_TRACE DPFLTR_WARNING_LEVEL | DPFLTR_TRACE_LEVEL
+#define MAX_TRACE DPFLTR_WARNING_LEVEL | DPFLTR_TRACE_LEVEL | DPFLTR_INFO_LEVEL
#define DEBUG_CHECK 0x00000100
#define DEBUG_MEMORY 0x00000200
@@ -33,33 +31,14 @@
#define DEBUG_CPOINT 0x00800000
#define DEBUG_LOCK 0x01000000
#define DEBUG_INFO 0x02000000
-#define DEBUG_ULTRA 0xFFFFFFFF
+#define DEBUG_ULTRA 0x7FFFFFFF
#ifdef DBG
-extern DWORD DebugTraceLevel;
-
-#ifdef _MSC_VER
-
+#define REMOVE_PARENS(...) __VA_ARGS__
#define TI_DbgPrint(_t_, _x_) \
- if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
- ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
- DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
- DbgPrint _x_ ; \
- }
-
-#else /* _MSC_VER */
-
-#define TI_DbgPrint(_t_, _x_) \
- if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
- ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
- DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
- DbgPrint _x_ ; \
- }
-
-#endif /* _MSC_VER */
-
-#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
+ DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) & DPFLTR_MASK, "(%s:%d) ", __FILE__,
__LINE__), \
+ DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) & DPFLTR_MASK, REMOVE_PARENS _x_)
#else /* DBG */
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/main.c (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/main.c Mon Dec 17 00:00:44 2007
@@ -419,10 +419,7 @@
}
-NTSTATUS
-#ifndef _MSC_VER
-STDCALL
-#endif
+NTSTATUS NTAPI
TiDispatchInternal(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@@ -526,10 +523,7 @@
}
-NTSTATUS
-#ifndef _MSC_VER
-STDCALL
-#endif
+NTSTATUS NTAPI
TiDispatch(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@@ -687,10 +681,7 @@
}
}
-NTSTATUS
-#ifndef _MSC_VER
-STDCALL
-#endif
+NTSTATUS NTAPI
DriverEntry(
PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
@@ -870,14 +861,14 @@
DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000;
KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc);
+ /* ROS Hack: ideally, DebugTraceLevel variable should be removed */
+ DbgSetDebugFilterState(DPFLTR_TCPIP_ID, DebugTraceLevel, TRUE);
+
return STATUS_SUCCESS;
}
-VOID
-#ifndef _MSC_VER
-STDCALL
-#endif
+VOID NTAPI
IPAddInterface(
DWORD Unknown0,
DWORD Unknown1,
@@ -889,10 +880,7 @@
}
-VOID
-#ifndef _MSC_VER
-STDCALL
-#endif
+VOID NTAPI
IPDelInterface(
DWORD Unknown0)
{
@@ -900,10 +888,7 @@
}
-VOID
-#ifndef _MSC_VER
-STDCALL
-#endif
+VOID NTAPI
LookupRoute(
DWORD Unknown0,
DWORD Unknown1)
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=3…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h (original)
+++ trunk/reactos/include/ddk/winddk.h Mon Dec 17 00:00:44 2007
@@ -240,7 +240,12 @@
#define DPFLTR_INFO_LEVEL 3
#define DPFLTR_MASK 0x80000000
-#define DPFLTR_PREFETCHER_ID 63
+typedef enum _DPFLTR_TYPE
+{
+ DPFLTR_I8042PRT_ID = 15,
+ DPFLTR_TCPIP_ID = 30,
+ DPFLTR_PREFETCHER_ID = 65,
+} DPFLTR_TYPE;
#define MAXIMUM_PROCESSORS 32
Modified: trunk/reactos/lib/drivers/ip/network/routines.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/routines.c (original)
+++ trunk/reactos/lib/drivers/ip/network/routines.c Mon Dec 17 00:00:44 2007
@@ -94,7 +94,8 @@
UINT Length;
PCHAR Buffer;
- if ((DebugTraceLevel & (DEBUG_PBUFFER | DEBUG_TCP)) != (DEBUG_PBUFFER |
DEBUG_TCP)) {
+ if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) ||
+ !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK)) {
return;
}
@@ -137,7 +138,8 @@
PNDIS_BUFFER NextBuffer;
PCHAR CharBuffer;
- if ((DebugTraceLevel & (DEBUG_PBUFFER | DEBUG_IP)) != (DEBUG_PBUFFER | DEBUG_IP))
{
+ if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) ||
+ !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK)) {
return;
}