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.


added initial global shutdown functionality
[palacios.git] / palacios / src / palacios / vmm_dev_mgr.c
index d41c331..f0554ea 100644 (file)
@@ -86,6 +86,12 @@ int V3_init_devices() {
 }
 
 
+int V3_deinit_devices() {    
+    v3_free_htable(master_dev_table, 0, 0);
+    return 0;
+}
+
+
 int v3_init_dev_mgr(struct v3_vm_info * vm) {
     struct vmm_dev_mgr * mgr = &(vm->dev_mgr);
 
@@ -120,13 +126,16 @@ int v3_free_vm_devices(struct v3_vm_info * vm) {
     return 0;
 }
 
+static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr);
+
 int v3_deinit_dev_mgr(struct v3_vm_info * vm) {
     struct vmm_dev_mgr * mgr = &(vm->dev_mgr);
+    
+    // clear frontend lists
+
+    free_frontends(vm, mgr);
+
 
-    v3_free_htable(mgr->blk_table, 0, 0);
-    v3_free_htable(mgr->net_table, 0, 0);
-    v3_free_htable(mgr->char_table, 0, 0);
-    v3_free_htable(mgr->cons_table, 0, 0);
 
     v3_free_htable(mgr->dev_table, 0, 0);
 
@@ -553,3 +562,45 @@ int v3_dev_connect_char(struct v3_vm_info * vm,
     return 0;
 }
 
+
+
+static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr) {
+    struct char_frontend * chr = NULL;
+    struct char_frontend * tmp_chr = NULL;
+    struct cons_frontend * cons = NULL;
+    struct cons_frontend * tmp_cons = NULL;
+    struct net_frontend * net = NULL;
+    struct net_frontend * tmp_net = NULL;
+    struct blk_frontend * blk = NULL;
+    struct blk_frontend * tmp_blk = NULL;
+
+
+
+    list_for_each_entry_safe(chr, tmp_chr, &(mgr->char_list), char_node) {
+       list_del(&(chr->char_node));
+       V3_Free(chr);
+    }
+
+    list_for_each_entry_safe(cons, tmp_cons, &(mgr->cons_list), cons_node) {
+       list_del(&(cons->cons_node));
+       V3_Free(cons);
+    }
+
+    list_for_each_entry_safe(net, tmp_net, &(mgr->net_list), net_node) {
+       list_del(&(net->net_node));
+       V3_Free(net);
+    }
+
+    list_for_each_entry_safe(blk, tmp_blk, &(mgr->blk_list), blk_node) {
+       list_del(&(blk->blk_node));
+       V3_Free(blk);
+    }
+
+    v3_free_htable(mgr->blk_table, 0, 0);
+    v3_free_htable(mgr->net_table, 0, 0);
+    v3_free_htable(mgr->char_table, 0, 0);
+    v3_free_htable(mgr->cons_table, 0, 0);
+
+
+    return 0;
+}