Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Ported device changes and support code for keyed streams, graphics console, and host...
[palacios.git] / linux_module / palacios-inspector.c
1 /* 
2  * DebugFS interface
3  * (c) Jack Lange, 2011
4  */
5
6 #include <linux/kernel.h>
7 #include <linux/fs.h>
8 #include <linux/debugfs.h>
9 #include <linux/uaccess.h>
10
11 #include <interfaces/inspector.h>
12
13 #include "palacios.h"
14
15 struct dentry * v3_dir = NULL;
16
17
18 int palacios_init_inspector( void ) {
19
20     v3_dir = debugfs_create_dir("v3vee", NULL);
21
22     if (IS_ERR(v3_dir)) {
23         printk("Error creating v3vee debugfs directory\n");
24         return -1;
25     }
26
27     return 0;
28 }
29
30
31 int palacios_deinit_inspector( void ) {
32     debugfs_remove(v3_dir);
33     return 0;
34 }
35
36
37
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;
41
42     while (tmp_node) {
43         tmp_value = v3_inspection_value(tmp_node);
44
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);
56         } else {
57
58             // buffer
59         }
60
61         tmp_node = v3_inspection_node_next(tmp_node);
62
63     }
64
65     return 0;
66 }
67
68
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;
72
73
74     if (root == NULL) {
75         printk("No inspection root found\n");
76         return -1;
77     }
78
79     guest_dir = debugfs_create_dir(guest->name, v3_dir);
80
81     if (IS_ERR(guest_dir)) {
82         printk("Error Creating inspector tree for VM \"%s\"\n", guest->name);
83         return -1;
84     }
85
86     dfs_register_tree(guest_dir, root);
87     return 0;
88 }