This source file includes following definitions.
- kmsg_dump
- kmsg_dump_get_line_nolock
- kmsg_dump_get_line
- kmsg_dump_get_buffer
- kmsg_dump_rewind_nolock
- kmsg_dump_rewind
- kmsg_dump_register
- kmsg_dump_unregister
1
2
3
4
5
6
7
8
9
10
11
12 #ifndef _LINUX_KMSG_DUMP_H
13 #define _LINUX_KMSG_DUMP_H
14
15 #include <linux/errno.h>
16 #include <linux/list.h>
17
18
19
20
21
22
23 enum kmsg_dump_reason {
24 KMSG_DUMP_UNDEF,
25 KMSG_DUMP_PANIC,
26 KMSG_DUMP_OOPS,
27 KMSG_DUMP_EMERG,
28 KMSG_DUMP_RESTART,
29 KMSG_DUMP_HALT,
30 KMSG_DUMP_POWEROFF,
31 };
32
33
34
35
36
37
38
39
40
41 struct kmsg_dumper {
42 struct list_head list;
43 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
44 enum kmsg_dump_reason max_reason;
45 bool active;
46 bool registered;
47
48
49 u32 cur_idx;
50 u32 next_idx;
51 u64 cur_seq;
52 u64 next_seq;
53 };
54
55 #ifdef CONFIG_PRINTK
56 void kmsg_dump(enum kmsg_dump_reason reason);
57
58 bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog,
59 char *line, size_t size, size_t *len);
60
61 bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
62 char *line, size_t size, size_t *len);
63
64 bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
65 char *buf, size_t size, size_t *len);
66
67 void kmsg_dump_rewind_nolock(struct kmsg_dumper *dumper);
68
69 void kmsg_dump_rewind(struct kmsg_dumper *dumper);
70
71 int kmsg_dump_register(struct kmsg_dumper *dumper);
72
73 int kmsg_dump_unregister(struct kmsg_dumper *dumper);
74 #else
75 static inline void kmsg_dump(enum kmsg_dump_reason reason)
76 {
77 }
78
79 static inline bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper,
80 bool syslog, const char *line,
81 size_t size, size_t *len)
82 {
83 return false;
84 }
85
86 static inline bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
87 const char *line, size_t size, size_t *len)
88 {
89 return false;
90 }
91
92 static inline bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
93 char *buf, size_t size, size_t *len)
94 {
95 return false;
96 }
97
98 static inline void kmsg_dump_rewind_nolock(struct kmsg_dumper *dumper)
99 {
100 }
101
102 static inline void kmsg_dump_rewind(struct kmsg_dumper *dumper)
103 {
104 }
105
106 static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
107 {
108 return -EINVAL;
109 }
110
111 static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
112 {
113 return -EINVAL;
114 }
115 #endif
116
117 #endif