kmsg_dump.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * linux/include/kmsg_dump.h
  3. *
  4. * Copyright (C) 2009 Net Insight AB
  5. *
  6. * Author: Simon Kagstrom <simon.kagstrom@netinsight.net>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file COPYING in the main directory of this archive
  10. * for more details.
  11. */
  12. #ifndef _LINUX_KMSG_DUMP_H
  13. #define _LINUX_KMSG_DUMP_H
  14. #include <linux/list.h>
  15. enum kmsg_dump_reason {
  16. KMSG_DUMP_OOPS,
  17. KMSG_DUMP_PANIC,
  18. KMSG_DUMP_KEXEC,
  19. };
  20. /**
  21. * struct kmsg_dumper - kernel crash message dumper structure
  22. * @dump: The callback which gets called on crashes. The buffer is passed
  23. * as two sections, where s1 (length l1) contains the older
  24. * messages and s2 (length l2) contains the newer.
  25. * @list: Entry in the dumper list (private)
  26. * @registered: Flag that specifies if this is already registered
  27. */
  28. struct kmsg_dumper {
  29. void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
  30. const char *s1, unsigned long l1,
  31. const char *s2, unsigned long l2);
  32. struct list_head list;
  33. int registered;
  34. };
  35. #ifdef CONFIG_PRINTK
  36. void kmsg_dump(enum kmsg_dump_reason reason);
  37. int kmsg_dump_register(struct kmsg_dumper *dumper);
  38. int kmsg_dump_unregister(struct kmsg_dumper *dumper);
  39. #else
  40. static inline void kmsg_dump(enum kmsg_dump_reason reason)
  41. {
  42. }
  43. static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
  44. {
  45. return -EINVAL;
  46. }
  47. static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
  48. {
  49. return -EINVAL;
  50. }
  51. #endif
  52. #endif /* _LINUX_KMSG_DUMP_H */