surf_action_t(*stat) (void *storage, surf_file_t stream);
surf_action_t(*unlink) (void *storage, surf_file_t stream);
surf_action_t(*ls) (void *storage, const char *path);
- surf_action_t(*get_size) (void *storage, surf_file_t fd);
+ size_t (*get_size) (void *storage, surf_file_t fd);
} s_surf_model_extension_storage_t;
/** \ingroup SURF_models
surf_action_t(*stat) (void *workstation, surf_file_t stream);
surf_action_t(*unlink) (void *workstation, surf_file_t stream);
surf_action_t(*ls) (void *workstation, const char* mount, const char *path);
- surf_action_t(*get_size) (void *workstation, surf_file_t fd);
+ size_t (*get_size) (void *workstation, surf_file_t fd);
int (*link_shared) (const void *link);
xbt_dict_t(*get_properties) (const void *resource);
*/
size_t MSG_file_get_size(msg_file_t fd){
- size_t size = simcall_file_get_size(fd->simdata->smx_file);
- return size;
+ return simcall_file_get_size(fd->simdata->smx_file);
}
/** \ingroup msg_file_management
return action;
}
-void SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd)
+size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd)
{
- smx_action_t action = SIMIX_file_get_size(simcall->issuer, fd);
- xbt_fifo_push(action->simcalls, simcall);
- simcall->issuer->waiting_action = action;
+ return SIMIX_file_get_size(simcall->issuer, fd);
}
-smx_action_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
+size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
{
- smx_action_t action;
smx_host_t host = process->smx_host;
-
- /* check if the host is active */
- if (surf_workstation_model->extension.
- workstation.get_state(host) != SURF_RESOURCE_ON) {
- THROWF(host_error, 0, "Host %s failed, you cannot call this function",
- sg_host_name(host));
- }
-
- action = xbt_mallocator_get(simix_global->action_mallocator);
- action->type = SIMIX_ACTION_IO;
- action->name = NULL;
-#ifdef HAVE_TRACING
- action->category = NULL;
-#endif
-
- action->io.host = host;
- action->io.surf_io = surf_workstation_model->extension.workstation.get_size(host, fd->surf_file);
-
- surf_workstation_model->action_data_set(action->io.surf_io, action);
- XBT_DEBUG("Create io action %p", action);
-
- return action;
+ return surf_workstation_model->extension.workstation.get_size(host,
+ fd->surf_file);
}
// }
simcall_file_ls__set__result(simcall, (action->io.surf_io)->ls_dict);
break;
- case SIMCALL_FILE_GET_SIZE:
- simcall_file_get_size__set__result(simcall,
- ((action->io.surf_io)->file->size));
- break;
-
default:
break;
}
void SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd);
void SIMIX_pre_file_ls(smx_simcall_t simcall,
const char* mount, const char* path);
-void SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
+size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
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_close(smx_process_t process, smx_file_t fd);
smx_action_t SIMIX_file_unlink(smx_process_t process, smx_file_t fd);
smx_action_t SIMIX_file_ls(smx_process_t process, const char *mount, const char *path);
-smx_action_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
+size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
ACTION(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \
-ACTION(SIMCALL_FILE_GET_SIZE, file_get_size, WITHOUT_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_GET_SIZE, file_get_size, WITH_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep
/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
-/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. The SimGrid Team.
+/* Copyright (c) 2004 - 2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
return action;
}
-static surf_action_t storage_action_get_size(void *storage, surf_file_t stream)
-{
- surf_action_t action = storage_action_execute(storage,0,GET_SIZE);
- action->file = stream;
- return action;
-}
-
static surf_action_t storage_action_unlink(void *storage, surf_file_t stream)
{
surf_action_t action = storage_action_execute(storage,0, UNLINK);
case STAT:
case UNLINK:
case LS:
- case GET_SIZE:
break;
case READ:
lmm_expand(storage_maxmin_system, STORAGE->constraint_read,
surf_storage_model->extension.storage.write = storage_action_write;
surf_storage_model->extension.storage.unlink = storage_action_unlink;
surf_storage_model->extension.storage.ls = storage_action_ls;
- surf_storage_model->extension.storage.get_size = storage_action_get_size;
if (!storage_maxmin_system) {
storage_maxmin_system = lmm_system_new(storage_selective_update);
} s_storage_t, *storage_t;
typedef enum {
- READ=0, WRITE, STAT, OPEN, CLOSE, UNLINK, LS, GET_SIZE
+ READ=0, WRITE, STAT, OPEN, CLOSE, UNLINK, LS
} e_surf_action_storage_type_t;
typedef struct surf_action_storage {
return model->extension.storage.ls(st, path);
}
-static surf_action_t ws_action_get_size(void *workstation, surf_file_t stream)
+static size_t ws_file_get_size(void *workstation, surf_file_t stream)
{
- storage_t st = find_storage_on_mount_list(workstation, stream->storage);
- XBT_DEBUG("GET SIZE on disk '%s'",st->generic_resource.name);
- surf_model_t model = st->generic_resource.model;
- return model->extension.storage.get_size(st, stream);
+ return stream->size;
}
static void surf_workstation_model_init_internal(void)
surf_workstation_model->extension.workstation.stat = ws_action_stat;
surf_workstation_model->extension.workstation.unlink = ws_action_unlink;
surf_workstation_model->extension.workstation.ls = ws_action_ls;
- surf_workstation_model->extension.workstation.get_size = ws_action_get_size;
+ surf_workstation_model->extension.workstation.get_size = ws_file_get_size;
}
void surf_workstation_model_init_current_default(void)