printk: Remove kdb_syslog_data
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / kmsg_dump.h
CommitLineData
456b565c
SK
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
ac562241 15#include <linux/errno.h>
456b565c
SK
16#include <linux/list.h>
17
c22ab332
MG
18/*
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.
22 */
456b565c 23enum kmsg_dump_reason {
e2ae715d 24 KMSG_DUMP_UNDEF,
456b565c 25 KMSG_DUMP_PANIC,
c22ab332
MG
26 KMSG_DUMP_OOPS,
27 KMSG_DUMP_EMERG,
04c6862c
SA
28 KMSG_DUMP_RESTART,
29 KMSG_DUMP_HALT,
30 KMSG_DUMP_POWEROFF,
456b565c
SK
31};
32
33/**
34 * struct kmsg_dumper - kernel crash message dumper structure
456b565c 35 * @list: Entry in the dumper list (private)
e2ae715d
KS
36 * @dump: Call into dumping code which will retrieve the data with
37 * through the record iterator
38 * @max_reason: filter for highest reason number that should be dumped
456b565c
SK
39 * @registered: Flag that specifies if this is already registered
40 */
41struct kmsg_dumper {
456b565c 42 struct list_head list;
e2ae715d
KS
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 /* private state of the kmsg iterator */
49 u32 cur_idx;
50 u32 next_idx;
51 u64 cur_seq;
52 u64 next_seq;
456b565c
SK
53};
54
595dd3d8 55#ifdef CONFIG_PRINTK
456b565c
SK
56void kmsg_dump(enum kmsg_dump_reason reason);
57
e2ae715d
KS
58bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
59 char *line, size_t size, size_t *len);
60
61bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
62 char *buf, size_t size, size_t *len);
63
64void kmsg_dump_rewind(struct kmsg_dumper *dumper);
65
456b565c
SK
66int kmsg_dump_register(struct kmsg_dumper *dumper);
67
68int kmsg_dump_unregister(struct kmsg_dumper *dumper);
595dd3d8
RD
69#else
70static inline void kmsg_dump(enum kmsg_dump_reason reason)
71{
72}
73
246f6f2f
KS
74static inline bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
75 const char *line, size_t size, size_t *len)
e2ae715d
KS
76{
77 return false;
78}
79
246f6f2f
KS
80static inline bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
81 char *buf, size_t size, size_t *len)
e2ae715d
KS
82{
83 return false;
84}
85
246f6f2f 86static inline void kmsg_dump_rewind(struct kmsg_dumper *dumper)
e2ae715d
KS
87{
88}
89
595dd3d8
RD
90static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
91{
92 return -EINVAL;
93}
94
95static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
96{
97 return -EINVAL;
98}
99#endif
456b565c
SK
100
101#endif /* _LINUX_KMSG_DUMP_H */