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.


Implementation of host-driven rendering in graphics console
[palacios.releases.git] / linux_module / iface-file.c
index 5489764..091c773 100644 (file)
@@ -106,7 +106,7 @@ static int mkdir_recursive(const char * path, unsigned short perms) {
 static int palacios_file_mkdir(const char * pathname, unsigned short perms, int recurse) {
     /* Welcome to the jungle... */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,41)
     /* DO NOT REFERENCE THIS VARIABLE */
     /* It only exists to provide version compatibility */
     struct path tmp_path; 
@@ -123,12 +123,12 @@ static int palacios_file_mkdir(const char * pathname, unsigned short perms, int
     } 
 
     /* Before Linux 3.1 this was somewhat more difficult */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,41)
     {
        struct nameidata nd;
 
        // I'm not 100% sure about the version here, but it was around this time that the API changed
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37) 
        ret = kern_path_parent(pathname, &nd);
 #else 
 
@@ -243,7 +243,7 @@ static int palacios_file_close(void * file_ptr) {
     return 0;
 }
 
-static long long palacios_file_size(void * file_ptr) {
+static unsigned long long palacios_file_size(void * file_ptr) {
     struct palacios_file * pfile = (struct palacios_file *)file_ptr;
     struct file * filp = pfile->filp;
     struct kstat s;
@@ -259,7 +259,7 @@ static long long palacios_file_size(void * file_ptr) {
     return s.size;
 }
 
-static long long palacios_file_read(void * file_ptr, void * buffer, long long length, long long offset){
+static unsigned long long palacios_file_read(void * file_ptr, void * buffer, unsigned long long length, unsigned long long offset){
     struct palacios_file * pfile = (struct palacios_file *)file_ptr;
     struct file * filp = pfile->filp;
     ssize_t ret;
@@ -273,14 +273,14 @@ static long long palacios_file_read(void * file_ptr, void * buffer, long long le
     set_fs(old_fs);
        
     if (ret <= 0) {
-       printk("sys_read of %p for %lld bytes failed\n", filp, length);         
+       printk("sys_read of %p for %lld bytes at offset %llu failed (ret=%ld)\n", filp, length, offset, ret);
     }
        
     return ret;
 }
 
 
-static long long palacios_file_write(void * file_ptr, void * buffer, long long length, long long offset) {
+static unsigned long long palacios_file_write(void * file_ptr, void * buffer, unsigned long long length, unsigned long long offset) {
     struct palacios_file * pfile = (struct palacios_file *)file_ptr;
     struct file * filp = pfile->filp;
     mm_segment_t old_fs;
@@ -295,7 +295,7 @@ static long long palacios_file_write(void * file_ptr, void * buffer, long long l
 
  
     if (ret <= 0) {
-       printk("sys_write failed\n");           
+       printk("sys_write for %llu bytes at offset %llu failed (ret=%ld)\n", length, offset, ret);              
     }
        
     return ret;
@@ -344,6 +344,7 @@ static int guest_file_init(struct v3_guest * guest, void ** vm_data) {
 
 static int guest_file_deinit(struct v3_guest * guest, void * vm_data) {
     
+    kfree(vm_data);
     return 0;
 }