X-Git-Url: http://git.etherboot.org/mirror/winof/.git/blobdiff_plain/2af6c6d5376907da8bd3efdd7dc0a97c08d1f1d3..26985ed39da7b0f32984c36620800649f50fdee5:/hw/mthca/kernel/hca_debug.h?ds=sidebyside diff --git a/hw/mthca/kernel/hca_debug.h b/hw/mthca/kernel/hca_debug.h index 9b6f1f6c..62a016cd 100644 --- a/hw/mthca/kernel/hca_debug.h +++ b/hw/mthca/kernel/hca_debug.h @@ -33,6 +33,7 @@ #ifndef _HCA_DEBUG_H_ #define _HCA_DEBUG_H_ +#include extern uint32_t g_mthca_dbg_level; extern uint32_t g_mthca_dbg_flags; @@ -42,10 +43,18 @@ extern UCHAR g_slog_buf[ MAX_LOG_BUF_LEN ]; static void _build_str( const char * format, ... ) { + NTSTATUS status; va_list p_arg; va_start(p_arg, format); - vsprintf((char *)g_slog_buf , format , p_arg); - swprintf(g_wlog_buf, L"%S", g_slog_buf); + status = RtlStringCbVPrintfA((char *)g_slog_buf, sizeof(g_slog_buf), format , p_arg); + if (status) + goto end; + + status = RtlStringCchPrintfW(g_wlog_buf, sizeof(g_wlog_buf)/sizeof(g_wlog_buf[0]), L"%S", g_slog_buf); + if (status) + goto end; + +end: va_end(p_arg); } @@ -63,7 +72,11 @@ static void _build_str( const char * format, ... ) } #define HCA_PRINT_EV_MDEV(_level_,_flag_,_msg_) \ - HCA_PRINT_TO_EVENT_LOG(mdev->ext->cl_ext.p_self_do,_level_,_flag_,_msg_) +{\ + if(mdev) {\ + HCA_PRINT_TO_EVENT_LOG(mdev->ext->cl_ext.p_self_do,_level_,_flag_,_msg_)\ + }\ +}\ #if defined(EVENT_TRACING) @@ -148,9 +161,9 @@ static void _build_str( const char * format, ... ) int __lvl = _level_; \ if (g_mthca_dbg_level >= (_level_) && \ (g_mthca_dbg_flags & (_flag_))) { \ - DbgPrint ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \ - if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR*** "); \ - DbgPrint _msg_; \ + cl_dbg_out ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \ + if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR*** "); \ + cl_dbg_out _msg_; \ } \ }