[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 6/6] xen: add runtime parameter reading support to hypfs



Add support to read values of hypervisor runtime parameters via the
hypervisor file system for all unsigned integer type runtime parameters.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 docs/misc/hypfs-paths.pandoc |  9 +++++++++
 xen/common/kernel.c          | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 81353546ef..c12014505e 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -102,3 +102,12 @@ hypervisor.
 #### /buildinfo/config = STRING
 
 The contents of the `xen/.config` file at the time of the hypervisor build.
+
+#### /params/
+
+A directory of runtime parameters (those can be set via xl set-parameters).
+
+#### /params/*
+
+The single parameters. The description of the different parameters can be
+found in `docs/misc/xen-command-line.pandoc`.
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 760917dab5..e2e6d171a7 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -7,6 +7,7 @@
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/errno.h>
+#include <xen/hypfs.h>
 #include <xen/version.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
@@ -320,6 +321,44 @@ int cmdline_strcmp(const char *frag, const char *name)
     }
 }
 
+static struct hypfs_dir hypfs_params = {
+    .list = LIST_HEAD_INIT(hypfs_params.list),
+};
+
+static int __init runtime_param_hypfs_add(void)
+{
+    const struct kernel_param *param;
+    int ret;
+
+    ret = hypfs_new_dir(&hypfs_root, "params", &hypfs_params);
+    BUG_ON(ret);
+
+    for ( param = __param_start; param < __param_end; param++ )
+    {
+        switch ( param->type )
+        {
+        case OPT_UINT:
+            if ( param->len == sizeof(unsigned int) )
+                ret = hypfs_new_entry_uint(&hypfs_params, param->name,
+                                           (unsigned int *)(param->par.var));
+            break;
+
+        case OPT_STR:
+            ret = hypfs_new_entry_uint(&hypfs_params, param->name,
+                                       param->par.var);
+            break;
+
+        default:
+            break;
+        }
+
+        BUG_ON(ret);
+    }
+
+    return 0;
+}
+__initcall(runtime_param_hypfs_add);
+
 unsigned int tainted;
 
 /**
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.