xref: /openbmc/linux/fs/pstore/internal.h (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2060287b8SAnton Vorontsov #ifndef __PSTORE_INTERNAL_H__
3060287b8SAnton Vorontsov #define __PSTORE_INTERNAL_H__
4060287b8SAnton Vorontsov 
567a101f5SAnton Vorontsov #include <linux/types.h>
667a101f5SAnton Vorontsov #include <linux/time.h>
7060287b8SAnton Vorontsov #include <linux/pstore.h>
8060287b8SAnton Vorontsov 
9349d7438SDavid Howells extern unsigned long kmsg_bytes;
10349d7438SDavid Howells 
1165f8c95eSAnton Vorontsov #ifdef CONFIG_PSTORE_FTRACE
1265f8c95eSAnton Vorontsov extern void pstore_register_ftrace(void);
13ee1d2674SGeliang Tang extern void pstore_unregister_ftrace(void);
14*16a58307SKees Cook ssize_t pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
15*16a58307SKees Cook 				  const char *src_log, size_t src_log_size);
1665f8c95eSAnton Vorontsov #else
pstore_register_ftrace(void)1765f8c95eSAnton Vorontsov static inline void pstore_register_ftrace(void) {}
pstore_unregister_ftrace(void)18ee1d2674SGeliang Tang static inline void pstore_unregister_ftrace(void) {}
19*16a58307SKees Cook static inline ssize_t
pstore_ftrace_combine_log(char ** dest_log,size_t * dest_log_size,const char * src_log,size_t src_log_size)20*16a58307SKees Cook pstore_ftrace_combine_log(char **dest_log, size_t *dest_log_size,
21*16a58307SKees Cook 			  const char *src_log, size_t src_log_size)
22*16a58307SKees Cook {
23*16a58307SKees Cook 	*dest_log_size = 0;
24*16a58307SKees Cook 	return 0;
25*16a58307SKees Cook }
2665f8c95eSAnton Vorontsov #endif
2765f8c95eSAnton Vorontsov 
289d5438f4SMark Salyzyn #ifdef CONFIG_PSTORE_PMSG
299d5438f4SMark Salyzyn extern void pstore_register_pmsg(void);
30ee1d2674SGeliang Tang extern void pstore_unregister_pmsg(void);
319d5438f4SMark Salyzyn #else
pstore_register_pmsg(void)329d5438f4SMark Salyzyn static inline void pstore_register_pmsg(void) {}
pstore_unregister_pmsg(void)33ee1d2674SGeliang Tang static inline void pstore_unregister_pmsg(void) {}
349d5438f4SMark Salyzyn #endif
359d5438f4SMark Salyzyn 
36060287b8SAnton Vorontsov extern struct pstore_info *psinfo;
37060287b8SAnton Vorontsov 
38366f7e7aSLuck, Tony extern void	pstore_set_kmsg_bytes(int);
396dda9266SLuck, Tony extern void	pstore_get_records(int);
403a7d2fd1SKees Cook extern void	pstore_get_backend_records(struct pstore_info *psi,
413a7d2fd1SKees Cook 					   struct dentry *root, int quiet);
42609e28bbSKees Cook extern int	pstore_put_backend_records(struct pstore_info *psi);
433a7d2fd1SKees Cook extern int	pstore_mkfile(struct dentry *root,
443a7d2fd1SKees Cook 			      struct pstore_record *record);
45e581ca81SKees Cook extern void	pstore_record_init(struct pstore_record *record,
46e581ca81SKees Cook 				   struct pstore_info *psi);
47060287b8SAnton Vorontsov 
48cb095afdSKees Cook /* Called during pstore init/exit. */
49cb095afdSKees Cook int __init	pstore_init_fs(void);
50cb095afdSKees Cook void __exit	pstore_exit_fs(void);
51fe1d4758SKees Cook 
52060287b8SAnton Vorontsov #endif
53