xref: /openbmc/linux/arch/s390/hypfs/hypfs.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
224bbb1faSMichael Holzheu /*
324bbb1faSMichael Holzheu  *    Hypervisor filesystem for Linux on s390.
424bbb1faSMichael Holzheu  *
5a53c8fabSHeiko Carstens  *    Copyright IBM Corp. 2006
624bbb1faSMichael Holzheu  *    Author(s): Michael Holzheu <holzheu@de.ibm.com>
724bbb1faSMichael Holzheu  */
824bbb1faSMichael Holzheu 
924bbb1faSMichael Holzheu #ifndef _HYPFS_H_
1024bbb1faSMichael Holzheu #define _HYPFS_H_
1124bbb1faSMichael Holzheu 
1224bbb1faSMichael Holzheu #include <linux/fs.h>
1324bbb1faSMichael Holzheu #include <linux/types.h>
1457b28f66SMichael Holzheu #include <linux/debugfs.h>
152fcb3686SMichael Holzheu #include <linux/workqueue.h>
162fcb3686SMichael Holzheu #include <linux/kref.h>
1707be0382SMartin Schwidefsky #include <asm/hypfs.h>
1824bbb1faSMichael Holzheu 
1924bbb1faSMichael Holzheu #define REG_FILE_MODE    0440
2024bbb1faSMichael Holzheu #define UPDATE_FILE_MODE 0220
2124bbb1faSMichael Holzheu #define DIR_MODE         0550
2224bbb1faSMichael Holzheu 
23a118cfdfSAl Viro extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
2424bbb1faSMichael Holzheu 
25a118cfdfSAl Viro extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
2624bbb1faSMichael Holzheu 				       __u64 value);
2724bbb1faSMichael Holzheu 
28a118cfdfSAl Viro extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
2924bbb1faSMichael Holzheu 				       char *string);
3024bbb1faSMichael Holzheu 
3131cb4bd3SMichael Holzheu /* LPAR Hypervisor */
3231cb4bd3SMichael Holzheu extern int hypfs_diag_init(void);
3331cb4bd3SMichael Holzheu extern void hypfs_diag_exit(void);
34e334cf4fSAl Viro extern int hypfs_diag_create_files(struct dentry *root);
3531cb4bd3SMichael Holzheu 
3631cb4bd3SMichael Holzheu /* VM Hypervisor */
3731cb4bd3SMichael Holzheu extern int hypfs_vm_init(void);
3857b28f66SMichael Holzheu extern void hypfs_vm_exit(void);
39f78e41e3SAl Viro extern int hypfs_vm_create_files(struct dentry *root);
4031cb4bd3SMichael Holzheu 
4134c0dad7SMichael Holzheu /* VM diagnose 0c */
4234c0dad7SMichael Holzheu int hypfs_diag0c_init(void);
4334c0dad7SMichael Holzheu void hypfs_diag0c_exit(void);
4434c0dad7SMichael Holzheu 
4507be0382SMartin Schwidefsky /* Set Partition-Resource Parameter */
46f36108c4SGreg Kroah-Hartman void hypfs_sprp_init(void);
4707be0382SMartin Schwidefsky void hypfs_sprp_exit(void);
4807be0382SMartin Schwidefsky 
49*3325b4d8SHeiko Carstens int __hypfs_fs_init(void);
50*3325b4d8SHeiko Carstens 
hypfs_fs_init(void)51*3325b4d8SHeiko Carstens static inline int hypfs_fs_init(void)
52*3325b4d8SHeiko Carstens {
53*3325b4d8SHeiko Carstens 	if (IS_ENABLED(CONFIG_S390_HYPFS_FS))
54*3325b4d8SHeiko Carstens 		return __hypfs_fs_init();
55*3325b4d8SHeiko Carstens 	return 0;
56*3325b4d8SHeiko Carstens }
57*3325b4d8SHeiko Carstens 
582fcb3686SMichael Holzheu /* debugfs interface */
592fcb3686SMichael Holzheu struct hypfs_dbfs_file;
602fcb3686SMichael Holzheu 
612fcb3686SMichael Holzheu struct hypfs_dbfs_data {
622fcb3686SMichael Holzheu 	void			*buf;
632fcb3686SMichael Holzheu 	void			*buf_free_ptr;
642fcb3686SMichael Holzheu 	size_t			size;
656eab04a8SJustin P. Mattock 	struct hypfs_dbfs_file	*dbfs_file;
662fcb3686SMichael Holzheu };
672fcb3686SMichael Holzheu 
682fcb3686SMichael Holzheu struct hypfs_dbfs_file {
692fcb3686SMichael Holzheu 	const char	*name;
702fcb3686SMichael Holzheu 	int		(*data_create)(void **data, void **data_free_ptr,
712fcb3686SMichael Holzheu 				       size_t *size);
722fcb3686SMichael Holzheu 	void		(*data_free)(const void *buf_free_ptr);
7307be0382SMartin Schwidefsky 	long		(*unlocked_ioctl) (struct file *, unsigned int,
7407be0382SMartin Schwidefsky 					   unsigned long);
752fcb3686SMichael Holzheu 
762fcb3686SMichael Holzheu 	/* Private data for hypfs_dbfs.c */
772fcb3686SMichael Holzheu 	struct mutex		lock;
782fcb3686SMichael Holzheu 	struct dentry		*dentry;
792fcb3686SMichael Holzheu };
802fcb3686SMichael Holzheu 
812fcb3686SMichael Holzheu extern void hypfs_dbfs_exit(void);
82f36108c4SGreg Kroah-Hartman extern void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
832fcb3686SMichael Holzheu extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
842fcb3686SMichael Holzheu 
8524bbb1faSMichael Holzheu #endif /* _HYPFS_H_ */
86