Hypervisor filesystem (s390_hypfs) for z/VM
From: Michael Holzheu <[email protected]>
[S390] Hypervisor filesystem (s390_hypfs) for z/VM
This is an extension of the already existing hypfs for LPAR (DIAG 204). Data returned by DIAG 2fc is exported using the s390_hypfs when Linux is running under z/VM. Information about cpus and memory is provided. Data is put into different virtual files which can be accessed from user space. All values are represented as ASCII strings
Signed-off-by Michael Holzheu <[email protected]>
Signed-off-by Martin Schwidefsky <[email protected]>
---
arch/s390/hypfs/Makefile | 2 arch/s390/hypfs/hypfs.h | 9 + arch/s390/hypfs/hypfs_diag.h | 16 -- arch/s390/hypfs/hypfs_vm.c | 231 +++++++++++++++++++++++++++++++++++++++++++ arch/s390/hypfs/inode.c | 31 +++-- 5 files changed, 262 insertions(+), 27 deletions(-)
arch/s390/hypfs/hypfs_diag.h +0 -16
@@ -1,16 +0,0 @@ -/* -* arch/s390/hypfs_diag.h -* Hypervisor filesystem for Linux on s390. -* -* Copyright (C) IBM Corp. 2006 -* Author(s): Michael Holzheu <[email protected]> -*/ - -#ifndef _HYPFS_DIAG_H_ -#define _HYPFS_DIAG_H_ - -extern int hypfs_diag_init (void ); -extern void hypfs_diag_exit (void ); -extern int hypfs_diag_create_files (struct super_block *sb,struct dentry *root); - -#endif /* _HYPFS_DIAG_H_ */
arch/s390/hypfs/hypfs.h +9 -0
@@ -27,4 +27,13 @@ extern struct dentry *hypfs_create_str(s struct dentry *dir, const char *name, char *string); +/* LPAR Hypervisor */ +extern int hypfs_diag_init (void ); +extern void hypfs_diag_exit (void ); +extern int hypfs_diag_create_files (struct super_block *sb,struct dentry *root); + +/* VM Hypervisor */ +extern int hypfs_vm_init (void ); +extern int hypfs_vm_create_files (struct super_block *sb,struct dentry *root); +#endif /* _HYPFS_H_ */
arch/s390/hypfs/hypfs_vm.c +231 -0
231 lines not on this page · raw message
arch/s390/hypfs/inode.c +21 -10
@@ -19,7 +19,6 @@#include <linux/module.h> #include <asm/ebcdic.h> #include "hypfs.h" -#include "hypfs_diag.h" #define HYPFS_MAGIC 0x687970/* ASCII 'hyp' */ #define TMP_SIZE 64/* size of temporary buffers */
@@ -192,7 +191,10 @@ static ssize_t hypfs_aio_write(struct ki goto out; }hypfs_delete_tree (sb->s_root); - rc =hypfs_diag_create_files (sb, sb->s_root); +if (MACHINE_IS_VM ) + rc =hypfs_vm_create_files (sb, sb->s_root); +else + rc =hypfs_diag_create_files (sb, sb->s_root);if (rc) {printk (KERN_ERR "hypfs: Update failed\n" );hypfs_delete_tree (sb->s_root);
@@ -289,7 +291,10 @@ static int hypfs_fill_super(struct super rc = -ENOMEM ; goto err_alloc; } - rc =hypfs_diag_create_files (sb, root_dentry); +if (MACHINE_IS_VM ) + rc =hypfs_vm_create_files (sb, root_dentry); +else + rc =hypfs_diag_create_files (sb, root_dentry);if (rc) goto err_tree; sbi->update_file =hypfs_create_update_file (sb, root_dentry);
@@ -462,11 +467,15 @@ static int __init hypfs_init(void) {int rc; -if (MACHINE_IS_VM ) -return -ENODATA ; -if (hypfs_diag_init ()) { - rc = -ENODATA ; - goto fail_diag; +if (MACHINE_IS_VM ) { +if (hypfs_vm_init ()) +/* no diag 2fc, just exit */ +return -ENODATA ; + }else { +if (hypfs_diag_init ()) { + rc = -ENODATA ; + goto fail_diag; + } }kset_set_kset_s (&s390_subsys, hypervisor_subsys); rc =subsystem_register (&s390_subsys);
@@ -480,7 +489,8 @@ static int __init hypfs_init(void) fail_filesystem:subsystem_unregister (&s390_subsys); fail_sysfs: -hypfs_diag_exit (); +if (!MACHINE_IS_VM ) +hypfs_diag_exit (); fail_diag:printk (KERN_ERR "hypfs: Initialization failed with rc = %i.\n" , rc);return rc;
@@ -488,7 +498,8 @@ fail_diag: static void __exit hypfs_exit(void) { -hypfs_diag_exit (); +if (!MACHINE_IS_VM ) +hypfs_diag_exit ();unregister_filesystem (&hypfs_type);subsystem_unregister (&s390_subsys); }
arch/s390/hypfs/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o -s390_hypfs-objs := inode.o hypfs_diag.o +s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o