Skip to content

Commit

Permalink
Exclude trace.h from clang-fomart for viomem
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <vitalii@daynix.com>
  • Loading branch information
Jedoku committed Jan 9, 2025
1 parent 90d1091 commit 0257bce
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''

Expand Down
127 changes: 66 additions & 61 deletions viomem/sys/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

0 comments on commit 0257bce

Please sign in to comment.