Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MSG_host_get_storage_list() function
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 10 Jul 2013 15:30:07 +0000 (17:30 +0200)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 10 Jul 2013 15:30:07 +0000 (17:30 +0200)
include/msg/msg.h
include/simgrid/simix.h
src/include/surf/surf.h
src/msg/msg_host.c
src/msg/msg_io.c
src/simix/smx_host.c
src/simix/smx_host_private.h
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/surf/workstation.c

index a54b484..bc4cc50 100644 (file)
@@ -127,7 +127,7 @@ XBT_PUBLIC(void) MSG_create_environment(const char *file);
 XBT_PUBLIC(msg_host_t) MSG_get_host_by_name(const char *name);
 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
 XBT_PUBLIC(int) MSG_get_host_number(void);
 XBT_PUBLIC(msg_host_t) MSG_get_host_by_name(const char *name);
 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
 XBT_PUBLIC(int) MSG_get_host_number(void);
-
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_storage_list(msg_host_t host);
 /************************** Process handling *********************************/
 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
                                            xbt_main_func_t code,
 /************************** Process handling *********************************/
 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
                                            xbt_main_func_t code,
index b09d2ce..5308e81 100644 (file)
@@ -261,7 +261,7 @@ XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
 XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
 XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
 XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
 XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
 XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
 XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
-
+XBT_PUBLIC(xbt_dynar_t) SIMIX_host_get_storage_list(smx_host_t host);
 
 /********************************* Process ************************************/
 XBT_PUBLIC(int) SIMIX_process_count(void);
 
 /********************************* Process ************************************/
 XBT_PUBLIC(int) SIMIX_process_count(void);
@@ -329,7 +329,7 @@ XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_action_t execution);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution);
 XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution);
 XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
-
+XBT_PUBLIC(xbt_dynar_t) simcall_host_get_storage_list(smx_host_t host);
 
 /**************************** Process simcalls ********************************/
 /* Constructor and Destructor */
 
 /**************************** Process simcalls ********************************/
 /* Constructor and Destructor */
index a61c76a..2909fa4 100644 (file)
@@ -288,8 +288,8 @@ typedef struct surf_workstation_model_extension_public {
    xbt_dict_t(*get_properties) (const void *resource);
   void (*add_traces) (void);
 
    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, surf_storage_t storage);
+  xbt_dynar_t (*get_storage_list) (void *workstation);
 
 } s_surf_model_extension_workstation_t;
 
 
 } s_surf_model_extension_workstation_t;
 
index df7253c..f6ee22b 100644 (file)
@@ -338,4 +338,13 @@ double MSG_get_host_consumed_energy(msg_host_t host) {
          return simcall_host_get_consumed_energy(host);
 }
 
          return simcall_host_get_consumed_energy(host);
 }
 
-
+/** \ingroup m_host_management
+ * \brief Return the list of mounted storages on an host.
+ * \param host a host
+ * \return a dynar containing all mounted storages on the host
+ */
+xbt_dynar_t MSG_host_get_storage_list(msg_host_t host)
+{
+  xbt_assert((host != NULL), "Invalid parameters");
+  return (simcall_host_get_storage_list(host));
+}
index c2da672..6c8817e 100644 (file)
@@ -139,11 +139,9 @@ xbt_dict_t MSG_file_ls(const char *mount, const char *path)
 
 /** \ingroup msg_storage_management
  * \brief Return the free space size of a storage element
 
 /** \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)
  */
  * \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);
 }
 size_t MSG_storage_get_free_size(msg_storage_t sd){
   return simcall_storage_get_free_size(sd->simdata->smx_storage);
 }
index 1882fcb..9c53fac 100644 (file)
@@ -623,3 +623,11 @@ void SIMIX_set_category(smx_action_t action, const char *category)
 }
 #endif
 
 }
 #endif
 
+xbt_dynar_t SIMIX_pre_host_get_storage_list(smx_simcall_t simcall, smx_host_t host){
+  return SIMIX_host_get_storage_list(host);
+}
+xbt_dynar_t SIMIX_host_get_storage_list(smx_host_t host){
+  xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+  return surf_workstation_model->extension.workstation.get_storage_list(host);
+}
index ea66ee6..d810ce4 100644 (file)
@@ -60,6 +60,7 @@ double SIMIX_host_execution_get_remains(smx_action_t action);
 e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
 void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
 void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
 e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
 void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
 void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
+xbt_dynar_t SIMIX_host_get_storage_list(smx_host_t host);
 
 // pre prototypes
 smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
 
 // pre prototypes
 smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
@@ -92,7 +93,7 @@ void SIMIX_host_execution_suspend(smx_action_t action);
 void SIMIX_host_execution_resume(smx_action_t action);
 
 void SIMIX_post_host_execute(smx_action_t action);
 void SIMIX_host_execution_resume(smx_action_t action);
 
 void SIMIX_post_host_execute(smx_action_t action);
-
+xbt_dynar_t SIMIX_pre_host_get_storage_list(smx_simcall_t, smx_host_t);
 #ifdef HAVE_TRACING
 void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
                            const char *category);
 #ifdef HAVE_TRACING
 void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
                            const char *category);
index a6cfd87..f1fc983 100644 (file)
@@ -282,6 +282,7 @@ ACTION(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSW
 ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_GET_STORAGE_LIST, host_get_storage_list, WITH_ANSWER, TSPEC(result, xbt_dynar_t), TSPEC(host, smx_host_t)) sep \
 ACTION(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \
 ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
 ACTION(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result), TINT(reset_pid)) sep \
 ACTION(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \
 ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
 ACTION(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result), TINT(reset_pid)) sep \
index 9a5d1f4..56c1f0f 100644 (file)
@@ -1237,12 +1237,26 @@ size_t simcall_file_get_size (smx_file_t fd){
 
 /**
  * \ingroup simix_storage_management
 
 /**
  * \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
  */
 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 (smx_storage_t storage){
   return simcall_BODY_storage_get_free_size(storage);
 }
 
+/**
+ * \ingroup simix_host_management
+ * \brief Return the list of storages mounted on an host.
+ * \param host A SIMIX host
+ * \return a dynar containing all storages mounted on the host
+ */
+xbt_dynar_t simcall_host_get_storage_list(smx_host_t host)
+{
+  return simcall_BODY_host_get_storage_list(host);
+}
+
+
 #ifdef HAVE_MC
 
 void *simcall_mc_snapshot(void)
 #ifdef HAVE_MC
 
 void *simcall_mc_snapshot(void)
index e413b21..9b4e959 100644 (file)
@@ -365,6 +365,12 @@ static storage_t find_storage_on_mount_list(void *workstation,const char* mount)
   return st;
 }
 
   return st;
 }
 
+static xbt_dynar_t ws_get_storage_list(void *workstation)
+{
+  workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);
+  return ws->storage;
+}
+
 static surf_action_t ws_action_open(void *workstation, const char* mount,
                                     const char* path)
 {
 static surf_action_t ws_action_open(void *workstation, const char* mount,
                                     const char* path)
 {
@@ -517,6 +523,7 @@ static void surf_workstation_model_init_internal(void)
   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;
   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;
+  surf_workstation_model->extension.workstation.get_storage_list = ws_get_storage_list;
 }
 
 void surf_workstation_model_init_current_default(void)
 }
 
 void surf_workstation_model_init_current_default(void)