162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __PSTORE_INTERNAL_H__
362306a36Sopenharmony_ci#define __PSTORE_INTERNAL_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/types.h>
662306a36Sopenharmony_ci#include <linux/time.h>
762306a36Sopenharmony_ci#include <linux/pstore.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciextern unsigned long kmsg_bytes;
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifdef CONFIG_PSTORE_FTRACE
1262306a36Sopenharmony_ciextern void pstore_register_ftrace(void);
1362306a36Sopenharmony_ciextern void pstore_unregister_ftrace(void);
1462306a36Sopenharmony_cissize_t pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
1562306a36Sopenharmony_ci				  const char *src_log, size_t src_log_size);
1662306a36Sopenharmony_ci#else
1762306a36Sopenharmony_cistatic inline void pstore_register_ftrace(void) {}
1862306a36Sopenharmony_cistatic inline void pstore_unregister_ftrace(void) {}
1962306a36Sopenharmony_cistatic inline ssize_t
2062306a36Sopenharmony_cipstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
2162306a36Sopenharmony_ci			  const char *src_log, size_t src_log_size)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	*dest_log_size = 0;
2462306a36Sopenharmony_ci	return 0;
2562306a36Sopenharmony_ci}
2662306a36Sopenharmony_ci#endif
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#ifdef CONFIG_PSTORE_PMSG
2962306a36Sopenharmony_ciextern void pstore_register_pmsg(void);
3062306a36Sopenharmony_ciextern void pstore_unregister_pmsg(void);
3162306a36Sopenharmony_ci#else
3262306a36Sopenharmony_cistatic inline void pstore_register_pmsg(void) {}
3362306a36Sopenharmony_cistatic inline void pstore_unregister_pmsg(void) {}
3462306a36Sopenharmony_ci#endif
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciextern struct pstore_info *psinfo;
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciextern void	pstore_set_kmsg_bytes(int);
3962306a36Sopenharmony_ciextern void	pstore_get_records(int);
4062306a36Sopenharmony_ciextern void	pstore_get_backend_records(struct pstore_info *psi,
4162306a36Sopenharmony_ci					   struct dentry *root, int quiet);
4262306a36Sopenharmony_ciextern int	pstore_put_backend_records(struct pstore_info *psi);
4362306a36Sopenharmony_ciextern int	pstore_mkfile(struct dentry *root,
4462306a36Sopenharmony_ci			      struct pstore_record *record);
4562306a36Sopenharmony_ciextern void	pstore_record_init(struct pstore_record *record,
4662306a36Sopenharmony_ci				   struct pstore_info *psi);
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* Called during pstore init/exit. */
4962306a36Sopenharmony_ciint __init	pstore_init_fs(void);
5062306a36Sopenharmony_civoid __exit	pstore_exit_fs(void);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#endif
53