Merge tag 'platform-drivers-x86-v5.18-1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / include / linux / pstore_zone.h
CommitLineData
d26c3321
WL
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef __PSTORE_ZONE_H_
4#define __PSTORE_ZONE_H_
5
6#include <linux/types.h>
7
8typedef ssize_t (*pstore_zone_read_op)(char *, size_t, loff_t);
9typedef ssize_t (*pstore_zone_write_op)(const char *, size_t, loff_t);
7dcb7848 10typedef ssize_t (*pstore_zone_erase_op)(size_t, loff_t);
d26c3321
WL
11/**
12 * struct pstore_zone_info - pstore/zone back-end driver structure
13 *
14 * @owner: Module which is responsible for this back-end driver.
15 * @name: Name of the back-end driver.
16 * @total_size: The total size in bytes pstore/zone can use. It must be greater
17 * than 4096 and be multiple of 4096.
18 * @kmsg_size: The size of oops/panic zone. Zero means disabled, otherwise,
19 * it must be multiple of SECTOR_SIZE(512 Bytes).
20 * @max_reason: Maximum kmsg dump reason to store.
0dc06826 21 * @pmsg_size: The size of pmsg zone which is the same as @kmsg_size.
cc9c4d1b 22 * @console_size:The size of console zone which is the same as @kmsg_size.
34327e9f 23 * @ftrace_size:The size of ftrace zone which is the same as @kmsg_size.
d26c3321
WL
24 * @read: The general read operation. Both of the function parameters
25 * @size and @offset are relative value to storage.
26 * On success, the number of bytes should be returned, others
335426c6
WL
27 * mean error.
28 * @write: The same as @read, but the following error number:
29 * -EBUSY means try to write again later.
30 * -ENOMSG means to try next zone.
7dcb7848
WL
31 * @erase: The general erase operation for device with special removing
32 * job. Both of the function parameters @size and @offset are
33 * relative value to storage.
34 * Return 0 on success and others on failure.
d26c3321 35 * @panic_write:The write operation only used for panic case. It's optional
335426c6
WL
36 * if you do not care panic log. The parameters are relative
37 * value to storage.
38 * On success, the number of bytes should be returned, others
39 * excluding -ENOMSG mean error. -ENOMSG means to try next zone.
d26c3321
WL
40 */
41struct pstore_zone_info {
42 struct module *owner;
43 const char *name;
44
45 unsigned long total_size;
46 unsigned long kmsg_size;
47 int max_reason;
0dc06826 48 unsigned long pmsg_size;
cc9c4d1b 49 unsigned long console_size;
34327e9f 50 unsigned long ftrace_size;
d26c3321
WL
51 pstore_zone_read_op read;
52 pstore_zone_write_op write;
7dcb7848 53 pstore_zone_erase_op erase;
d26c3321
WL
54 pstore_zone_write_op panic_write;
55};
56
57extern int register_pstore_zone(struct pstore_zone_info *info);
58extern void unregister_pstore_zone(struct pstore_zone_info *info);
59
60#endif