printk.h 747 B

123456789101112131415161718192021222324252627282930313233343536
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM printk
  3. #if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_PRINTK_H
  5. #include <linux/tracepoint.h>
  6. TRACE_EVENT(console,
  7. TP_PROTO(const char *text, size_t len),
  8. TP_ARGS(text, len),
  9. TP_STRUCT__entry(
  10. __dynamic_array(char, msg, len + 1)
  11. ),
  12. TP_fast_assign(
  13. /*
  14. * Each trace entry is printed in a new line.
  15. * If the msg finishes with '\n', cut it off
  16. * to avoid blank lines in the trace.
  17. */
  18. if ((len > 0) && (text[len-1] == '\n'))
  19. len -= 1;
  20. memcpy(__get_str(msg), text, len);
  21. __get_str(msg)[len] = 0;
  22. ),
  23. TP_printk("%s", __get_str(msg))
  24. );
  25. #endif /* _TRACE_PRINTK_H */
  26. /* This part must be outside protection */
  27. #include <trace/define_trace.h>