typedef s_xbt_dictelm_t s_msg_storage_t;
typedef struct msg_storage_priv {
- // TODO PV: fill it (or not) !
- void * dummy;
+ const char *host;
} s_msg_storage_priv_t, *msg_storage_priv_t;
static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){
XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage);
XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
XBT_PUBLIC(msg_error_t) MSG_storage_file_rename(msg_storage_t storage, const char* src, const char* dest);
+XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
/************************** 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);
SD_workstation_get_mounted_storage_list(SD_workstation_t workstation);
XBT_PUBLIC(xbt_dynar_t)
SD_workstation_get_attached_storage_list(SD_workstation_t workstation);
+XBT_PUBLIC(const char*) SD_storage_get_host(SD_storage_t storage);
/** @} */
/************************** Task handling ************************************/
XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_storage_t storage);
XBT_PUBLIC(sg_size_t) SIMIX_storage_get_size(smx_storage_t storage);
XBT_PUBLIC(void) simcall_storage_file_rename(smx_storage_t storage, const char* src, const char* dest);
+XBT_PUBLIC(const char*) SIMIX_storage_get_host(smx_storage_t storage);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
/************************** AS router simcalls ***************************/
*/
XBT_PUBLIC(xbt_dict_t) surf_storage_action_get_ls_dict(surf_action_t action);
+
+/**
+ * @brief Get the host the storage is attached to
+ *
+ * @param resource The surf storage
+ * @return The host name
+ */
+XBT_PUBLIC(const char * ) surf_storage_get_host(surf_resource_t resource);
+
XBT_PUBLIC(surf_model_t) surf_resource_model(const void *host, int level);
/** @} */
msg_storage_t __MSG_storage_create(smx_storage_t storage)
{
const char *name = SIMIX_storage_get_name(storage);
+ const char *host = SIMIX_storage_get_host(storage);
msg_storage_priv_t storage_private = xbt_new0(s_msg_storage_priv_t, 1);
+ storage_private->host = host;
xbt_lib_set(storage_lib,name,MSG_STORAGE_LEVEL,storage_private);
return xbt_lib_get_elm_or_null(storage_lib, name);
}
THROW_UNIMPLEMENTED;
return MSG_OK;
}
+
+/** \ingroup msg_storage_management
+ *
+ * \brief Returns the host name the storage is attached to
+ *
+ * This functions checks whether a storage is a valid pointer or not and return its name.
+ */
+const char *MSG_storage_get_host(msg_storage_t storage) {
+ xbt_assert((storage != NULL), "Invalid parameters");
+ msg_storage_priv_t priv = MSG_storage_priv(storage);
+ return priv->host;
+}
typedef s_xbt_dictelm_t s_SD_storage_t;
typedef struct SD_storage {
void *data; /* user data */
+ const char *host;
} s_SD_storage_priv_t, *SD_storage_priv_t;
+static inline SD_storage_priv_t SD_storage_priv(SD_storage_t storage){
+ return xbt_lib_get_level(storage, SD_STORAGE_LEVEL);
+}
/* Task */
typedef struct SD_task {
storage = xbt_new(s_SD_storage_priv_t, 1);
storage->data = data; /* user data */
-
+ storage->host = surf_storage_get_host(surf_storage);
name = surf_resource_name(surf_storage);
xbt_lib_set(storage_lib,name, SD_STORAGE_LEVEL, storage);
return xbt_lib_get_elm_or_null(storage_lib, name);
return surf_workstation_get_attached_storage_list(workstation);
}
+/**
+ * \brief Returns the host name the storage is attached to
+ *
+ * This functions checks whether a storage is a valid pointer or not and return its name.
+ */
+const char *SD_storage_get_host(msg_storage_t storage) {
+ xbt_assert((storage != NULL), "Invalid parameters");
+ SD_storage_priv_t priv = SD_storage_priv(storage);
+ return priv->host;
+}
/* Returns whether a task can start now on a workstation*/
/*
return surf_storage_get_size(storage);
}
+const char* SIMIX_pre_storage_get_host(smx_simcall_t simcall, smx_storage_t storage){
+ return SIMIX_storage_get_host(storage);
+}
+
+const char* SIMIX_storage_get_host(smx_storage_t storage){
+ xbt_assert((storage != NULL), "Invalid parameters");
+ return surf_storage_get_host(storage);
+}
+
void SIMIX_post_io(smx_action_t action)
{
xbt_fifo_item_t i;
xbt_dict_t SIMIX_storage_get_content(smx_storage_t storage);
const char* SIMIX_pre_storage_get_name(smx_simcall_t simcall, smx_storage_t storage);
-
+const char* SIMIX_pre_storage_get_host(smx_simcall_t simcall, 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);
return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getSize();
}
+const char* surf_storage_get_host(surf_resource_t resource){
+ return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->p_attach;
+}
+
void surf_storage_rename(surf_resource_t resource, const char* src, const char* dest){
static_cast<StoragePtr>(surf_storage_resource_priv(resource))->rename(src, dest);
}