Skip to content

Commit

Permalink
Remove dprintf from WPP
Browse files Browse the repository at this point in the history
I have been missing dprintf output from spl
as they were redirected to WPP, and until a
windows developer convinces me that WPP is
actally useful..

Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Oct 30, 2024
1 parent 67d72af commit a63d9b6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
1 change: 0 additions & 1 deletion include/os/windows/Trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ static const int TRACE_NOISY = 8;


// begin_wpp config
// FUNC dprintf{FLAGS=MYDRIVER_ALL_INFO, LEVEL=TRACE_INFO}(MSG, ...);
// FUNC TraceEvent{FLAGS=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
// end_wpp

Expand Down
18 changes: 5 additions & 13 deletions include/os/windows/spl/sys/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ extern void printBuffer(const char *fmt, ...);
// xprintf is always printed
// dprintf is printed in DEBUG builds
// IOLog is printed in DEBUG builds (legacy from osx)
//
#ifdef DBG /* Debugging Disabled */

#ifdef LUDICROUS_SPEED

#define dprintf(...) printBuffer(__VA_ARGS__)
#define IOLog(...) printBuffer(__VA_ARGS__)
#define xprintf(...) KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, \
__VA_ARGS__))
#define TraceEvent(x, ...)
#define TraceEvent(level, ...) KdPrintEx((DPFLTR_IHVDRIVER_ID, level, \
__VA_ARGS__))

#else // LUDICROUS_SPEED

Expand All @@ -131,20 +132,11 @@ extern void printBuffer(const char *fmt, ...);

#endif // LUDICROUS_SPEED

/* Naughty to call from spl to zfs. */
void printBuffer(const char *fmt, ...);

#ifdef DBG /* Debugging Disabled */
#define SPL_DEBUG_STR " (DEBUG mode)"

#else // DBG

#define SPL_DEBUG_STR ""

#define TraceEvent(x, ...)
#define xprintf(...) DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, \
__VA_ARGS__)
#define dprintf(...)
#define IOLog(...)
#endif

#define zfs_fallthrough __attribute__((__fallthrough__))
Expand Down
6 changes: 5 additions & 1 deletion include/sys/zfs_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ extern void __dprintf(boolean_t dprint, const char *file, const char *func,
if (zfs_dbgmsg_enable) \
__dprintf(B_FALSE, __FILE__, __func__, __LINE__, __VA_ARGS__)

#ifdef ZFS_DEBUG
/*
* SPL has dprintf() that only goes to cbuf, in
* ZFS it has enhanced to go into ZFS msgbuf as well
*/
#undef dprintf
#ifdef ZFS_DEBUG
/*
* To enable this:
*
Expand Down
3 changes: 1 addition & 2 deletions module/os/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,14 @@ function(tracewpp OUTPUT_DIR SOURCE)
# no effect.

set(TRACE "TraceEvent{FLAGS=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...)")
set(DPRINT "dprintf{FLAGS=MYDRIVER_ALL_INFO, LEVEL=TRACE_INFO}(MSG, ...)")
set(CFGDIR "${WPP_DIR}/wppconfig/rev1")
set(SCAN "${WDK_ROOT}/Include/wdf/kmdf/1.9/WdfTraceEnums.h")
set(WPP_MACRO "WPP_INLINE __inline")

execute_process(COMMAND "${NATIVE_WPP_DIR}/${WDK_PLATFORM}/tracewpp.exe"
-scan:${SCAN} /D${WPP_MACRO}
-cfgdir:${CFGDIR} -I${CMAKE_CURRENT_BINARY_DIR} -odir:${NATIVE_OUTPUT_DIR} -km -func:${TRACE}
-func:${DPRINT} -gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})
-gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})

endfunction()

Expand Down
3 changes: 1 addition & 2 deletions module/os/windows/spl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ function(tracewpp OUTPUT_DIR SOURCE)
# no effect.

set(TRACE "TraceEvent{FLAGS=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...)")
set(DPRINT "dprintf{FLAGS=MYDRIVER_ALL_INFO, LEVEL=TRACE_INFO}(MSG, ...)")
set(CFGDIR "${WPP_DIR}/wppconfig/rev1")
set(SCAN "${WDK_ROOT}/Include/wdf/kmdf/1.9/WdfTraceEnums.h")
set(WPP_MACRO "WPP_INLINE __inline")

execute_process(COMMAND "${NATIVE_WPP_DIR}/${WDK_PLATFORM}/tracewpp.exe"
-scan:${SCAN} /D${WPP_MACRO}
-cfgdir:${CFGDIR} -I${CMAKE_CURRENT_BINARY_DIR} -odir:${NATIVE_OUTPUT_DIR} -km -func:${TRACE}
-func:${DPRINT} -gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})
-gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})

endfunction()

Expand Down
3 changes: 1 addition & 2 deletions module/os/windows/zfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ function(tracewpp OUTPUT_DIR SOURCE)
# no effect.

set(TRACE "TraceEvent{FLAGS=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...)")
set(DPRINT "dprintf{FLAGS=MYDRIVER_ALL_INFO, LEVEL=TRACE_INFO}(MSG, ...)")
set(CFGDIR "${WPP_DIR}/wppconfig/rev1")
set(SCAN "${WDK_ROOT}/Include/wdf/kmdf/1.9/WdfTraceEnums.h")
set(WPP_MACRO "WPP_INLINE __inline")

execute_process(COMMAND "${NATIVE_WPP_DIR}/${WDK_PLATFORM}/tracewpp.exe"
-scan:${SCAN} /D${WPP_MACRO}
-cfgdir:${CFGDIR} -I${CMAKE_CURRENT_BINARY_DIR} -odir:${NATIVE_OUTPUT_DIR} -km -func:${TRACE}
-func:${DPRINT} -gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})
-gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})

endfunction()

Expand Down
3 changes: 1 addition & 2 deletions module/zfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ function(tracewpp OUTPUT_DIR SOURCE)
# no effect.

set(TRACE "TraceEvent{FLAGS=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...)")
set(DPRINT "dprintf{FLAGS=MYDRIVER_ALL_INFO, LEVEL=TRACE_INFO}(MSG, ...)")
set(CFGDIR "${WPP_DIR}/wppconfig/rev1")
set(SCAN "${WDK_ROOT}/Include/wdf/kmdf/1.9/WdfTraceEnums.h")
set(WPP_MACRO "WPP_INLINE __inline")

execute_process(COMMAND "${NATIVE_WPP_DIR}/${WDK_PLATFORM}/tracewpp.exe"
-scan:${SCAN} /D${WPP_MACRO}
-cfgdir:${CFGDIR} -I${CMAKE_CURRENT_BINARY_DIR} -odir:${NATIVE_OUTPUT_DIR} -km -func:${TRACE}
-func:${DPRINT} -gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})
-gen:{km-default.tpl}*.tmh ${NATIVE_SOURCE})

endfunction()

Expand Down

0 comments on commit a63d9b6

Please sign in to comment.