X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_file.h;h=9776913f8911b6fd0e6d9c35e44b0b318ead98f8;hb=a3c0442bfd3777bb88dd60f6702ef7506b255330;hp=7b0872cf437e8bb8706ca7da69a5254c33d90ff1;hpb=fbfbbc1eec7587e4555e7920c9b15129f90f8d80;p=palacios-OLD.git diff --git a/palacios/include/palacios/vmm_file.h b/palacios/include/palacios/vmm_file.h index 7b0872c..9776913 100644 --- a/palacios/include/palacios/vmm_file.h +++ b/palacios/include/palacios/vmm_file.h @@ -25,57 +25,15 @@ #ifdef __V3VEE__ +typedef void * v3_file_t; -#define V3_FileOpen(path, mode, host_data) \ - ({ \ - void * fd = NULL; \ - extern struct v3_file_hooks * file_hooks; \ - if ((file_hooks) && (file_hooks)->file_open) { \ - fd = (file_hooks)->file_open((path), (mode), (host_data)); \ - } \ - fd; \ - }) - -#define V3_FileClose(fd) \ - ({ \ - int ret = 0; \ - extern struct v3_file_hooks * file_hooks; \ - if ((file_hooks) && (file_hooks)->file_close) { \ - ret = (file_hooks)->file_close((fd)); \ - } \ - ret; \ - }) - -#define V3_FileSize(fd) \ - ({ \ - long long size = -1; \ - extern struct v3_file_hooks * file_hooks; \ - if ((file_hooks) && (file_hooks)->file_size) { \ - size = (file_hooks)->file_size((fd)); \ - } \ - size; \ - }) - -#define V3_FileRead(fd, start, buf, len) \ - ({ \ - long long ret = -1; \ - extern struct v3_file_hooks * file_hooks; \ - if ((file_hooks) && (file_hooks)->file_read) { \ - ret = (file_hooks)->file_read((fd), (buf), (len), (start)); \ - } \ - ret; \ - }) - -#define V3_FileWrite(fd,start,buf,len) \ - ({ \ - long long ret = -1; \ - extern struct v3_file_hooks * file_hooks; \ - if ((file_hooks) && (file_hooks)->file_write) { \ - ret = (file_hooks)->file_write((fd), (buf), (len), (start)); \ - } \ - ret; \ - }) +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 @@ -84,14 +42,14 @@ struct v3_file_hooks { - void * (*file_open)(const char * path, int mode, void * host_data); - int (*file_close)(void * fd); + void * (*open)(const char * path, int mode, void * host_data); + int (*close)(void * fd); - long long (*file_size)(void * fd); + long long (*size)(void * fd); // blocking reads and writes - long long (*file_read)(void * fd, void * buffer, long long length, long long offset); - long long (*file_write)(void * fd, void * buffer, long long length, long long offset); + 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); };