Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use xbt_malloc (and friends) instead of direct malloc()
[simgrid.git] / src / surf / network_gtnets.c
index 99590b7..8207982 100644 (file)
@@ -14,7 +14,7 @@ static double time_to_next_flow_completion = -1;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
                                 "Logging specific to the SURF network GTNetS module");
 
-extern routing_global_t global_routing;
+extern routing_platf_t routing_platf;
 
 double sg_gtnets_jitter = 0.0;
 int sg_gtnets_jitter_seed = 10;
@@ -43,7 +43,7 @@ static void link_new(const char *name, double bw, double lat, xbt_dict_t props)
            link_count, name, lat, bw);
 
   if (gtnets_add_link(link_count, bw, lat)) {
-         xbt_die("Cannot create GTNetS link");
+    xbt_die("Cannot create GTNetS link");
   }
   gtnets_link->id = link_count;
 
@@ -62,7 +62,7 @@ static void route_new(int src_id, int dst_id, xbt_dynar_t links,
           src_id, dst_id, links, nb_link);
 
   /* Build the list of gtnets link IDs */
-  gtnets_links = (int *) calloc(nb_link, sizeof(int));
+  gtnets_links = xbt_new0(int, nb_link);
   i = 0;
   xbt_dynar_foreach(links, cursor, link) {
     gtnets_links[i++] = link->id;
@@ -97,8 +97,8 @@ static void parse_link_init(sg_platf_link_cbarg_t link)
 
   if (link->policy == SURF_LINK_FULLDUPLEX)
   {
-         link_new(bprintf("%s_UP",link->id), link->bandwidth, link->latency, current_property_set);
-         link_new(bprintf("%s_DOWN",link->id), link->bandwidth, link->latency, current_property_set);
+    link_new(bprintf("%s_UP",link->id), link->bandwidth, link->latency, current_property_set);
+    link_new(bprintf("%s_DOWN",link->id), link->bandwidth, link->latency, current_property_set);
 
   }
   else  link_new(link->id, link->bandwidth, link->latency, current_property_set);
@@ -113,7 +113,7 @@ static void create_gtnets_topology(void)
 //   and then you can use the id to reimplement properly the following GTNets calls
 
    //get the onelinks from the parsed platform
-   xbt_dynar_t onelink_routes = global_routing->get_onelink_routes();
+   xbt_dynar_t onelink_routes = routing_platf->get_onelink_routes();
    if (!onelink_routes)
      return;
 
@@ -132,7 +132,7 @@ static void create_gtnets_topology(void)
          onelink->dst->id);
      XBT_DEBUG("Calling one link route");
         if(onelink->src->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
-               gtnets_add_router(onelink->src->id);
+          gtnets_add_router(onelink->src->id);
         }
         if(onelink->dst->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
          gtnets_add_router(onelink->dst->id);
@@ -333,8 +333,8 @@ static void update_resource_state(void *id,
 }
 
 /* Max durations are not supported */
-static surf_action_t communicate(network_element_t src_card,
-                                 network_element_t dst_card,
+static surf_action_t communicate(sg_routing_edge_t src_card,
+                                 sg_routing_edge_t dst_card,
                                  double size, double rate)
 {
   surf_action_network_GTNETS_t action = NULL;
@@ -438,7 +438,7 @@ static void surf_network_model_init_internal(void)
     xbt_die("Impossible to initialize GTNetS interface");
   }
 
-  routing_model_create(sizeof(network_link_GTNETS_t), NULL);
+  routing_model_create(NULL);
 }
 
 #ifdef HAVE_LATENCY_BOUND_TRACKING