1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H
24
25#include <linux/time.h>
26#include <linux/kmsg_dump.h>
27#include <linux/mutex.h>
28#include <linux/types.h>
29#include <linux/spinlock.h>
30#include <linux/errno.h>
31
32
33enum pstore_type_id {
34 PSTORE_TYPE_DMESG = 0,
35 PSTORE_TYPE_MCE = 1,
36 PSTORE_TYPE_CONSOLE = 2,
37 PSTORE_TYPE_FTRACE = 3,
38
39 PSTORE_TYPE_PPC_RTAS = 4,
40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6,
42 PSTORE_TYPE_UNKNOWN = 255
43};
44
45struct module;
46
47struct pstore_info {
48 struct module *owner;
49 char *name;
50 spinlock_t buf_lock;
51 char *buf;
52 size_t bufsize;
53 struct mutex read_mutex;
54 int flags;
55 int (*open)(struct pstore_info *psi);
56 int (*close)(struct pstore_info *psi);
57 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
58 int *count, struct timespec *time, char **buf,
59 bool *compressed, struct pstore_info *psi);
60 int (*write)(enum pstore_type_id type,
61 enum kmsg_dump_reason reason, u64 *id,
62 unsigned int part, int count, bool compressed,
63 size_t size, struct pstore_info *psi);
64 int (*write_buf)(enum pstore_type_id type,
65 enum kmsg_dump_reason reason, u64 *id,
66 unsigned int part, const char *buf, bool compressed,
67 size_t size, struct pstore_info *psi);
68 int (*erase)(enum pstore_type_id type, u64 id,
69 int count, struct timespec time,
70 struct pstore_info *psi);
71 void *data;
72};
73
74#define PSTORE_FLAGS_FRAGILE 1
75
76#ifdef CONFIG_PSTORE
77extern int pstore_register(struct pstore_info *);
78extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
79#else
80static inline int
81pstore_register(struct pstore_info *psi)
82{
83 return -ENODEV;
84}
85static inline bool
86pstore_cannot_block_path(enum kmsg_dump_reason reason)
87{
88 return false;
89}
90#endif
91
92#endif
93