From: navarro Date: Wed, 13 Jun 2012 13:23:51 +0000 (+0200) Subject: Change the file API, remove the mount point in each file function. X-Git-Tag: v3_8~632 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/89df6a48741330160c27b692f6fbfc213db31cbe?hp=f5e94fc4f0586200cb288fd638dcfbed499eb4c7 Change the file API, remove the mount point in each file function. --- diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index b7a6134767..729d64e8e6 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -34,9 +34,10 @@ int host(int argc, char *argv[]) { msg_file_t file = NULL; s_msg_stat_t stat; - - char* mount = bprintf("C:"); + void *ptr; + char* mount = bprintf("/home"); size_t read,write; + if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")) file = MSG_file_open(mount,FILENAME1,"rw"); else if(!strcmp(MSG_process_get_name(MSG_process_self()),"1")) @@ -49,20 +50,20 @@ int host(int argc, char *argv[]) XBT_INFO("\tOpen file '%s'",file->name); - read = MSG_file_read(mount,NULL,10000000,sizeof(char*),file); // Read for 10Mo + read = MSG_file_read(ptr,10000000,sizeof(char*),file); // Read for 10Mo XBT_INFO("\tHaving read %zu \ton %s",read,file->name); - write = MSG_file_write(mount,NULL,100000,sizeof(char*),file); // Write for 100Ko + write = MSG_file_write(ptr,100000,sizeof(char*),file); // Write for 100Ko XBT_INFO("\tHaving write %zu \ton %s",write,file->name); - read = MSG_file_read(mount,NULL,10000000,sizeof(char*),file); // Read for 10Mo + read = MSG_file_read(ptr,10000000,sizeof(char*),file); // Read for 10Mo XBT_INFO("\tHaving read %zu \ton %s",read,file->name); - MSG_file_stat(mount,file,&stat); + MSG_file_stat(file,&stat); XBT_INFO("\tFile %s Size %d",file->name,(int)stat.size); XBT_INFO("\tClose file '%s'",file->name); - MSG_file_close(mount,file); + MSG_file_close(file); free(mount); return 0; diff --git a/examples/platforms/storage.xml b/examples/platforms/storage.xml index 1f32718879..8046a21fd1 100644 --- a/examples/platforms/storage.xml +++ b/examples/platforms/storage.xml @@ -33,19 +33,19 @@ - + - + - + - + diff --git a/include/msg/msg.h b/include/msg/msg.h index b69b69163f..dd7c38c4c9 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -56,11 +56,11 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void); /************************** File handling ***********************************/ -XBT_PUBLIC(size_t) MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, msg_file_t stream); -XBT_PUBLIC(size_t) MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream); -XBT_PUBLIC(msg_file_t) MSG_file_open(const char* storage, const char* path, const char* mode); -XBT_PUBLIC(int) MSG_file_close(const char* storage, msg_file_t fp); -XBT_PUBLIC(int) MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf); +XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream); +XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream); +XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode); +XBT_PUBLIC(int) MSG_file_close(msg_file_t fp); +XBT_PUBLIC(int) MSG_file_stat(msg_file_t fd, s_msg_stat_t *buf); /************************** Host handling ***********************************/ diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index f1d989fd73..dfd7ac010a 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -429,11 +429,11 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems); XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem); -XBT_PUBLIC(size_t) simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream); -XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream); +XBT_PUBLIC(size_t) simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream); +XBT_PUBLIC(size_t) simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream); XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path, const char* mode); -XBT_PUBLIC(int) simcall_file_close(const char* storage, smx_file_t fp); -XBT_PUBLIC(int) simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf); +XBT_PUBLIC(int) simcall_file_close(smx_file_t fp); +XBT_PUBLIC(int) simcall_file_stat(smx_file_t fd, s_file_stat_t *buf); SG_END_DECL() #endif /* _SIMIX_SIMIX_H */ diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 6a7131dd94..806d6e93d7 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -218,7 +218,7 @@ typedef struct surf_network_model_extension_public { */ typedef struct surf_storage_model_extension_public { - surf_action_t(*open) (void *storage, const char* path, const char* mode); + surf_action_t(*open) (void *storage, const char* mount, const char* path, const char* mode); surf_action_t(*close) (void *storage, surf_file_t fp); surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream); surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream); @@ -252,10 +252,10 @@ typedef struct surf_workstation_model_extension_public { double (*get_link_bandwidth) (const void *link); /**< Return the current bandwidth of a network link */ double (*get_link_latency) (const void *link); /**< Return the current latency of a network link */ surf_action_t(*open) (void *workstation, const char* storage, const char* path, const char* mode); - surf_action_t(*close) (void *workstation, const char* storage, surf_file_t fp); - surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream); - surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream); - surf_action_t(*stat) (void *workstation, const char* storage, surf_file_t stream); + surf_action_t(*close) (void *workstation, surf_file_t fp); + surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream); + surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream); + surf_action_t(*stat) (void *workstation, surf_file_t stream); int (*link_shared) (const void *link); xbt_dict_t(*get_properties) (const void *resource); void* (*link_create_resource) (const char *name, diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 0e8b55d2d3..affae9d2f6 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -22,37 +22,35 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, /** \ingroup msg_file_management * \brief Read elements of a file * - * \param storage is the name where find the stream * \param ptr buffer to where the data is copied * \param size of each element * \param nmemb is the number of elements of data to read * \param stream to read * \return the number of items successfully read */ -size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, msg_file_t stream) +size_t MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream) { - return simcall_file_read(storage, ptr, size, nmemb, stream->simdata->smx_file); + return simcall_file_read(ptr, size, nmemb, stream->simdata->smx_file); } /** \ingroup msg_file_management * \brief Write elements into a file * - * \param storage is the name where find the stream * \param ptr buffer from where the data is copied * \param size of each element * \param nmemb is the number of elements of data to write * \param stream to write * \return the number of items successfully write */ -size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream) +size_t MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream) { - return simcall_file_write(storage, ptr, size, nmemb, stream->simdata->smx_file); + return simcall_file_write(ptr, size, nmemb, stream->simdata->smx_file); } /** \ingroup msg_file_management * \brief Opens the file whose name is the string pointed to by path * - * \param storage is the name where find the file to open + * \param mount is the mount point where find the file is located * \param path is the file location on the storage * \param mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.): * r Open text file for reading. The stream is positioned at the beginning of the file. @@ -66,38 +64,36 @@ size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t * * \return An #msg_file_t associated to the file */ -msg_file_t MSG_file_open(const char* storage, const char* path, const char* mode) +msg_file_t MSG_file_open(const char* mount, const char* path, const char* mode) { msg_file_t file = xbt_new(s_msg_file_t,1); file->name = strdup(path); file->simdata = xbt_new0(s_simdata_file_t,1); - file->simdata->smx_file = simcall_file_open(storage, path, mode); + file->simdata->smx_file = simcall_file_open(mount, path, mode); return file; } /** \ingroup msg_file_management * \brief Close the file * - * \param storage is the name where find the stream * \param fp is the file to close * \return 0 on success or 1 on error */ -int MSG_file_close(const char* storage, msg_file_t fp) +int MSG_file_close(msg_file_t fp) { - return simcall_file_close(storage, fp->simdata->smx_file); + return simcall_file_close(fp->simdata->smx_file); } /** \ingroup msg_file_management * \brief Stats the file pointed by fd * - * \param storage is the name where find the stream * \param fd is the file descriptor (#msg_file_t) * \param buf is the return structure with informations * \return 0 on success or 1 on error */ -int MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf) +int MSG_file_stat(msg_file_t fd, s_msg_stat_t *buf) { int res; - res = simcall_file_stat(storage, fd->simdata->smx_file, buf); + res = simcall_file_stat(fd->simdata->smx_file, buf); return res; } diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 6c7868c614..8030acac61 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -18,7 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, void SIMIX_pre_file_read(smx_simcall_t simcall) { smx_action_t action = SIMIX_file_read(simcall->issuer, - simcall->file_read.storage, simcall->file_read.ptr, simcall->file_read.size, simcall->file_read.nmemb, @@ -27,7 +26,7 @@ void SIMIX_pre_file_read(smx_simcall_t simcall) simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream) +smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_action_t action; smx_host_t host = process->smx_host; @@ -47,7 +46,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* p #endif action->io.host = host; - action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, stream->surf_file), + action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, ptr, size, nmemb, stream->surf_file), surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); @@ -59,7 +58,6 @@ smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* p void SIMIX_pre_file_write(smx_simcall_t simcall) { smx_action_t action = SIMIX_file_write(simcall->issuer, - simcall->file_write.storage, simcall->file_write.ptr, simcall->file_write.size, simcall->file_write.nmemb, @@ -68,7 +66,7 @@ void SIMIX_pre_file_write(smx_simcall_t simcall) simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream) +smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_action_t action; smx_host_t host = process->smx_host; @@ -88,7 +86,7 @@ smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const #endif action->io.host = host; - action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, stream->surf_file); + action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, ptr, size, nmemb, stream->surf_file); surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); @@ -100,14 +98,14 @@ smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void SIMIX_pre_file_open(smx_simcall_t simcall) { smx_action_t action = SIMIX_file_open(simcall->issuer, - simcall->file_open.storage, + simcall->file_open.mount, simcall->file_open.path, simcall->file_open.mode); xbt_fifo_push(action->simcalls, simcall); simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const char* path, const char* mode) +smx_action_t SIMIX_file_open(smx_process_t process ,const char* mount, const char* path, const char* mode) { smx_action_t action; smx_host_t host = process->smx_host; @@ -127,7 +125,7 @@ smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const c #endif action->io.host = host; - action->io.surf_io = surf_workstation_model->extension.workstation.open(host->host, storage, path, mode); + action->io.surf_io = surf_workstation_model->extension.workstation.open(host->host, mount, path, mode); surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); @@ -139,13 +137,12 @@ smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const c void SIMIX_pre_file_close(smx_simcall_t simcall) { smx_action_t action = SIMIX_file_close(simcall->issuer, - simcall->file_close.storage, simcall->file_close.fp); xbt_fifo_push(action->simcalls, simcall); simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_file_t fp) +smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp) { smx_action_t action; smx_host_t host = process->smx_host; @@ -165,7 +162,7 @@ smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_fi #endif action->io.host = host; - action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, fp->surf_file); + action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, fp->surf_file); surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); @@ -177,14 +174,13 @@ smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_fi void SIMIX_pre_file_stat(smx_simcall_t simcall) { smx_action_t action = SIMIX_file_stat(simcall->issuer, - simcall->file_stat.storage, simcall->file_stat.fd, simcall->file_stat.buf); xbt_fifo_push(action->simcalls, simcall); simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, smx_file_t fd, s_file_stat_t buf) +smx_action_t SIMIX_file_stat(smx_process_t process, smx_file_t fd, s_file_stat_t buf) { smx_action_t action; smx_host_t host = process->smx_host; @@ -203,7 +199,7 @@ smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, smx_fil #endif action->io.host = host; - action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, storage, fd->surf_file); + action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, fd->surf_file); surf_workstation_model->action_data_set(action->io.surf_io, action); XBT_DEBUG("Create io action %p", action); diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index 945538d5f4..c457a02999 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -16,11 +16,11 @@ void SIMIX_pre_file_open(smx_simcall_t simcall); void SIMIX_pre_file_close(smx_simcall_t simcall); void SIMIX_pre_file_stat(smx_simcall_t simcall); -smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream); -smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream); +smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream); +smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream); smx_action_t SIMIX_file_open(smx_process_t process, const char* storage, const char* path, const char* mode); -smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, smx_file_t fp); -smx_action_t SIMIX_file_stat(smx_process_t process, const char* storage, smx_file_t fd, s_file_stat_t buf); +smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp); +smx_action_t SIMIX_file_stat(smx_process_t process, smx_file_t fd, s_file_stat_t buf); void SIMIX_post_io(smx_action_t action); void SIMIX_io_destroy(smx_action_t action); diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 13233a778b..6ce40e26ac 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -509,7 +509,6 @@ typedef struct s_smx_simcall { } sem_get_capacity; struct { - const char* storage; void *ptr; size_t size; size_t nmemb; @@ -518,7 +517,6 @@ typedef struct s_smx_simcall { } file_read; struct { - const char* storage; const void *ptr; size_t size; size_t nmemb; @@ -527,20 +525,18 @@ typedef struct s_smx_simcall { } file_write; struct { - const char* storage; + const char* mount; const char* path; const char* mode; smx_file_t result; } file_open; struct { - const char* storage; smx_file_t fp; int result; } file_close; struct { - const char* storage; smx_file_t fd; s_file_stat_t buf; int result; diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index a23bdda151..880771bfba 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1203,12 +1203,11 @@ int simcall_sem_get_capacity(smx_sem_t sem) return simcall->sem_get_capacity.result; } -size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream) +size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_READ; - simcall->file_read.storage = storage; simcall->file_read.ptr = ptr; simcall->file_read.size = size; simcall->file_read.nmemb = nmemb; @@ -1218,12 +1217,11 @@ size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nme return simcall->file_read.result; } -size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream) +size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_WRITE; - simcall->file_write.storage = storage; simcall->file_write.ptr = ptr; simcall->file_write.size = size; simcall->file_write.nmemb = nmemb; @@ -1233,12 +1231,12 @@ size_t simcall_file_write(const char* storage, const void* ptr, size_t size, siz return simcall->file_write.result; } -smx_file_t simcall_file_open(const char* storage, const char* path, const char* mode) +smx_file_t simcall_file_open(const char* mount, const char* path, const char* mode) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_OPEN; - simcall->file_open.storage = storage; + simcall->file_open.mount = mount; simcall->file_open.path = path; simcall->file_open.mode = mode; SIMIX_simcall_push(simcall->issuer); @@ -1246,23 +1244,21 @@ smx_file_t simcall_file_open(const char* storage, const char* path, const char* return simcall->file_open.result; } -int simcall_file_close(const char* storage, smx_file_t fp) +int simcall_file_close(smx_file_t fp) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_CLOSE; - simcall->file_close.storage = storage; simcall->file_close.fp = fp; SIMIX_simcall_push(simcall->issuer); return simcall->file_close.result; } -int simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf) +int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_STAT; - simcall->file_stat.storage = storage; simcall->file_stat.fd = fd; SIMIX_simcall_push(simcall->issuer); diff --git a/src/surf/storage.c b/src/surf/storage.c index 5bde923011..acf02e6f9b 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -50,7 +50,7 @@ static surf_action_t storage_action_stat(void *storage, surf_file_t stream) return action; } -static surf_action_t storage_action_open(void *storage, const char* path, const char* mode) +static surf_action_t storage_action_open(void *storage, const char* mount, const char* path, const char* mode) { XBT_DEBUG("\tOpen file '%s'",path); char *storage_type_id = xbt_lib_get_or_null( @@ -64,6 +64,7 @@ static surf_action_t storage_action_open(void *storage, const char* path, const surf_file_t file = xbt_new0(s_surf_file_t,1); file->name = xbt_strdup(path); file->content = content; + file->storage = mount; surf_action_t action = storage_action_execute(storage,0, OPEN); action->file = (void *)file; diff --git a/src/surf/storage_private.h b/src/surf/storage_private.h index 4b95551419..d55fc6c766 100644 --- a/src/surf/storage_private.h +++ b/src/surf/storage_private.h @@ -30,6 +30,7 @@ typedef struct surf_stat { /* file status structure */ typedef struct surf_file { char *name; surf_stat_t content; + const char* storage; } s_surf_file_t; typedef struct storage { diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 346c706b55..0f3196e485 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -303,41 +303,41 @@ static storage_t find_storage_on_mount_list(void *workstation,const char* storag return st; } -static surf_action_t ws_action_open(void *workstation, const char* storage, const char* path, const char* mode) +static surf_action_t ws_action_open(void *workstation, const char* mount, const char* path, const char* mode) { - storage_t st = find_storage_on_mount_list(workstation, storage); + storage_t st = find_storage_on_mount_list(workstation, mount); XBT_DEBUG("OPEN on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; - return model->extension.storage.open(st, path, mode); + return model->extension.storage.open(st, mount, path, mode); } -static surf_action_t ws_action_close(void *workstation, const char* storage, surf_file_t fp) +static surf_action_t ws_action_close(void *workstation, surf_file_t fp) { - storage_t st = find_storage_on_mount_list(workstation, storage); + storage_t st = find_storage_on_mount_list(workstation, fp->storage); XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; return model->extension.storage.close(st, fp); } -static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream) +static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream) { - storage_t st = find_storage_on_mount_list(workstation, storage); + storage_t st = find_storage_on_mount_list(workstation, stream->storage); XBT_DEBUG("READ on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; return model->extension.storage.read(st, ptr, size, nmemb, stream); } -static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream) +static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream) { - storage_t st = find_storage_on_mount_list(workstation, storage); + storage_t st = find_storage_on_mount_list(workstation, stream->storage); XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; return model->extension.storage.write(st, ptr, size, nmemb, stream); } -static surf_action_t ws_action_stat(void *workstation, const char* storage, surf_file_t stream) +static surf_action_t ws_action_stat(void *workstation, surf_file_t stream) { - storage_t st = find_storage_on_mount_list(workstation, storage); + storage_t st = find_storage_on_mount_list(workstation, stream->storage); XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; return model->extension.storage.stat(st, stream);