blob: 801d6c0b170c3aaee647ad9fd1f536ae03de331a [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 +01009extern unsigned long kmsg_bytes;
10
Anton Vorontsov65f8c952012-07-17 14:26:15 -070011#ifdef CONFIG_PSTORE_FTRACE
12extern void pstore_register_ftrace(void);
Geliang Tangee1d2672015-10-20 00:39:03 -070013extern void pstore_unregister_ftrace(void);
Kees Cook16a58302020-05-08 08:42:12 -070014ssize_t pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
15 const char *src_log, size_t src_log_size);
Anton Vorontsov65f8c952012-07-17 14:26:15 -070016#else
17static inline void pstore_register_ftrace(void) {}
Geliang Tangee1d2672015-10-20 00:39:03 -070018static inline void pstore_unregister_ftrace(void) {}
Kees Cook16a58302020-05-08 08:42:12 -070019static inline ssize_t
20pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
21 const char *src_log, size_t src_log_size)
22{
23 *dest_log_size = 0;
24 return 0;
25}
Anton Vorontsov65f8c952012-07-17 14:26:15 -070026#endif
27
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080028#ifdef CONFIG_PSTORE_PMSG
29extern void pstore_register_pmsg(void);
Geliang Tangee1d2672015-10-20 00:39:03 -070030extern void pstore_unregister_pmsg(void);
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080031#else
32static inline void pstore_register_pmsg(void) {}
Geliang Tangee1d2672015-10-20 00:39:03 -070033static inline void pstore_unregister_pmsg(void) {}
Mark Salyzyn9d5438f2015-01-16 16:01:10 -080034#endif
35
Anton Vorontsov060287b2012-07-09 17:10:41 -070036extern struct pstore_info *psinfo;
37
Luck, Tony366f7e72011-03-18 15:33:43 -070038extern void pstore_set_kmsg_bytes(int);
Luck, Tony6dda9262011-08-11 15:14:39 -070039extern void pstore_get_records(int);
Kees Cook3a7d2fd2017-04-27 15:53:21 -070040extern void pstore_get_backend_records(struct pstore_info *psi,
41 struct dentry *root, int quiet);
Kees Cook609e28bb2020-05-04 19:46:53 -070042extern int pstore_put_backend_records(struct pstore_info *psi);
Kees Cook3a7d2fd2017-04-27 15:53:21 -070043extern int pstore_mkfile(struct dentry *root,
44 struct pstore_record *record);
Kees Cooke581ca82017-05-19 15:10:31 -070045extern void pstore_record_init(struct pstore_record *record,
46 struct pstore_info *psi);
Anton Vorontsov060287b2012-07-09 17:10:41 -070047
Kees Cookcb095af2018-10-18 11:17:42 -070048/* Called during pstore init/exit. */
49int __init pstore_init_fs(void);
50void __exit pstore_exit_fs(void);
Kees Cookfe1d4752018-03-06 15:57:38 -080051
Anton Vorontsov060287b2012-07-09 17:10:41 -070052#endif