printk.h 786 B

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