hypfs.h 1.9 KB

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