^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Hypervisor filesystem for Linux on s390.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright IBM Corp. 2006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Author(s): Michael Holzheu <holzheu@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef _HYPFS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _HYPFS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/kref.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/hypfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define REG_FILE_MODE 0440
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define UPDATE_FILE_MODE 0220
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define DIR_MODE 0550
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __u64 value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) char *string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* LPAR Hypervisor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) extern int hypfs_diag_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern void hypfs_diag_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern int hypfs_diag_create_files(struct dentry *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* VM Hypervisor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int hypfs_vm_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern void hypfs_vm_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern int hypfs_vm_create_files(struct dentry *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* VM diagnose 0c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int hypfs_diag0c_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void hypfs_diag0c_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /* Set Partition-Resource Parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void hypfs_sprp_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void hypfs_sprp_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* debugfs interface */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct hypfs_dbfs_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct hypfs_dbfs_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void *buf_free_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) size_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct hypfs_dbfs_file *dbfs_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct hypfs_dbfs_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int (*data_create)(void **data, void **data_free_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) size_t *size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) void (*data_free)(const void *buf_free_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) long (*unlocked_ioctl) (struct file *, unsigned int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* Private data for hypfs_dbfs.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct dentry *dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) extern void hypfs_dbfs_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) extern void hypfs_dbfs_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) extern void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif /* _HYPFS_H_ */