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 stricter types to the msr hook framework
[palacios.git] / palacios / include / palacios / vmm_file.h
index bf4a1d0..9776913 100644 (file)
 
 
 #ifdef __V3VEE__
+typedef void * v3_file_t;
 
-#define V3_FileOpen(path, mode)                                                \
-    ({                                                                 \
-       extern struct v3_file_hooks * file_hooks;                       \
-       ((file_hooks) && (file_hooks)->file_open) ?                     \
-           (file_hooks)->file_open((path), (mode)) : -1;               \
-    })
-
-#define V3_FileClose(fd)                                               \
-    ({                                                                 \
-       extern struct v3_file_hooks * file_hooks;                       \
-       ((file_hooks) && (file_hooks)->file_close) ?                    \
-           (file_hooks)->file_close((fd))  :  -1;                      \
-    })
-
-#define V3_FileSize(fd)                                                        \
-    ({                                                                 \
-       extern struct v3_file_hooks * file_hooks;                       \
-       ((file_hooks) && (file_hooks)->file_size) ?                     \
-           (file_hooks)->file_size((fd))  : -1;                        \
-    })
-
-#define V3_FileRead(fd, start, buf, len)                               \
-    ({                                                                 \
-       extern struct v3_file_hooks * file_hooks;                       \
-       ((file_hooks) && (file_hooks)->file_read) ?                     \
-           (file_hooks)->file_read((fd), (start), (buf), (len)) : -1;  \
-    })
-
-#define V3_FileWrite(fd,start,buf,len)                                 \
-    ({                                                                 \
-       extern struct v3_file_hooks * file_hooks;                       \
-       ((file_hooks) && (file_hooks)->file_write) ?                    \
-           (file_hooks)->file_write((fd), (start), (buf), (len)) : -1; \
-    })
 
+v3_file_t v3_file_open(struct v3_vm_info * vm, char * path, uint8_t mode);
+int v3_file_close(v3_file_t file);
+uint64_t v3_file_size(v3_file_t file);
+
+uint64_t v3_file_read(v3_file_t file, uint8_t * buf, uint64_t len, uint64_t off);
+uint64_t v3_file_write(v3_file_t file, uint8_t * buf, uint64_t len, uint64_t off);
 
 #endif
 
 
 struct v3_file_hooks {
 
-    int (*file_open)(const char * path, int mode);
-    int (*file_close)(int fd);
+    void * (*open)(const char * path, int mode, void * host_data);
+    int (*close)(void * fd);
 
-    long long (*file_size)(int fd);
+    long long (*size)(void * fd);
 
     // blocking reads and writes
-    long long (*file_read)(int fd,  long long start, void * buffer, long long length);
-    long long (*file_write)(int fd, long long start, void * buffer, long long length);
+    long long (*read)(void * fd, void * buffer, long long length, long long offset);
+    long long (*write)(void * fd, void * buffer, long long length, long long offset);
 
 };