6 #include <linux/kernel.h>
8 #include <linux/debugfs.h>
9 #include <linux/uaccess.h>
11 #include <interfaces/inspector.h>
15 struct dentry * v3_dir = NULL;
18 int palacios_init_inspector( void ) {
20 v3_dir = debugfs_create_dir("v3vee", NULL);
23 printk("Error creating v3vee debugfs directory\n");
31 int palacios_deinit_inspector( void ) {
32 debugfs_remove(v3_dir);
38 static int dfs_register_tree(struct dentry * dir, v3_inspect_node_t * root) {
39 v3_inspect_node_t * tmp_node = v3_inspection_first_child(root);
40 struct v3_inspection_value tmp_value;
43 tmp_value = v3_inspection_value(tmp_node);
45 if (tmp_value.size == 0) {
46 struct dentry * new_dir = debugfs_create_dir(tmp_value.name, dir);
47 dfs_register_tree(new_dir, tmp_node);
48 } else if (tmp_value.size == 1) {
49 debugfs_create_u8(tmp_value.name, 0644, dir, (u8 *)tmp_value.value);
50 } else if (tmp_value.size == 2) {
51 debugfs_create_u16(tmp_value.name, 0644, dir, (u16 *)tmp_value.value);
52 } else if (tmp_value.size == 4) {
53 debugfs_create_u32(tmp_value.name, 0644, dir, (u32 *)tmp_value.value);
54 } else if (tmp_value.size == 8) {
55 debugfs_create_u64(tmp_value.name, 0644, dir, (u64 *)tmp_value.value);
61 tmp_node = v3_inspection_node_next(tmp_node);
69 int inspect_vm(struct v3_guest * guest) {
70 v3_inspect_node_t * root = v3_get_inspection_root(guest->v3_ctx);
71 struct dentry * guest_dir = NULL;
75 printk("No inspection root found\n");
79 guest_dir = debugfs_create_dir(guest->name, v3_dir);
81 if (IS_ERR(guest_dir)) {
82 printk("Error Creating inspector tree for VM \"%s\"\n", guest->name);
86 dfs_register_tree(guest_dir, root);