Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics : s/sim_data/simdata/g
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 17 Dec 2004 00:04:50 +0000 (00:04 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 17 Dec 2004 00:04:50 +0000 (00:04 +0000)
still does not break backward compatibility. It was private before.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@674 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/msg/datatypes.h
src/msg/host.c
src/msg/private.h
src/msg/task.c

index beba7c6..db4b38a 100644 (file)
 
 /********************************* Host **************************************/
 
-typedef struct sim_data_host *sim_data_host_t;
+typedef struct simdata_host *simdata_host_t;
 typedef struct m_host {
   char *name;                  /* host name if any */
-  sim_data_host_t simdata;     /* simulator data */
+  simdata_host_t simdata;      /* simulator data */
   void *data;                  /* user data */
 } s_m_host_t;
 /** \brief Host datatype  
@@ -32,10 +32,10 @@ typedef s_m_host_t *m_host_t;
 
 /********************************* Task **************************************/
 
-typedef struct sim_data_task *sim_data_task_t;
+typedef struct simdata_task *simdata_task_t;
 typedef struct m_task {
   char *name;                  /* host name if any */
-  sim_data_task_t simdata;     /* simulator data */
+  simdata_task_t simdata;      /* simulator data */
   void *data;                  /* user data */
 } s_m_task_t;
 
@@ -55,10 +55,10 @@ typedef s_m_task_t *m_task_t;
 #define MSG_TASK_UNINITIALIZED NULL
 
 /******************************* Process *************************************/
-typedef struct sim_data_process *sim_data_process_t;
+typedef struct simdata_process *simdata_process_t;
 typedef struct m_process {
   char *name;                  /* process name if any */
-  sim_data_process_t simdata;  /* simulator data */
+  simdata_process_t simdata;   /* simulator data */
   void *data;                  /* user data */
 } s_m_process_t;
 /** \brief Agent datatype  
index eafbe75..a38cfe1 100644 (file)
@@ -16,21 +16,22 @@ m_host_t __MSG_host_create(const char *name,
                         void *workstation,
                         void *data)
 {
-  sim_data_host_t sim_data = xbt_new0(s_sim_data_host_t,1);
+  simdata_host_t simdata = xbt_new0(s_simdata_host_t,1);
   m_host_t host = xbt_new0(s_m_host_t,1);
   int i;
 
   /* Host structure */
   host->name = xbt_strdup(name);
-  host->simdata = sim_data;
+  host->simdata = simdata;
   host->data = data;
 
-  sim_data->host = workstation;
+  simdata->host = workstation;
 
-  sim_data->mbox = xbt_new0(xbt_fifo_t, msg_global->max_channel);
+  simdata->mbox = xbt_new0(xbt_fifo_t, msg_global->max_channel);
   for (i = 0; i < msg_global->max_channel; i++)
-    sim_data->mbox[i] = xbt_fifo_new();
-  sim_data->sleeping = xbt_new0(m_process_t, msg_global->max_channel);
+    simdata->mbox[i] = xbt_fifo_new();
+  simdata->sleeping = xbt_new0(m_process_t, msg_global->max_channel);
+  simdata->process_list = xbt_fifo_new();
   /* Update global variables */
 
   xbt_fifo_push(msg_global->host, host);
@@ -104,22 +105,22 @@ m_host_t MSG_host_self(void)
  */
 void __MSG_host_destroy(m_host_t host)
 {
-  sim_data_host_t sim_data = NULL;
+  simdata_host_t simdata = NULL;
   int i = 0;
 
   xbt_assert0((host != NULL), "Invalid parameters");
 
   /* Clean Simulator data */
-  sim_data = (host)->simdata;
+  simdata = (host)->simdata;
 
   for (i = 0; i < msg_global->max_channel; i++)
-    xbt_fifo_free(sim_data->mbox[i]);
-  xbt_free(sim_data->mbox);
-  xbt_free(sim_data->sleeping);
-  xbt_assert0((xbt_swag_size(&(sim_data->process_list))==0),
+    xbt_fifo_free(simdata->mbox[i]);
+  xbt_free(simdata->mbox);
+  xbt_free(simdata->sleeping);
+  xbt_assert0((xbt_fifo_size(simdata->process_list)==0),
              "Some process are still running on this host");
 
-  xbt_free(sim_data);
+  xbt_free(simdata);
 
   /* Clean host structure */
   xbt_free(host->name);
index 67fa10f..bc4a6db 100644 (file)
@@ -23,29 +23,28 @@ typedef enum {
   HOST_ALIVE = 1
 } m_host_state_t;
 
-typedef struct sim_data_host {
+typedef struct simdata_host {
   void *host;                  /* SURF modeling */
   xbt_fifo_t *mbox;            /* array of FIFOs used as a mailboxes  */
   m_process_t *sleeping;       /* array of process used to know whether a local process is
                                   waiting for a communication on a channel */
   m_host_state_t state;
-  s_xbt_swag_t process_list;
-} s_sim_data_host_t;
+  xbt_fifo_t process_list;
+} s_simdata_host_t;
 
 /********************************* Task **************************************/
 
-typedef struct sim_data_task {
+typedef struct simdata_task {
   surf_action_t compute;       /* SURF modeling of computation  */
   surf_action_t comm;          /* SURF modeling of communication  */
   double message_size;         /* Data size  */
   double computation_amount;   /* Computation size  */
   xbt_dynar_t sleeping;                /* process to wake-up */
-} s_sim_data_task_t;
+} s_simdata_task_t;
 
 /******************************* Process *************************************/
 
-typedef struct sim_data_process {
-  s_xbt_swag_hookup_t host_hookup; /* link to other process running on the same location */
+typedef struct simdata_process {
   m_host_t host;                /* the host on which the process is running */
   xbt_context_t context;               /* the context that executes the scheduler fonction */
   int PID;                     /* used for debugging purposes */
@@ -56,7 +55,7 @@ typedef struct sim_data_process {
   int argc;                     /* arguments number if any */
   char **argv;                  /* arguments table if any */
   MSG_error_t last_errno;       /* the last value returned by a MSG_function */
-} s_sim_data_process_t;
+} s_simdata_process_t;
 
 /************************** Global variables ********************************/
 typedef struct MSG_Global {
@@ -73,12 +72,12 @@ extern MSG_Global_t msg_global;
 
 /*************************************************************/
 
-#define PROCESS_SET_ERRNO(val) (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno=val)
-#define PROCESS_GET_ERRNO() (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno)
+#define PROCESS_SET_ERRNO(val) (((simdata_process_t)(MSG_process_self()->simdata))->last_errno=val)
+#define PROCESS_GET_ERRNO() (((simdata_process_t)(MSG_process_self()->simdata))->last_errno)
 #define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0)
 /* #define CHECK_ERRNO()  ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */
 
-#define CHECK_HOST()  ASSERT((((sim_data_host_t) MSG_host_self()->simdata)->state==HOST_ALIVE),"Host failed, you cannot call this function.")
+#define CHECK_HOST()  ASSERT((((simdata_host_t) MSG_host_self()->simdata)->state==HOST_ALIVE),"Host failed, you cannot call this function.")
 
 m_host_t __MSG_host_create(const char *name, void *workstation,
                           void *data);
index 67336ab..552c95a 100644 (file)
@@ -36,18 +36,18 @@ static char sprint_buffer[64];
 m_task_t MSG_task_create(const char *name, long double compute_duration,
                         long double message_size, void *data)
 {
-  sim_data_task_t sim_data = xbt_new0(s_sim_data_task_t,1);
+  simdata_task_t simdata = xbt_new0(s_simdata_task_t,1);
   m_task_t task = xbt_new0(s_m_task_t,1);
   
   /* Task structure */
   task->name = xbt_strdup(name);
-  task->simdata = sim_data;
+  task->simdata = simdata;
   task->data = data;
 
   /* Simulator Data */
-  sim_data->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
-  sim_data->computation_amount = compute_duration;
-  sim_data->message_size = message_size;
+  simdata->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
+  simdata->computation_amount = compute_duration;
+  simdata->message_size = message_size;
 
   return task;
 }
@@ -73,7 +73,7 @@ void *MSG_task_get_data(m_task_t task)
  */
 MSG_error_t MSG_task_destroy(m_task_t task)
 {
-  sim_data_task_t sim_data = NULL;
+  simdata_task_t simdata = NULL;
   surf_action_t action = NULL;
   int i;
 
@@ -99,26 +99,26 @@ MSG_error_t MSG_task_destroy(m_task_t task)
 
 /* static MSG_error_t __MSG_task_check(m_task_t task) */
 /* { */
-/*   sim_data_task_t sim_data = NULL; */
+/*   simdata_task_t simdata = NULL; */
 /*   int warning = 0; */
 
 /*   if (task == NULL) {               /\* Fatal *\/ */
 /*     WARNING("Task uninitialized"); */
 /*     return MSG_FATAL; */
 /*   } */
-/*   sim_data = task->simdata; */
+/*   simdata = task->simdata; */
 
-/*   if (sim_data == NULL) {   /\* Fatal *\/ */
+/*   if (simdata == NULL) {    /\* Fatal *\/ */
 /*     WARNING("Simulator Data uninitialized"); */
 /*     return MSG_FATAL; */
 /*   } */
 
-/*   if (sim_data->compute == NULL) {  /\* Fatal if execute ... *\/ */
+/*   if (simdata->compute == NULL) {   /\* Fatal if execute ... *\/ */
 /*     WARNING("No duration set for this task"); */
 /*     warning++; */
 /*   } */
 
-/*   if (sim_data->message_size == 0) {        /\* Fatal if transfered ... *\/ */
+/*   if (simdata->message_size == 0) { /\* Fatal if transfered ... *\/ */
 /*     WARNING("No message_size set for this task"); */
 /*     warning++; */
 /*   } */
@@ -136,13 +136,13 @@ MSG_error_t MSG_task_destroy(m_task_t task)
 /* static m_task_t __MSG_task_copy(m_task_t src) */
 /* { */
 /*   m_task_t copy = NULL; */
-/*   sim_data_task_t sim_data = NULL; */
+/*   simdata_task_t simdata = NULL; */
 
 /*   __MSG_task_check(src); */
 
-/*   sim_data = src->simdata; */
-/*   copy = MSG_task_create(src->name, SG_getTaskCost(sim_data->compute), */
-/*                      sim_data->message_size, MSG_task_get_data(src)); */
+/*   simdata = src->simdata; */
+/*   copy = MSG_task_create(src->name, SG_getTaskCost(simdata->compute), */
+/*                      simdata->message_size, MSG_task_get_data(src)); */
 
 /*   return (copy); */
 /* } */