18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __PSTORE_INTERNAL_H__
38c2ecf20Sopenharmony_ci#define __PSTORE_INTERNAL_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci#include <linux/time.h>
78c2ecf20Sopenharmony_ci#include <linux/pstore.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define PSTORE_DEFAULT_KMSG_BYTES 10240
108c2ecf20Sopenharmony_ciextern unsigned long kmsg_bytes;
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifdef CONFIG_PSTORE_FTRACE
138c2ecf20Sopenharmony_ciextern void pstore_register_ftrace(void);
148c2ecf20Sopenharmony_ciextern void pstore_unregister_ftrace(void);
158c2ecf20Sopenharmony_cissize_t pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
168c2ecf20Sopenharmony_ci				  const char *src_log, size_t src_log_size);
178c2ecf20Sopenharmony_ci#else
188c2ecf20Sopenharmony_cistatic inline void pstore_register_ftrace(void) {}
198c2ecf20Sopenharmony_cistatic inline void pstore_unregister_ftrace(void) {}
208c2ecf20Sopenharmony_cistatic inline ssize_t
218c2ecf20Sopenharmony_cipstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
228c2ecf20Sopenharmony_ci			  const char *src_log, size_t src_log_size)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	*dest_log_size = 0;
258c2ecf20Sopenharmony_ci	return 0;
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifdef CONFIG_PSTORE_PMSG
308c2ecf20Sopenharmony_ciextern void pstore_register_pmsg(void);
318c2ecf20Sopenharmony_ciextern void pstore_unregister_pmsg(void);
328c2ecf20Sopenharmony_ci#else
338c2ecf20Sopenharmony_cistatic inline void pstore_register_pmsg(void) {}
348c2ecf20Sopenharmony_cistatic inline void pstore_unregister_pmsg(void) {}
358c2ecf20Sopenharmony_ci#endif
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciextern struct pstore_info *psinfo;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciextern void	pstore_set_kmsg_bytes(int);
408c2ecf20Sopenharmony_ciextern void	pstore_get_records(int);
418c2ecf20Sopenharmony_ciextern void	pstore_get_backend_records(struct pstore_info *psi,
428c2ecf20Sopenharmony_ci					   struct dentry *root, int quiet);
438c2ecf20Sopenharmony_ciextern int	pstore_put_backend_records(struct pstore_info *psi);
448c2ecf20Sopenharmony_ciextern int	pstore_mkfile(struct dentry *root,
458c2ecf20Sopenharmony_ci			      struct pstore_record *record);
468c2ecf20Sopenharmony_ciextern void	pstore_record_init(struct pstore_record *record,
478c2ecf20Sopenharmony_ci				   struct pstore_info *psi);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Called during pstore init/exit. */
508c2ecf20Sopenharmony_ciint __init	pstore_init_fs(void);
518c2ecf20Sopenharmony_civoid __exit	pstore_exit_fs(void);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#ifdef CONFIG_PSTORE_BLACKBOX
548c2ecf20Sopenharmony_ciextern bool pstore_ready;                /* flag which pstore_blk is ready */
558c2ecf20Sopenharmony_ci#endif
568c2ecf20Sopenharmony_ci#endif
57