X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_file.h;h=9776913f8911b6fd0e6d9c35e44b0b318ead98f8;hb=d54fc24e6cfb62cc2fedfb63d3ae68ff636e3a01;hp=ea8dd973a2dc4204c0594fb8fc3538c41be4c96b;hpb=b25296b8b79d1964be81a4ebfa8262d4ca36a63f;p=palacios.git diff --git a/palacios/include/palacios/vmm_file.h b/palacios/include/palacios/vmm_file.h index ea8dd97..9776913 100644 --- a/palacios/include/palacios/vmm_file.h +++ b/palacios/include/palacios/vmm_file.h @@ -25,42 +25,15 @@ #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),(length)) : -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),(length)) : -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 @@ -69,14 +42,14 @@ 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); };