From: Jack Lange Date: Fri, 15 Apr 2011 21:07:38 +0000 (-0500) Subject: added debugfs linux files X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b7771187ba9ede27c32dd7bd78743bcd9d299d9;p=palacios.releases.git added debugfs linux files --- diff --git a/linux_module/palacios-debugfs.c b/linux_module/palacios-debugfs.c new file mode 100644 index 0000000..b35120e --- /dev/null +++ b/linux_module/palacios-debugfs.c @@ -0,0 +1,79 @@ +/* + * DebugFS interface + * (c) Jack Lange, 2011 + */ + +#include +#include +#include +#include + +#include + +#include "palacios.h" + +struct dentry * v3_dir = NULL; + + +int palacios_init_debugfs( void ) { + + v3_dir = debugfs_create_dir("v3vee", NULL); + + if (IS_ERR(v3_dir)) { + printk("Error creating v3vee debugfs directory\n"); + return -1; + } + + return 0; +} + + +int palacios_deinit_debugfs( void ) { + debugfs_remove(v3_dir); + return 0; +} + + + +static int dfs_register_tree(struct dentry * dir, v3_inspect_node_t * root) { + v3_inspect_node_t * tmp_node = v3_inspection_first_child(root); + struct v3_inspection_value tmp_value; + + while (tmp_node) { + tmp_value = v3_inspection_value(tmp_node); + + if (tmp_value.size == 0) { + struct dentry * new_dir = debugfs_create_dir(tmp_value.name, dir); + dfs_register_tree(new_dir, tmp_node); + } else if (tmp_value.size == 1) { + debugfs_create_u8(tmp_value.name, 0644, dir, (u8 *)tmp_value.value); + } else if (tmp_value.size == 2) { + debugfs_create_u16(tmp_value.name, 0644, dir, (u16 *)tmp_value.value); + } else if (tmp_value.size == 4) { + debugfs_create_u32(tmp_value.name, 0644, dir, (u32 *)tmp_value.value); + } else if (tmp_value.size == 8) { + debugfs_create_u64(tmp_value.name, 0644, dir, (u64 *)tmp_value.value); + } else { + + // buffer + } + + tmp_node = v3_inspection_node_next(tmp_node); + + } + + return 0; +} + + +int dfs_register_vm(struct v3_guest * guest) { + v3_inspect_node_t * root = v3_get_inspection_root(guest->v3_ctx); + + if (root == NULL) { + printk("No inspection root found\n"); + return -1; + } + + dfs_register_tree(v3_dir, root); + return 0; +} diff --git a/linux_module/palacios-debugfs.h b/linux_module/palacios-debugfs.h new file mode 100644 index 0000000..1caad52 --- /dev/null +++ b/linux_module/palacios-debugfs.h @@ -0,0 +1,14 @@ +/* + * DebugFS interface + * (c) Jack Lange, 2011 + */ + +#include "palacios.h" + +int palacios_init_debugfs( void ); +int palacios_deinit_debugfs( void ); + + + +int dfs_register_vm(struct v3_guest * guest); +