1 /*
2 * Copyright 2009, Michael Lotz, mmlr@mlotz.ch.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef ATA_TRACING_H
6 #define ATA_TRACING_H
7
8 #include <tracing.h>
9
10 #define ATA_TRACE_START 0x00
11 #define ATA_TRACE_FLUSH 0x01
12 #define ATA_TRACE_SYSLOG 0x02
13 #define ATA_TRACE_FLUSH_SYSLOG 0x03
14
15 #if ATA_TRACING
16 #define TRACE(x...) { \
17 ata_trace_printf(ATA_TRACE_START, \
18 "ata%s: ", _DebugContext()); \
19 ata_trace_printf(ATA_TRACE_FLUSH, x); \
20 }
21 #define TRACE_FUNCTION(x...) { \
22 ata_trace_printf(ATA_TRACE_START, \
23 "ata%s: %s: ", _DebugContext(), \
24 __FUNCTION__); \
25 ata_trace_printf(ATA_TRACE_FLUSH, x); \
26 }
27 #else
28 #define TRACE(x...) /* nothing */
29 #define TRACE_FUNCTION(x...) /* nothing */
30 #endif
31
32 #define TRACE_ALWAYS(x...) { \
33 ata_trace_printf(ATA_TRACE_START, \
34 "ata%s: ", _DebugContext()); \
35 ata_trace_printf(ATA_TRACE_FLUSH_SYSLOG, x); \
36 }
37 #define TRACE_ERROR(x...) { \
38 ata_trace_printf(ATA_TRACE_START, \
39 "ata%s error: ", _DebugContext()); \
40 ata_trace_printf(ATA_TRACE_FLUSH_SYSLOG, x); \
41 }
42
43 void ata_trace_printf(uint32 flags, const char *format, ...);
44
45 inline const char *
_DebugContext()46 _DebugContext()
47 {
48 return "";
49 }
50
51 #endif // ATA_TRACING_H
52