Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove surf_file_t and smx_file_t for only m_file_t
authornavarro <navarro@caraja.(none)>
Mon, 26 Mar 2012 12:06:06 +0000 (14:06 +0200)
committernavarro <navarro@caraja.(none)>
Mon, 26 Mar 2012 12:11:40 +0000 (14:11 +0200)
12 files changed:
include/msg/datatypes.h
include/simix/datatypes.h
include/simix/simix.h
include/xbt/misc.h
src/include/surf/surf.h
src/msg/msg_io.c
src/simix/smx_io.c
src/simix/smx_io_private.h
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/surf/storage.c
src/surf/workstation.c

index 8e3e1ff..50b6a66 100644 (file)
@@ -40,20 +40,6 @@ typedef struct m_host {
 typedef struct m_host *m_host_t;
 /** @} */
 
-
-/* ******************************** File ************************************ */
-/** @brief File datatype
-    @ingroup m_datatypes_management_details */
-typedef struct m_file {
-  char *name;                   /**< @brief file name */
-  void *data;                   /**< @brief user data */
-} s_m_file_t;
-/** @brief File datatype
-    @ingroup m_datatypes_management_details */
-typedef struct m_file *m_file_t;
-
-
-
 /* ******************************** Task ************************************ */
 
 typedef struct simdata_task *simdata_task_t;
index f306ccc..093cbbd 100644 (file)
 
 SG_BEGIN_DECL()
 
-/* ****************************** File *********************************** */
-typedef struct s_smx_file *smx_file_t;
-
-
-
 /* ******************************** Host ************************************ */
 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes */
 /** @brief Host datatype  
index 3c5919e..8cfbd08 100644 (file)
@@ -244,10 +244,10 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem,
 XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems);
 XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 
-XBT_PUBLIC(size_t) simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
-XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
-XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path, const char* mode);
-XBT_PUBLIC(int) simcall_file_close(const char* storage, smx_file_t fp);
+XBT_PUBLIC(size_t) simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
+XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
+XBT_PUBLIC(m_file_t) simcall_file_open(const char* storage, const char* path, const char* mode);
+XBT_PUBLIC(int) simcall_file_close(const char* storage, m_file_t fp);
 XBT_PUBLIC(int) simcall_file_stat(const char* storage, int fd, void* buf);
 
 SG_END_DECL()
index f4ea24f..9ef7324 100644 (file)
@@ -218,5 +218,16 @@ XBT_PUBLIC(const char *) xbt_procname(void);
 
 #define XBT_BACKTRACE_SIZE 10   /* FIXME: better place? Do document */
 
+/** @brief File datatype
+    @ingroup m_datatypes_management_details */
+typedef struct m_file {
+  char *name;                   /**< @brief file name */
+  void *content;                   /**< @brief user data */
+} s_m_file_t;
+/** @brief File datatype
+    @ingroup m_datatypes_management_details */
+typedef struct m_file *m_file_t;
+
+
 SG_END_DECL()
 #endif                          /* XBT_MISC_H */
index d1adedc..0c10a2d 100644 (file)
@@ -206,12 +206,6 @@ typedef struct surf_network_model_extension_public {
                            xbt_dict_t properties);
 } s_surf_model_extension_network_t;
 
-typedef struct s_surf_file {
-  char *name;                   /**< @brief host name if any */
-  void *data;                   /**< @brief user data */
-} s_surf_file_t;
-typedef struct s_surf_file *surf_file_t;
-
 /* Storage model */
 
 /** \brief Storage model extension public
@@ -222,9 +216,9 @@ typedef struct s_surf_file *surf_file_t;
 
 typedef struct surf_storage_model_extension_public {
   surf_action_t(*open) (void *storage, const char* path, const char* mode);
-  surf_action_t(*close) (void *storage, surf_file_t fp);
-  surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
-  surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*close) (void *storage, m_file_t fp);
+  surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
+  surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
   surf_action_t(*stat) (void *storage, int fd, void* buf);
   void* (*create_resource) (const char* id, const char* model,const char* type_id);
 } s_surf_model_extension_storage_t;
@@ -255,9 +249,9 @@ typedef struct surf_workstation_model_extension_public {
   double (*get_link_bandwidth) (const void *link);                                         /**< Return the current bandwidth of a network link */
   double (*get_link_latency) (const void *link);                                           /**< Return the current latency of a network link */
   surf_action_t(*open) (void *workstation, const char* storage, const char* path, const char* mode);
-  surf_action_t(*close) (void *workstation, const char* storage, surf_file_t fp);
-  surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
-  surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*close) (void *workstation, const char* storage, m_file_t fp);
+  surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
+  surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
   surf_action_t(*stat) (void *workstation, const char* storage, int fd, void* buf);
   int (*link_shared) (const void *link);
    xbt_dict_t(*get_properties) (const void *resource);
index eed97d2..c00fb85 100644 (file)
@@ -27,7 +27,7 @@
  */
 size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb,  m_file_t stream)
 {
-  return simcall_file_read(storage, ptr, size, nmemb, (smx_file_t)stream);
+  return simcall_file_read(storage, ptr, size, nmemb, (m_file_t)stream);
 }
 
 /** \ingroup m_file_management
@@ -42,7 +42,7 @@ size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb,
  */
 size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
-  return simcall_file_write(storage, ptr, size, nmemb, (smx_file_t)stream);
+  return simcall_file_write(storage, ptr, size, nmemb, (m_file_t)stream);
 }
 
 /** \ingroup m_file_management
@@ -76,7 +76,7 @@ m_file_t MSG_file_open(const char* storage, const char* path, const char* mode)
  */
 int MSG_file_close(const char* storage, m_file_t fp)
 {
-  return simcall_file_close(storage, (smx_file_t)fp);
+  return simcall_file_close(storage, (m_file_t)fp);
 }
 
 /** \ingroup m_file_management
index e962225..bc6935b 100644 (file)
@@ -27,7 +27,7 @@ void SIMIX_pre_file_read(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream)
+smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -47,7 +47,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* p
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, (surf_file_t)stream),
+  action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, stream),
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -68,7 +68,7 @@ void SIMIX_pre_file_write(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
+smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -88,7 +88,7 @@ smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, (surf_file_t)stream);
+  action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, stream);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -145,7 +145,7 @@ void SIMIX_pre_file_close(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_file_t fp)
+smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, m_file_t fp)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -165,7 +165,7 @@ smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_fi
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, (surf_file_t)fp);
+  action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, fp);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
index 1c2e594..861f6ea 100644 (file)
 #include "simix/datatypes.h"
 #include "smx_smurf_private.h"
 
-/** @brief File datatype
-    @ingroup m_datatypes_management_details */
-typedef struct s_smx_file {
-  char *name;                   /**< @brief host name if any */
-  void *data;                   /**< @brief user data */
-} s_smx_file_t;
-/** @} */
-
 void SIMIX_pre_file_read(smx_simcall_t simcall);
 void SIMIX_pre_file_write(smx_simcall_t simcall);
 void SIMIX_pre_file_open(smx_simcall_t simcall);
 void SIMIX_pre_file_close(smx_simcall_t simcall);
 void SIMIX_pre_file_stat(smx_simcall_t simcall);
 
-smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
-smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
+smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream);
+smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream);
 smx_action_t SIMIX_file_open(smx_process_t process, const char* storage, const char* path, const char* mode);
-smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, smx_file_t fp);
+smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, m_file_t fp);
 smx_action_t SIMIX_file_stat(smx_process_t process, const char* storage, int fd, void* buf);
 
 void SIMIX_post_io(smx_action_t action);
index 07385e9..d828e5b 100644 (file)
@@ -512,7 +512,7 @@ typedef struct s_smx_simcall {
       void *ptr;
       size_t size;
       size_t nmemb;
-      smx_file_t stream;
+      m_file_t stream;
       size_t result;
     } file_read;
 
@@ -521,7 +521,7 @@ typedef struct s_smx_simcall {
       const void *ptr;
       size_t size;
       size_t nmemb;
-      smx_file_t stream;
+      m_file_t stream;
       size_t result;
     } file_write;
 
@@ -529,12 +529,12 @@ typedef struct s_smx_simcall {
       const char* storage;
       const char* path;
       const char* mode;
-      smx_file_t result;
+      m_file_t result;
     } file_open;
 
     struct {
       const char* storage;
-      smx_file_t fp;
+      m_file_t fp;
       int result;
     } file_close;
 
index 9d90214..c0957ba 100644 (file)
@@ -1177,7 +1177,7 @@ int simcall_sem_get_capacity(smx_sem_t sem)
   return simcall->sem_get_capacity.result;
 }
 
-size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream)
+size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
@@ -1192,7 +1192,7 @@ size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nme
   return simcall->file_read.result;
 }
 
-size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
+size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
@@ -1207,7 +1207,7 @@ size_t simcall_file_write(const char* storage, const void* ptr, size_t size, siz
   return simcall->file_write.result;
 }
 
-smx_file_t simcall_file_open(const char* storage, const char* path, const char* mode)
+m_file_t simcall_file_open(const char* storage, const char* path, const char* mode)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
@@ -1220,7 +1220,7 @@ smx_file_t simcall_file_open(const char* storage, const char* path, const char*
   return simcall->file_open.result;
 }
 
-int simcall_file_close(const char* storage, smx_file_t fp)
+int simcall_file_close(const char* storage, m_file_t fp)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
index e4fe016..74627b9 100644 (file)
@@ -51,17 +51,17 @@ static surf_action_t storage_action_open(void *storage, const char* path, const
   return action;
 }
 
-static surf_action_t storage_action_close(void *storage, surf_file_t fp)
+static surf_action_t storage_action_close(void *storage, m_file_t fp)
 {
   return storage_action_sleep(storage,2.0);
 }
 
-static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   return storage_action_sleep(storage,3.0);
 }
 
-static surf_action_t storage_action_write(void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t storage_action_write(void *storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   return storage_action_sleep(storage,4.0);
 }
index 9cc7163..0df7149 100644 (file)
@@ -311,7 +311,7 @@ static surf_action_t ws_action_open(void *workstation, const char* storage, cons
   return model->extension.storage.open(st, path, mode);
 }
 
-static surf_action_t ws_action_close(void *workstation, const char* storage, surf_file_t fp)
+static surf_action_t ws_action_close(void *workstation, const char* storage, m_file_t fp)
 {
   storage_t st = find_storage_on_mount_list(workstation, storage);
   XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
@@ -319,7 +319,7 @@ static surf_action_t ws_action_close(void *workstation, const char* storage, sur
   return model->extension.storage.close(st, fp);
 }
 
-static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   storage_t st = find_storage_on_mount_list(workstation, storage);
   XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
@@ -327,7 +327,7 @@ static surf_action_t ws_action_read(void *workstation, const char* storage, void
   return model->extension.storage.read(st, ptr, size, nmemb, stream);
 }
 
-static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, m_file_t stream)
 {
   storage_t st = find_storage_on_mount_list(workstation, storage);
   XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);