X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_file.h;h=9776913f8911b6fd0e6d9c35e44b0b318ead98f8;hb=912f74aae257be698044de894124289ba5356621;hp=cac4c4d219003e8f9f3c312c4e6b130bce47b241;hpb=7f424638a5e63b0f5434c640543a3558aad75b57;p=palacios.git diff --git a/palacios/include/palacios/vmm_file.h b/palacios/include/palacios/vmm_file.h index cac4c4d..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), (buf), (len), (start)) : -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), (buf), (len), (start)) : -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 { - 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); };