pstore/blk: Introduce backend for block devices
[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);
10/**
11 * struct pstore_zone_info - pstore/zone back-end driver structure
12 *
13 * @owner: Module which is responsible for this back-end driver.
14 * @name: Name of the back-end driver.
15 * @total_size: The total size in bytes pstore/zone can use. It must be greater
16 * than 4096 and be multiple of 4096.
17 * @kmsg_size: The size of oops/panic zone. Zero means disabled, otherwise,
18 * it must be multiple of SECTOR_SIZE(512 Bytes).
19 * @max_reason: Maximum kmsg dump reason to store.
20 * @read: The general read operation. Both of the function parameters
21 * @size and @offset are relative value to storage.
22 * On success, the number of bytes should be returned, others
23 * means error.
24 * @write: The same as @read.
25 * @panic_write:The write operation only used for panic case. It's optional
26 * if you do not care panic log. The parameters and return value
27 * are the same as @read.
28 */
29struct pstore_zone_info {
30 struct module *owner;
31 const char *name;
32
33 unsigned long total_size;
34 unsigned long kmsg_size;
35 int max_reason;
36 pstore_zone_read_op read;
37 pstore_zone_write_op write;
38 pstore_zone_write_op panic_write;
39};
40
41extern int register_pstore_zone(struct pstore_zone_info *info);
42extern void unregister_pstore_zone(struct pstore_zone_info *info);
43
44#endif