XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host);
XBT_PUBLIC(smx_file_t) simcall_file_open(const char* fullpath, smx_host_t host);
XBT_PUBLIC(int) simcall_file_close(smx_file_t fd, smx_host_t host);
-XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd);
+XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd, smx_host_t host);
XBT_PUBLIC(sg_size_t) simcall_file_get_size(smx_file_t fd);
XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd);
XBT_PUBLIC(sg_size_t) simcall_file_tell(smx_file_t fd);
*/
msg_error_t MSG_file_unlink(msg_file_t fd)
{
- msg_file_priv_t priv = MSG_file_priv(fd);
- int res = simcall_file_unlink(priv->simdata->smx_file);
+ msg_file_priv_t file_priv = MSG_file_priv(fd);
+ /* Find the host where the file is physically located (remote or local)*/
+ msg_storage_t storage_src =
+ (msg_storage_t) xbt_lib_get_elm_or_null(storage_lib,
+ file_priv->storageId);
+ msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src);
+ msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname);
+ int res = simcall_file_unlink(file_priv->simdata->smx_file, attached_host);
return res;
}
}
free(file_mount_name);
}
+ xbt_dict_free(&storage_list);
+
if(longest_prefix_length>0){
/* Mount point found, retrieve the host the storage is attached to */
msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
file_write False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t)
file_open False (void*, smx_file_t) (fullpath, const char*) (host, void*, smx_host_t)
file_close False (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
-file_unlink True (int) (fd, void*, smx_file_t)
+file_unlink True (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
file_get_size True (sg_size_t) (fd, void*, smx_file_t)
file_tell True (sg_size_t) (fd, void*, smx_file_t)
file_seek True (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int)
static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg){
simcall->args[0].dp = arg;
}
+static inline smx_host_t simcall_file_unlink__get__host(smx_simcall_t simcall){
+ return (smx_host_t) simcall->args[1].dp;
+}
+static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, void* arg){
+ simcall->args[1].dp = arg;
+}
static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall){
return (smx_file_t) simcall->args[0].dp;
}
}
return self->simcall.result.i;
}
- inline static int simcall_BODY_file_unlink(smx_file_t fd) {
+ inline static int simcall_BODY_file_unlink(smx_file_t fd, smx_host_t host) {
smx_process_t self = SIMIX_process_self();
self->simcall.call = SIMCALL_FILE_UNLINK;
memset(&self->simcall.result, 0, sizeof(self->simcall.result));
memset(self->simcall.args, 0, sizeof(self->simcall.args));
self->simcall.args[0].dp = (void*) fd;
+ self->simcall.args[1].dp = (void*) host;
if (self != simix_global->maestro_process) {
XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
break;
case SIMCALL_FILE_UNLINK:
- simcall->result.i = SIMIX_pre_file_unlink(simcall , (smx_file_t) simcall->args[0].dp);
+ simcall->result.i = SIMIX_pre_file_unlink(simcall , (smx_file_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp);
SIMIX_simcall_answer(simcall);
break;
//SIMIX FILE UNLINK
-int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd)
+int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd, smx_host_t host)
{
- return SIMIX_file_unlink(simcall->issuer, fd);
+ return SIMIX_file_unlink(simcall->issuer, fd, host);
}
-int SIMIX_file_unlink(smx_process_t process, smx_file_t fd)
+int SIMIX_file_unlink(smx_process_t process, smx_file_t fd, smx_host_t host)
{
- smx_host_t host = process->smx_host;
/* check if the host is active */
if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) {
THROWF(host_error, 0, "Host %s failed, you cannot call this function",
void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_size_t size, smx_host_t host);
void SIMIX_pre_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host);
void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host);
-int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd);
+int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd, smx_host_t host);
sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
sg_size_t SIMIX_pre_file_tell(smx_simcall_t simcall, smx_file_t fd);
xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd);
smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size, smx_host_t host);
smx_action_t SIMIX_file_open(smx_process_t process, const char* fullpath, smx_host_t host);
smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd, smx_host_t host);
-int SIMIX_file_unlink(smx_process_t process, smx_file_t fd);
+int SIMIX_file_unlink(smx_process_t process, smx_file_t fd, smx_host_t host);
sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd);
xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd);
* \ingroup simix_file_management
*
*/
-int simcall_file_close(smx_file_t fd, smx_host_t host)
+int simcall_file_close(smx_file_t fd, smx_host_t host)
{
return simcall_BODY_file_close(fd, host);
}
* \ingroup simix_file_management
*
*/
-int simcall_file_unlink(smx_file_t fd)
+int simcall_file_unlink(smx_file_t fd, smx_host_t host)
{
- return simcall_BODY_file_unlink(fd);
+ return simcall_BODY_file_unlink(fd, host);
}
/**