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.


proper cleanup in iface-file and iface-host-dev
Kyle Hale [Tue, 10 Jul 2012 23:36:31 +0000 (18:36 -0500)]
linux_module/iface-file.c
linux_module/iface-host-dev.c

index 46d4a28..10a525d 100644 (file)
@@ -342,8 +342,14 @@ static int file_init( void ) {
 
 
 static int file_deinit( void ) {
-    if (!list_empty(&(global_files))) {
-       ERROR("Error removing module with open files\n");
+    struct palacios_file * pfile = NULL;
+    struct palacios_file * tmp = NULL;
+    
+    list_for_each_entry_safe(pfile, tmp, &(global_files), file_node) { 
+        filp_close(pfile->filp, NULL);
+        list_del(&(pfile->file_node));
+        palacios_free(pfile->path);    
+        palacios_free(pfile);
     }
 
     return 0;
@@ -368,9 +374,18 @@ static int guest_file_init(struct v3_guest * guest, void ** vm_data) {
 
 
 static int guest_file_deinit(struct v3_guest * guest, void * vm_data) {
+    struct vm_file_state * state = (struct vm_file_state *)vm_data;
+    struct palacios_file * pfile = NULL;
+    struct palacios_file * tmp = NULL;
     
-    palacios_free(vm_data);
+    list_for_each_entry_safe(pfile, tmp, &(state->open_files), file_node) { 
+        filp_close(pfile->filp, NULL);
+        list_del(&(pfile->file_node));
+        palacios_free(pfile->path);    
+        palacios_free(pfile);
+    }
 
+    palacios_free(state);
     return 0;
 }
 
index a622029..ca5de91 100644 (file)
@@ -1341,6 +1341,12 @@ static int host_dev_guest_init(struct v3_guest * guest, void ** vm_data ) {
 }
 
 
+static int host_dev_guest_deinit(struct v3_guest * guest, void * vm_data) {
+
+    palacios_free(vm_data);
+    return 0;
+}
+
 
 
 
@@ -1349,7 +1355,7 @@ static struct linux_ext host_dev_ext = {
     .init = host_dev_init,
     .deinit = NULL,
     .guest_init = host_dev_guest_init,
-    .guest_deinit = NULL
+    .guest_deinit = host_dev_guest_deinit
 };