You should consider this as an opaque object.
*/
+
typedef struct msg_file *msg_file_t;
+/* ******************************** Storage ************************************ */
+typedef struct simdata_storage *simdata_storage_t;
+
+typedef struct msg_storage {
+ char *model;
+ char *content_type;
+ char *type_id;
+ size_t size;
+ xbt_dict_t properties;
+ simdata_storage_t simdata; /**< @brief simulator data */
+ void *data; /**< @brief user data */
+} s_msg_storage_t;
+
+typedef struct msg_storage *msg_storage_t;
+
/*************** Begin GPU ***************/
typedef struct simdata_gpu_task *simdata_gpu_task_t;
/********************************** File *************************************/
typedef struct s_smx_file *smx_file_t;
+/********************************** Storage *************************************/
+typedef struct s_smx_storage *smx_storage_t;
+
/********************************** Action *************************************/
typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
*/
typedef struct surf_action *surf_action_t;
typedef struct surf_file *surf_file_t;
+typedef struct surf_storage *surf_storage_t;
typedef struct surf_stat *surf_stat_t;
typedef struct lmm_element *lmm_element_t;
xbt_dict_t(*get_properties) (const void *resource);
void (*add_traces) (void);
+
+ size_t (*get_free_size) (void *workstation, surf_storage_t storage);
+
} s_surf_model_extension_workstation_t;
return simcall_file_ls(mount, path);
}
+
+/** \ingroup msg_storage_management
+ * \brief Return the free space size of a storage element
+ *
+ * \param sd is the storage descriptor (#msg_storage_t)
+ * \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);
+}
smx_file_t smx_file;
} s_simdata_file_t;
+/********************************* Storage **************************************/
+typedef struct simdata_storage {
+ smx_storage_t smx_storage;
+} s_simdata_storage_t;
+
/*************** Begin GPU ***************/
typedef struct simdata_gpu_task {
double computation_amount; /* Computation size */
fd->surf_file);
}
+size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage)
+{
+ return SIMIX_storage_get_free_size(simcall->issuer, storage);
+}
+
+size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t storage)
+{
+ smx_host_t host = process->smx_host;
+ return surf_workstation_model->extension.workstation.get_free_size(host,
+ storage->surf_storage);
+}
+
void SIMIX_post_io(smx_action_t action)
{
const char *path);
size_t SIMIX_file_get_size(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);
+
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
void SIMIX_io_finish(smx_action_t action);
surf_file_t surf_file;
} s_smx_file_t;
+/* ******************************** Storage ************************************ */
+typedef struct s_smx_storage {
+ surf_storage_t surf_storage;
+} s_smx_storage_t;
+
/*********************************** Time ************************************/
/** @brief Timer datatype */
ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITH_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, WITH_ANSWER, TSIZE(result), 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_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
return simcall_BODY_file_get_size(fd);
}
+/**
+ * \ingroup simix_storage_management
+ *
+ */
+size_t simcall_storage_get_free_size (smx_storage_t storage){
+ return simcall_BODY_storage_get_free_size(storage);
+}
+
#ifdef HAVE_MC
void *simcall_mc_snapshot(void)
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 {
size_t size;
} s_surf_file_t;
-typedef struct storage {
+typedef struct surf_storage {
s_surf_resource_t generic_resource; /*< Structure with generic data. Needed at begin to interact with SURF */
e_surf_resource_state_t state_current; /*< STORAGE current state (ON or OFF) */
lmm_constraint_t constraint; /* Constraint for maximum bandwidth from connection */
xbt_dict_t content; /* char * -> s_surf_file_t */
size_t size;
size_t used_size;
+ char *type_id;
+ char *content_type;
xbt_dynar_t write_actions;
} s_storage_t, *storage_t;
return fd->size;
}
+static size_t ws_storage_get_free_size(void *workstation, surf_storage_t storage)
+{
+ return storage->size - storage->used_size;
+
+}
+
+
+
static void surf_workstation_model_init_internal(void)
{
surf_workstation_model = surf_model_init();
surf_workstation_model->extension.workstation.unlink = ws_file_unlink;
surf_workstation_model->extension.workstation.ls = ws_action_ls;
surf_workstation_model->extension.workstation.get_size = ws_file_get_size;
+ surf_workstation_model->extension.workstation.get_free_size = ws_storage_get_free_size;
}
void surf_workstation_model_init_current_default(void)