Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cleaned doc, re-included examples, should be better now.
[simgrid.git] / examples / msg / chord / chord.c
index 40e941f..2014f2c 100644 (file)
@@ -39,7 +39,7 @@ static int periodic_lookup_delay = 10;
 
 extern long int smx_total_comms;
 
-/**
+/*
  * Finger element.
  */
 typedef struct s_finger {
@@ -47,7 +47,7 @@ typedef struct s_finger {
   char mailbox[MAILBOX_NAME_SIZE]; // string representation of the id
 } s_finger_t, *finger_t;
 
-/**
+/*
  * Node data.
  */
 typedef struct s_node {
@@ -74,7 +74,7 @@ typedef enum {
   TASK_PREDECESSOR_LEAVING
 } e_task_type_t;
 
-/**
+/*
  * Data attached with the tasks sent and received
  */
 typedef struct s_task_data {
@@ -101,7 +101,7 @@ static void set_predecessor(node_t node, int predecessor_id);
 
 // process functions
 static int node(int argc, char *argv[]);
-static void handle_task(node_t node, m_task_t task);
+static void handle_task(node_t node, msg_task_t task);
 
 // Chord core
 static void create(node_t node);
@@ -277,7 +277,7 @@ int node(int argc, char *argv[])
   }
 
   double init_time = MSG_get_clock();
-  m_task_t task_received = NULL;
+  msg_task_t task_received = NULL;
   int i;
   int join_success = 0;
   double deadline;
@@ -361,7 +361,7 @@ int node(int argc, char *argv[])
 
         // a transfer has occured
 
-        MSG_error_t status = MSG_comm_get_status(node.comm_receive);
+        msg_error_t status = MSG_comm_get_status(node.comm_receive);
 
         if (status != MSG_OK) {
           XBT_DEBUG("Failed to receive a task. Nevermind.");
@@ -397,7 +397,7 @@ int node(int argc, char *argv[])
  * \param task the task to handle (don't touch it then:
  * it will be destroyed, reused or forwarded)
  */
-static void handle_task(node_t node, m_task_t task) {
+static void handle_task(node_t node, msg_task_t task) {
 
   XBT_DEBUG("Handling task %p", task);
   char mailbox[MAILBOX_NAME_SIZE];
@@ -566,7 +566,7 @@ static void quit_notify(node_t node, int to)
           node->pred_id, to_mailbox);
     req_data->type = TASK_SUCCESSOR_LEAVING;
   }
-  m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+  msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
   //char* mailbox = get_mailbox(to_mailbox);
   msg_comm_t comm = MSG_task_isend(task, to_mailbox);
   xbt_dynar_push(node->comms, &comm);
@@ -611,9 +611,9 @@ static int remote_find_successor(node_t node, int ask_to, int id)
   req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
 
   // send a "Find Successor" request to ask_to_id
-  m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+  msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
   XBT_DEBUG("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id);
-  MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
+  msg_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
 
   if (res != MSG_OK) {
     XBT_DEBUG("Failed to send the 'Find Successor' request (task %p) to %d for id %d",
@@ -628,7 +628,7 @@ static int remote_find_successor(node_t node, int ask_to, int id)
 
     do {
       if (node->comm_receive == NULL) {
-        m_task_t task_received = NULL;
+        msg_task_t task_received = NULL;
         node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
       }
 
@@ -642,7 +642,7 @@ static int remote_find_successor(node_t node, int ask_to, int id)
         node->comm_receive = NULL;
       }
       else {
-        m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+        msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
         XBT_DEBUG("Received a task (%p)", task_received);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
@@ -693,8 +693,8 @@ static int remote_get_predecessor(node_t node, int ask_to)
 
   // send a "Get Predecessor" request to ask_to_id
   XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
-  m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
-  MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
+  msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+  msg_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
 
   if (res != MSG_OK) {
     XBT_DEBUG("Failed to send the 'Get Predecessor' request (task %p) to %d",
@@ -709,7 +709,7 @@ static int remote_get_predecessor(node_t node, int ask_to)
 
     do {
       if (node->comm_receive == NULL) { // FIXME simplify this
-        m_task_t task_received = NULL;
+        msg_task_t task_received = NULL;
         node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
       }
 
@@ -723,7 +723,7 @@ static int remote_get_predecessor(node_t node, int ask_to)
         node->comm_receive = NULL;
       }
       else {
-        m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+        msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
         if (MC_IS_ENABLED) {
@@ -830,7 +830,7 @@ static void remote_notify(node_t node, int notify_id, int predecessor_candidate_
   req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
 
   // send a "Notify" request to notify_id
-  m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+  msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
   XBT_DEBUG("Sending a 'Notify' request (task %p) to %d", task, notify_id);
   char mailbox[MAILBOX_NAME_SIZE];
   get_mailbox(notify_id, mailbox);
@@ -923,7 +923,7 @@ int main(int argc, char *argv[])
   MSG_function_register("node", node);
   MSG_launch_application(application_file);
 
-  MSG_error_t res = MSG_main();
+  msg_error_t res = MSG_main();
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());