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 8 typedef ssize_t (*pstore_zone_read_op)(char *, size_t, loff_t); 9 typedef ssize_t (*pstore_zone_write_op)(const char *, size_t, loff_t); 10 typedef ssize_t (*pstore_zone_erase_op)(size_t, loff_t); 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. 21 * @pmsg_size: The size of pmsg zone which is the same as @kmsg_size. 22 * @console_size:The size of console zone which is the same as @kmsg_size. 23 * @ftrace_size:The size of ftrace zone which is the same as @kmsg_size. 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 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. 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. 35 * @panic_write:The write operation only used for panic case. It's optional 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. 40 */ 41 struct 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; 48 unsigned long pmsg_size; 49 unsigned long console_size; 50 unsigned long ftrace_size; 51 pstore_zone_read_op read; 52 pstore_zone_write_op write; 53 pstore_zone_erase_op erase; 54 pstore_zone_write_op panic_write; 55 }; 56 57 extern int register_pstore_zone(struct pstore_zone_info *info); 58 extern void unregister_pstore_zone(struct pstore_zone_info *info); 59 60 #endif 61