XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
XBT_PUBLIC(size_t) MSG_file_get_size(msg_file_t fd);
XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd);
-
XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd);
XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path);
-XBT_PUBLIC(size_t) MSG_storage_get_free_size(msg_storage_t sd);
-
XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
+
+/************************** Storage handling ***********************************/
+XBT_PUBLIC(size_t) MSG_storage_get_free_size(const char* name);
+XBT_PUBLIC(size_t) MSG_storage_get_used_size(const char* name);
+
/************************** AS Router handling ************************************/
XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
XBT_PUBLIC(xbt_dict_t) simcall_file_ls(const char* mount, const char* path);
XBT_PUBLIC(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(size_t) simcall_storage_get_free_size (smx_storage_t storage);
+
+/***************************** Storage **********************************/
+XBT_PUBLIC(size_t) simcall_storage_get_free_size (const char* name);
+XBT_PUBLIC(size_t) simcall_storage_get_used_size (const char* name);
+
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
/************************** AS router simcalls ***************************/
xbt_dynar_t (*get_info) (void *workstation, surf_file_t fd);
int (*link_shared) (const void *link);
- xbt_dict_t(*get_properties) (const void *resource);
+ xbt_dict_t(*get_properties) (const void *resource);
void (*add_traces) (void);
- size_t (*get_free_size) (void *workstation, surf_storage_t storage);
+ size_t (*get_free_size) (void *workstation,const char* name);
+ size_t (*get_used_size) (void *workstation,const char* name);
xbt_dynar_t (*get_storage_list) (void *workstation);
} s_surf_model_extension_workstation_t;
/** \ingroup msg_storage_management
* \brief Return the free space size of a storage element
- * \param sd is the storage descriptor (#msg_storage_t)
+ * \param the storage name (#char*)
* \return the free space size of the storage element (as a size_t)
*/
-size_t MSG_storage_get_free_size(msg_storage_t sd){
- return simcall_storage_get_free_size(sd->simdata->smx_storage);
+size_t MSG_storage_get_free_size(const char* name){
+ return simcall_storage_get_free_size(name);
+}
+
+/** \ingroup msg_storage_management
+ * \brief Return the used space size of a storage element
+ * \param the storage name (#char*)
+ * \return the used space size of the storage element (as a size_t)
+ */
+size_t MSG_storage_get_used_size(const char* name){
+ return simcall_storage_get_used_size(name);
}
fd->surf_file);
}
-size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage)
+size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name)
{
- return SIMIX_storage_get_free_size(simcall->issuer, storage);
+ return SIMIX_storage_get_free_size(simcall->issuer, name);
}
-size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t storage)
+size_t SIMIX_storage_get_free_size(smx_process_t process, const char* name)
{
smx_host_t host = process->smx_host;
- return surf_workstation_model->extension.workstation.get_free_size(host,
- storage->surf_storage);
+ return surf_workstation_model->extension.workstation.get_free_size(host,name);
}
+size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, const char* name)
+{
+ return SIMIX_storage_get_used_size(simcall->issuer, name);
+}
+
+size_t SIMIX_storage_get_used_size(smx_process_t process, const char* name)
+{
+ smx_host_t host = process->smx_host;
+ return surf_workstation_model->extension.workstation.get_used_size(host,name);
+}
void SIMIX_post_io(smx_action_t action)
{
size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd);
-size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage);
-size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t storage);
+size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,const char* name);
+size_t SIMIX_storage_get_free_size(smx_process_t process,const char* name);
+
+size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name);
+size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name);
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
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, WITH_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TSPEC(result, xbt_dynar_t), TSPEC(fd, smx_file_t)) sep \
-ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSPEC(storage, smx_storage_t)) sep \
+ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
+ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) 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
/**
* \ingroup simix_storage_management
- * \brief Return the free size on a given storage element.
- * \param storage A SIMIX storage
- * \return a dynar containing all mounted storages on the host
+ * \brief Return the free space size on a given storage element.
+ * \param storage name
+ * \return Return the free space size on a given storage element (as size_t)
*/
-size_t simcall_storage_get_free_size (smx_storage_t storage){
- return simcall_BODY_storage_get_free_size(storage);
+size_t simcall_storage_get_free_size (const char* name){
+ return simcall_BODY_storage_get_free_size(name);
+}
+
+/**
+ * \ingroup simix_storage_management
+ * \brief Return the used space size on a given storage element.
+ * \param storage name
+ * \return Return the used space size on a given storage element (as size_t)
+ */
+size_t simcall_storage_get_used_size (const char* name){
+ return simcall_BODY_storage_get_used_size(name);
}
/**
char *type_id;
xbt_dict_t properties;
size_t size;
- size_t used_size;
} s_storage_type_t, *storage_type_t;
typedef struct s_mount {
static xbt_dynar_t ws_get_storage_list(void *workstation)
{
+ s_mount_t mnt;
+ unsigned int i;
+ xbt_dynar_t storage_list = xbt_dynar_new(sizeof(void*), NULL);
+
workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);
- return ws->storage;
+ xbt_dynar_t storages = ws->storage;
+
+ xbt_dynar_foreach(storages,i,mnt)
+ {
+ xbt_dynar_push_as(storage_list, char*, mnt.name);
+ }
+ return storage_list;
}
static surf_action_t ws_action_open(void *workstation, const char* mount,
return info;
}
-static size_t ws_storage_get_free_size(void *workstation, surf_storage_t storage)
+static size_t ws_storage_get_free_size(void *workstation,const char* name)
{
- return storage->size - storage->used_size;
-
+ storage_t st = find_storage_on_mount_list(workstation, name);
+ return st->size - st->used_size;
}
-
+static size_t ws_storage_get_used_size(void *workstation,const char* name)
+{
+ storage_t st = find_storage_on_mount_list(workstation, name);
+ return st->used_size;
+}
static void surf_workstation_model_init_internal(void)
{
surf_workstation_model->extension.workstation.get_size = ws_file_get_size;
surf_workstation_model->extension.workstation.get_info = ws_file_get_info;
surf_workstation_model->extension.workstation.get_free_size = ws_storage_get_free_size;
+ surf_workstation_model->extension.workstation.get_used_size = ws_storage_get_used_size;
surf_workstation_model->extension.workstation.get_storage_list = ws_get_storage_list;
}