From 0257bce2eddf514a70f38ee435a0ac1cf807fea2 Mon Sep 17 00:00:00 2001 From: Vitalii Chulak Date: Thu, 9 Jan 2025 19:25:12 +0200 Subject: [PATCH] Exclude trace.h from clang-fomart for viomem Signed-off-by: Vitalii Chulak --- .github/workflows/clang-format.yml | 2 +- viomem/sys/trace.h | 127 +++++++++++++++-------------- 2 files changed, 67 insertions(+), 62 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d201c031a..8bd92c85a 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -9,7 +9,7 @@ jobs: matrix: path: - check: '.' - exclude: './pvpanic/pvpanic/trace.h|./NetKVM|./pciserial|./viocrypt|./viofs|./viogpu|./vioinput|./viomem|./viorng|./vioscsi|./vioserial|./viosock|./viostor|./VirtIO' + exclude: './pvpanic/pvpanic/trace.h|./viomem/sys/trace.h|./NetKVM|./pciserial|./viocrypt|./viofs|./viogpu|./vioinput|./viomem|./viorng|./vioscsi|./vioserial|./viosock|./viostor|./VirtIO' - check: 'VirtIO' exclude: '' diff --git a/viomem/sys/trace.h b/viomem/sys/trace.h index 05a356db1..6d3bdd8db 100644 --- a/viomem/sys/trace.h +++ b/viomem/sys/trace.h @@ -29,7 +29,7 @@ #include "kdebugprint.h" #if ((OSVERSION_MASK & NTDDI_VERSION) > NTDDI_VISTA) -// #define EVENT_TRACING +//#define EVENT_TRACING #endif #if !defined(EVENT_TRACING) @@ -38,79 +38,84 @@ extern ULONG driverDebugFlags; extern int driverDebugLevel; #if !defined(TRACE_LEVEL_NONE) -#define TRACE_LEVEL_NONE 0 -#define TRACE_LEVEL_FATAL 1 -#define TRACE_LEVEL_ERROR 2 -#define TRACE_LEVEL_WARNING 3 -#define TRACE_LEVEL_INFORMATION 4 -#define TRACE_LEVEL_VERBOSE 5 -#define TRACE_LEVEL_RESERVED6 6 -#define TRACE_LEVEL_RESERVED7 7 -#define TRACE_LEVEL_RESERVED8 8 -#define TRACE_LEVEL_RESERVED9 9 + #define TRACE_LEVEL_NONE 0 + #define TRACE_LEVEL_FATAL 1 + #define TRACE_LEVEL_ERROR 2 + #define TRACE_LEVEL_WARNING 3 + #define TRACE_LEVEL_INFORMATION 4 + #define TRACE_LEVEL_VERBOSE 5 + #define TRACE_LEVEL_RESERVED6 6 + #define TRACE_LEVEL_RESERVED7 7 + #define TRACE_LEVEL_RESERVED8 8 + #define TRACE_LEVEL_RESERVED9 9 #endif + // // Define Debug Flags // -#define DBG_INIT 0x00000001 -#define DBG_PNP 0x00000002 -#define DBG_POWER 0x00000004 -#define DBG_WMI 0x00000008 -#define DBG_CREATE_CLOSE 0x00000010 -#define DBG_IOCTLS 0x00000020 -#define DBG_WRITE 0x00000040 -#define DBG_READ 0x00000080 -#define DBG_DPC 0x00000100 -#define DBG_INTERRUPT 0x00000200 -#define DBG_LOCKS 0x00000400 -#define DBG_QUEUEING 0x00000800 -#define DBG_HW_ACCESS 0x00001000 +#define DBG_INIT 0x00000001 +#define DBG_PNP 0x00000002 +#define DBG_POWER 0x00000004 +#define DBG_WMI 0x00000008 +#define DBG_CREATE_CLOSE 0x00000010 +#define DBG_IOCTLS 0x00000020 +#define DBG_WRITE 0x00000040 +#define DBG_READ 0x00000080 +#define DBG_DPC 0x00000100 +#define DBG_INTERRUPT 0x00000200 +#define DBG_LOCKS 0x00000400 +#define DBG_QUEUEING 0x00000800 +#define DBG_HW_ACCESS 0x00001000 #define TraceEvents(level, flags, message, ...) VirtioDebugPrintProc(message, __VA_ARGS__) -#define WPP_INIT_TRACING(a, b) +#define WPP_INIT_TRACING(a,b) #define WPP_CLEANUP(DriverObject) #else #define WPP_CHECK_FOR_NULL_STRING -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID(ViomemTraceGuid, \ - (08cb9471, 36fb, 46ee, 998b, d1bfbe1c4899), \ - WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \ - WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \ - WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \ - WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \ - WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \ - WPP_DEFINE_BIT(DBG_IOCTLS) /* bit 5 = 0x00000020 */ \ - WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \ - WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \ - WPP_DEFINE_BIT(DBG_DPC) /* bit 8 = 0x00000100 */ \ - WPP_DEFINE_BIT(DBG_INTERRUPT) /* bit 9 = 0x00000200 */ \ - WPP_DEFINE_BIT(DBG_LOCKS) /* bit 10 = 0x00000400 */ \ - WPP_DEFINE_BIT(DBG_QUEUEING) /* bit 11 = 0x00000800 */ \ - WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_##flag).Level >= level) - -#define WPP_LEVEL_FLAGS_LOGGER(lvl, flags) WPP_LEVEL_LOGGER(flags) - -#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_##flags).Level >= lvl) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); -// end_wpp -// +#define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID(ViomemTraceGuid,(08cb9471,36fb,46ee,998b,d1bfbe1c4899), \ + WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \ + WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \ + WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \ + WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \ + WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \ + WPP_DEFINE_BIT(DBG_IOCTLS) /* bit 5 = 0x00000020 */ \ + WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \ + WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \ + WPP_DEFINE_BIT(DBG_DPC) /* bit 8 = 0x00000100 */ \ + WPP_DEFINE_BIT(DBG_INTERRUPT) /* bit 9 = 0x00000200 */ \ + WPP_DEFINE_BIT(DBG_LOCKS) /* bit 10 = 0x00000400 */ \ + WPP_DEFINE_BIT(DBG_QUEUEING) /* bit 11 = 0x00000800 */ \ + WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \ + ) + + +#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ + WPP_LEVEL_LOGGER(flag) + +#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ + (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) + +#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ + WPP_LEVEL_LOGGER(flags) + +#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ + (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) + + // + // This comment block is scanned by the trace preprocessor to define our + // Trace function. + // + // begin_wpp config + // FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); + // FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); + // end_wpp + // #endif -void InitializeDebugPrints(IN PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath); +void InitializeDebugPrints(IN PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);