Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 26 Sep 2013 06:57:41 +0000 (08:57 +0200)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 26 Sep 2013 06:57:41 +0000 (08:57 +0200)
include/simgrid/simix.h
src/include/surf/surf.h
src/msg/msg_host.c
src/msg/msg_io.c
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/surf/storage.c

index 481c417..6b46fb6 100644 (file)
@@ -496,6 +496,7 @@ XBT_PUBLIC(xbt_dict_t) simcall_storage_get_properties(smx_storage_t storage);
 XBT_PUBLIC(void*) SIMIX_storage_get_data(smx_storage_t storage);
 XBT_PUBLIC(void) SIMIX_storage_set_data(smx_storage_t storage, void *data);
 XBT_PUBLIC(xbt_dict_t) SIMIX_storage_get_content(smx_storage_t storage);
+XBT_PUBLIC(xbt_dict_t) simcall_storage_get_content(smx_storage_t storage);
 XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
 /************************** AS router   **********************************/
 XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
index 9e4bf06..428a63b 100644 (file)
@@ -238,7 +238,7 @@ typedef struct surf_storage_model_extension_public {
   surf_action_t(*stat) (void *storage, surf_file_t fd);
   surf_action_t(*ls) (void *storage, const char *path);
   xbt_dict_t(*get_properties) (const void *storage);
-  xbt_dict_t(*get_content) (const void *storage);
+  xbt_dict_t(*get_content) (void *storage);
 } s_surf_model_extension_storage_t;
 
      /** \ingroup SURF_models
index 44aab80..29b5908 100644 (file)
@@ -364,7 +364,7 @@ xbt_dynar_t MSG_host_get_storage_content(msg_host_t host)
   xbt_dynar_t storage_list = simcall_host_get_storage_list(host);
   xbt_dynar_foreach(storage_list, i, storage_name){
        storage = xbt_lib_get_elm_or_null(storage_lib,storage_name);
-       xbt_dict_t content = SIMIX_storage_get_content(storage);
+       xbt_dict_t content = simcall_storage_get_content(storage);
        xbt_dynar_push(contents, &content);
   }
   return contents;
index b98e136..72b8212 100644 (file)
@@ -316,8 +316,10 @@ void *MSG_storage_get_data(msg_storage_t storage)
  *
  * \brief Returns the content (file list) of a #msg_storage_t.
  * \param storage a storage
+ * \return The content of this storage element as a dict (full path file => size)
  */
 xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
 {
-       return SIMIX_storage_get_content(storage);
+  return SIMIX_storage_get_content(storage);
+  //return (simcall_storage_get_properties(storage));
 }
index 0b519b0..084a6bb 100644 (file)
@@ -360,6 +360,7 @@ ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TSPEC(result, xbt_dyna
 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_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \
+ACTION(SIMCALL_STORAGE_GET_CONTENT, storage_get_content, WITH_ANSWER, TSPEC(result, xbt_dict_t), 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
index 491733c..4b873f9 100644 (file)
@@ -1312,6 +1312,17 @@ xbt_dict_t simcall_storage_get_properties(smx_storage_t storage)
   return simcall_BODY_storage_get_properties(storage);
 }
 
+/**
+ * \ingroup simix_storage_management
+ * \brief Returns a dict containing the content of a storage element.
+ *
+ * \param storage A storage element
+ * \return The content of this storage element as a dict (full path file => size)
+ */
+xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
+{
+  return simcall_BODY_storage_get_content(storage);
+}
 
 #ifdef HAVE_MC
 
index 0727edc..416cadf 100644 (file)
@@ -197,16 +197,17 @@ static xbt_dict_t storage_get_properties(const void *storage)
   return surf_resource_properties(surf_storage_resource_priv(storage));
 }
 
-static xbt_dict_t storage_get_content(const void *storage)
+static xbt_dict_t storage_get_content(void *storage)
 {
   /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
-  /* surf_action_t action = storage_action_execute(storage,0, LS); */
+  /*surf_action_t action = storage_action_execute(storage,0, LS);*/
+
+  void *st = surf_storage_resource_priv(storage);
   xbt_dict_t content_dict = xbt_dict_new();
   xbt_dict_cursor_t cursor = NULL;
   char *file;
   size_t size;
-
-  xbt_dict_foreach(((storage_t)storage)->content, cursor, file, size){
+  xbt_dict_foreach(((storage_t)st)->content, cursor, file, size){
     xbt_dict_set(content_dict,file,&size,NULL);
   }
   return content_dict;