Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef __PSTORE_ZONE_H_
0004 #define __PSTORE_ZONE_H_
0005 
0006 #include <linux/types.h>
0007 
0008 typedef ssize_t (*pstore_zone_read_op)(char *, size_t, loff_t);
0009 typedef ssize_t (*pstore_zone_write_op)(const char *, size_t, loff_t);
0010 typedef ssize_t (*pstore_zone_erase_op)(size_t, loff_t);
0011 /**
0012  * struct pstore_zone_info - pstore/zone back-end driver structure
0013  *
0014  * @owner:  Module which is responsible for this back-end driver.
0015  * @name:   Name of the back-end driver.
0016  * @total_size: The total size in bytes pstore/zone can use. It must be greater
0017  *      than 4096 and be multiple of 4096.
0018  * @kmsg_size:  The size of oops/panic zone. Zero means disabled, otherwise,
0019  *      it must be multiple of SECTOR_SIZE(512 Bytes).
0020  * @max_reason: Maximum kmsg dump reason to store.
0021  * @pmsg_size:  The size of pmsg zone which is the same as @kmsg_size.
0022  * @console_size:The size of console zone which is the same as @kmsg_size.
0023  * @ftrace_size:The size of ftrace zone which is the same as @kmsg_size.
0024  * @read:   The general read operation. Both of the function parameters
0025  *      @size and @offset are relative value to storage.
0026  *      On success, the number of bytes should be returned, others
0027  *      mean error.
0028  * @write:  The same as @read, but the following error number:
0029  *      -EBUSY means try to write again later.
0030  *      -ENOMSG means to try next zone.
0031  * @erase:  The general erase operation for device with special removing
0032  *      job. Both of the function parameters @size and @offset are
0033  *      relative value to storage.
0034  *      Return 0 on success and others on failure.
0035  * @panic_write:The write operation only used for panic case. It's optional
0036  *      if you do not care panic log. The parameters are relative
0037  *      value to storage.
0038  *      On success, the number of bytes should be returned, others
0039  *      excluding -ENOMSG mean error. -ENOMSG means to try next zone.
0040  */
0041 struct pstore_zone_info {
0042     struct module *owner;
0043     const char *name;
0044 
0045     unsigned long total_size;
0046     unsigned long kmsg_size;
0047     int max_reason;
0048     unsigned long pmsg_size;
0049     unsigned long console_size;
0050     unsigned long ftrace_size;
0051     pstore_zone_read_op read;
0052     pstore_zone_write_op write;
0053     pstore_zone_erase_op erase;
0054     pstore_zone_write_op panic_write;
0055 };
0056 
0057 extern int register_pstore_zone(struct pstore_zone_info *info);
0058 extern void unregister_pstore_zone(struct pstore_zone_info *info);
0059 
0060 #endif