1 /* 2 * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "ATATracing.h" 7 8 #include <stdarg.h> 9 10 static char sTraceBuffer[256]; 11 static uint32 sTraceBufferOffset = 0; 12 13 void 14 ata_trace_printf(uint32 flags, const char *format, ...) 15 { 16 va_list arguments; 17 va_start(arguments, format); 18 sTraceBufferOffset += vsnprintf(sTraceBuffer + sTraceBufferOffset, 19 sizeof(sTraceBuffer) - sTraceBufferOffset, format, arguments); 20 va_end(arguments); 21 22 if (flags & ATA_TRACE_FLUSH) { 23 #if ATA_TRACING 24 ktrace_printf(sTraceBuffer); 25 #endif 26 if (flags & ATA_TRACE_SYSLOG) 27 dprintf(sTraceBuffer); 28 29 sTraceBufferOffset = 0; 30 } 31 } 32