2 * linux/include/kmsg_dump.h
4 * Copyright (C) 2009 Net Insight AB
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
12 #ifndef _LINUX_KMSG_DUMP_H
13 #define _LINUX_KMSG_DUMP_H
15 #include <linux/errno.h>
16 #include <linux/list.h>
19 * Keep this list arranged in rough order of priority. Anything listed after
20 * KMSG_DUMP_OOPS will not be logged by default unless printk.always_kmsg_dump
21 * is passed to the kernel.
23 enum kmsg_dump_reason {
33 * struct kmsg_dumper - kernel crash message dumper structure
34 * @list: Entry in the dumper list (private)
35 * @dump: Call into dumping code which will retrieve the data with
36 * through the record iterator
37 * @max_reason: filter for highest reason number that should be dumped
38 * @registered: Flag that specifies if this is already registered
41 struct list_head list;
42 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
43 enum kmsg_dump_reason max_reason;
47 /* private state of the kmsg iterator */
55 void kmsg_dump(enum kmsg_dump_reason reason);
57 bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog,
58 char *line, size_t size, size_t *len);
60 bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
61 char *line, size_t size, size_t *len);
63 bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
64 char *buf, size_t size, size_t *len);
66 void kmsg_dump_rewind_nolock(struct kmsg_dumper *dumper);
68 void kmsg_dump_rewind(struct kmsg_dumper *dumper);
70 int kmsg_dump_register(struct kmsg_dumper *dumper);
72 int kmsg_dump_unregister(struct kmsg_dumper *dumper);
74 const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason);
76 static inline void kmsg_dump(enum kmsg_dump_reason reason)
80 static inline bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper,
81 bool syslog, const char *line,
82 size_t size, size_t *len)
87 static inline bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
88 const char *line, size_t size, size_t *len)
93 static inline bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
94 char *buf, size_t size, size_t *len)
99 static inline void kmsg_dump_rewind_nolock(struct kmsg_dumper *dumper)
103 static inline void kmsg_dump_rewind(struct kmsg_dumper *dumper)
107 static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
112 static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
117 static inline const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason)
123 #endif /* _LINUX_KMSG_DUMP_H */