Commit | Line | Data |
---|---|---|
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 | ||
15 | #include <linux/list.h> | |
16 | ||
17 | enum kmsg_dump_reason { | |
18 | KMSG_DUMP_OOPS, | |
19 | KMSG_DUMP_PANIC, | |
20 | }; | |
21 | ||
22 | /** | |
23 | * struct kmsg_dumper - kernel crash message dumper structure | |
24 | * @dump: The callback which gets called on crashes. The buffer is passed | |
25 | * as two sections, where s1 (length l1) contains the older | |
26 | * messages and s2 (length l2) contains the newer. | |
27 | * @list: Entry in the dumper list (private) | |
28 | * @registered: Flag that specifies if this is already registered | |
29 | */ | |
30 | struct kmsg_dumper { | |
31 | void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason, | |
32 | const char *s1, unsigned long l1, | |
33 | const char *s2, unsigned long l2); | |
34 | struct list_head list; | |
35 | int registered; | |
36 | }; | |
37 | ||
595dd3d8 | 38 | #ifdef CONFIG_PRINTK |
456b565c SK |
39 | void kmsg_dump(enum kmsg_dump_reason reason); |
40 | ||
41 | int kmsg_dump_register(struct kmsg_dumper *dumper); | |
42 | ||
43 | int kmsg_dump_unregister(struct kmsg_dumper *dumper); | |
595dd3d8 RD |
44 | #else |
45 | static inline void kmsg_dump(enum kmsg_dump_reason reason) | |
46 | { | |
47 | } | |
48 | ||
49 | static inline int kmsg_dump_register(struct kmsg_dumper *dumper) | |
50 | { | |
51 | return -EINVAL; | |
52 | } | |
53 | ||
54 | static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper) | |
55 | { | |
56 | return -EINVAL; | |
57 | } | |
58 | #endif | |
456b565c SK |
59 | |
60 | #endif /* _LINUX_KMSG_DUMP_H */ |