blob: 7fb219042f13d149b10502f2969fb7603f27e62a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Anton Vorontsov060287b2012-07-09 17:10:41 -07002#ifndef __PSTORE_INTERNAL_H__
3#define __PSTORE_INTERNAL_H__
4
Anton Vorontsov67a101f2012-07-17 11:37:07 -07005#include <linux/types.h>
6#include <linux/time.h>
Anton Vorontsov060287b2012-07-09 17:10:41 -07007#include <linux/pstore.h>
8
David Howells349d7432017-07-05 16:24:34 +01009#define PSTORE_DEFAULT_KMSG_BYTES 10240
10extern unsigned long kmsg_bytes;
11
Anton Vorontsov65f8c952012-07-17 14:26:15 -070012#ifdef CONFIG_PSTORE_FTRACE
13extern void pstore_register_ftrace(void);
Geliang Tangee1d2672015-10-20 00:39:03 -070014extern void pstore_unregister_ftrace(void);
Kees Cook16a58302020-05-08 08:42:12 -070015ssize_t pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
16 const char *src_log, size_t src_log_size);
Anton Vorontsov65f8c952012-07-17 14:26:15 -070017#else
18static inline void pstore_register_ftrace(void) {}
Geliang Tangee1d2672015-10-20 00:39:03 -070019static inline void pstore_unregister_ftrace(void) {}
Kees Cook16a58302020-05-08 08:42:12 -070020static inline ssize_t
21pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
22 const char *src_log, size_t src_log_size)
23{
24 *dest_log_size = 0;
25 return 0;
26}
Anton Vorontsov65f8c952012-07-17 14:26:15 -070027#endif
28
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080029#ifdef CONFIG_PSTORE_PMSG
30extern void pstore_register_pmsg(void);
Geliang Tangee1d2672015-10-20 00:39:03 -070031extern void pstore_unregister_pmsg(void);
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080032#else
33static inline void pstore_register_pmsg(void) {}
Geliang Tangee1d2672015-10-20 00:39:03 -070034static inline void pstore_unregister_pmsg(void) {}
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080035#endif
36
Anton Vorontsov060287b2012-07-09 17:10:41 -070037extern struct pstore_info *psinfo;
38
Luck, Tony366f7e72011-03-18 15:33:43 -070039extern void pstore_set_kmsg_bytes(int);
Luck, Tony6dda9262011-08-11 15:14:39 -070040extern void pstore_get_records(int);
Kees Cook3a7d2fd2017-04-27 15:53:21 -070041extern void pstore_get_backend_records(struct pstore_info *psi,
42 struct dentry *root, int quiet);
Kees Cook609e28bb2020-05-04 19:46:53 -070043extern int pstore_put_backend_records(struct pstore_info *psi);
Kees Cook3a7d2fd2017-04-27 15:53:21 -070044extern int pstore_mkfile(struct dentry *root,
45 struct pstore_record *record);
Kees Cooke581ca82017-05-19 15:10:31 -070046extern void pstore_record_init(struct pstore_record *record,
47 struct pstore_info *psi);
Anton Vorontsov060287b2012-07-09 17:10:41 -070048
Kees Cookcb095af2018-10-18 11:17:42 -070049/* Called during pstore init/exit. */
50int __init pstore_init_fs(void);
51void __exit pstore_exit_fs(void);
Kees Cookfe1d4752018-03-06 15:57:38 -080052
Anton Vorontsov060287b2012-07-09 17:10:41 -070053#endif