blob: 52348e0a812e8db6ccc98a23450f2c46ad823f8f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Michael Holzheu24bbb1f2006-06-23 02:05:06 -07002/*
Michael Holzheu24bbb1f2006-06-23 02:05:06 -07003 * Hypervisor filesystem for Linux on s390.
4 *
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02005 * Copyright IBM Corp. 2006
Michael Holzheu24bbb1f2006-06-23 02:05:06 -07006 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 */
8
9#ifndef _HYPFS_H_
10#define _HYPFS_H_
11
12#include <linux/fs.h>
13#include <linux/types.h>
Michael Holzheu57b28f62010-05-17 10:00:20 +020014#include <linux/debugfs.h>
Michael Holzheu2fcb3682011-01-05 12:47:43 +010015#include <linux/workqueue.h>
16#include <linux/kref.h>
Martin Schwidefsky07be0382014-01-24 09:18:52 +010017#include <asm/hypfs.h>
Michael Holzheu24bbb1f2006-06-23 02:05:06 -070018
19#define REG_FILE_MODE 0440
20#define UPDATE_FILE_MODE 0220
21#define DIR_MODE 0550
22
Al Viroa118cfd2013-07-19 18:05:21 +040023extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
Michael Holzheu24bbb1f2006-06-23 02:05:06 -070024
Al Viroa118cfd2013-07-19 18:05:21 +040025extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
Michael Holzheu24bbb1f2006-06-23 02:05:06 -070026 __u64 value);
27
Al Viroa118cfd2013-07-19 18:05:21 +040028extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
Michael Holzheu24bbb1f2006-06-23 02:05:06 -070029 char *string);
30
Michael Holzheu31cb4bd2007-02-05 21:18:29 +010031/* LPAR Hypervisor */
32extern int hypfs_diag_init(void);
33extern void hypfs_diag_exit(void);
Al Viroe334cf42013-07-19 17:10:21 +040034extern int hypfs_diag_create_files(struct dentry *root);
Michael Holzheu31cb4bd2007-02-05 21:18:29 +010035
36/* VM Hypervisor */
37extern int hypfs_vm_init(void);
Michael Holzheu57b28f62010-05-17 10:00:20 +020038extern void hypfs_vm_exit(void);
Al Virof78e41e2013-07-19 17:03:49 +040039extern int hypfs_vm_create_files(struct dentry *root);
Michael Holzheu31cb4bd2007-02-05 21:18:29 +010040
Michael Holzheu34c0dad2015-02-09 14:49:10 +010041/* VM diagnose 0c */
42int hypfs_diag0c_init(void);
43void hypfs_diag0c_exit(void);
44
Martin Schwidefsky07be0382014-01-24 09:18:52 +010045/* Set Partition-Resource Parameter */
46int hypfs_sprp_init(void);
47void hypfs_sprp_exit(void);
48
Michael Holzheu2fcb3682011-01-05 12:47:43 +010049/* debugfs interface */
50struct hypfs_dbfs_file;
51
52struct hypfs_dbfs_data {
53 void *buf;
54 void *buf_free_ptr;
55 size_t size;
Justin P. Mattock6eab04a2011-04-08 19:49:08 -070056 struct hypfs_dbfs_file *dbfs_file;
Michael Holzheu2fcb3682011-01-05 12:47:43 +010057};
58
59struct hypfs_dbfs_file {
60 const char *name;
61 int (*data_create)(void **data, void **data_free_ptr,
62 size_t *size);
63 void (*data_free)(const void *buf_free_ptr);
Martin Schwidefsky07be0382014-01-24 09:18:52 +010064 long (*unlocked_ioctl) (struct file *, unsigned int,
65 unsigned long);
Michael Holzheu2fcb3682011-01-05 12:47:43 +010066
67 /* Private data for hypfs_dbfs.c */
Michael Holzheu2fcb3682011-01-05 12:47:43 +010068 struct mutex lock;
69 struct dentry *dentry;
70};
71
72extern int hypfs_dbfs_init(void);
73extern void hypfs_dbfs_exit(void);
74extern int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
75extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
76
Michael Holzheu24bbb1f2006-06-23 02:05:06 -070077#endif /* _HYPFS_H_ */