Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
That pointer to function was never given anything but one value
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 16:57:02 +0000 (17:57 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 17:44:53 +0000 (18:44 +0100)
The global_routing value seem to be used to group functions together,
but the fields cannot be given another value.

Of course, I'm gonna kill em all.

src/instr/instr_interface.c
src/instr/instr_routing.c
src/surf/network.c
src/surf/network_im.c
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/surf_routing_dijkstra.c
src/surf/surf_routing_floyd.c
src/surf/workstation_ptask_L07.c
teshsuite/simdag/platforms/flatifier.c

index fabcf00..75090b8 100644 (file)
@@ -138,7 +138,7 @@ static void instr_user_srcdst_variable(double time,
                               double value,
                               InstrUserVariable what)
 {
                               double value,
                               InstrUserVariable what)
 {
-  xbt_dynar_t route = global_routing->get_route (src, dst);
+  xbt_dynar_t route = routing_get_route (src, dst);
   unsigned int i;
   void *link;
   xbt_dynar_foreach (route, i, link) {
   unsigned int i;
   void *link;
   xbt_dynar_foreach (route, i, link) {
index d41eca0..5164bfa 100644 (file)
@@ -412,7 +412,7 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
           (child2->kind == INSTR_HOST  || child2->kind == INSTR_ROUTER) &&
           strcmp (child1_name, child2_name) != 0){
 
           (child2->kind == INSTR_HOST  || child2->kind == INSTR_ROUTER) &&
           strcmp (child1_name, child2_name) != 0){
 
-        xbt_dynar_t route = global_routing->get_route (child1_name, child2_name);
+        xbt_dynar_t route = routing_get_route (child1_name, child2_name);
         if (TRACE_onelink_only()){
           if (xbt_dynar_length (route) > 1) continue;
         }
         if (TRACE_onelink_only()){
           if (xbt_dynar_length (route) > 1) continue;
         }
index 67213b5..6349d1c 100644 (file)
@@ -413,8 +413,7 @@ static void net_update_actions_state(double now, double delta)
     }
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
     }
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
-      xbt_dynar_t route = global_routing->get_route(action->src_name,
-                                                    action->dst_name);
+      xbt_dynar_t route = routing_get_route(action->src_name, action->dst_name);
       link_CM02_t link;
       unsigned int i;
       xbt_dynar_foreach(route, i, link) {
       link_CM02_t link;
       unsigned int i;
       xbt_dynar_foreach(route, i, link) {
@@ -590,7 +589,7 @@ static surf_action_t net_communicate(const char *src_name,
   global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0);
 
   if (sg_network_fullduplex == 1) {
   global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0);
 
   if (sg_network_fullduplex == 1) {
-    back_route = global_routing->get_route(dst_name, src_name);
+    back_route = routing_get_route(dst_name, src_name);
   }
 
   /* LARGE PLATFORMS HACK:
   }
 
   /* LARGE PLATFORMS HACK:
@@ -723,7 +722,7 @@ static surf_action_t net_communicate(const char *src_name,
 
 static xbt_dynar_t net_get_route(const char *src, const char *dst)
 {
 
 static xbt_dynar_t net_get_route(const char *src, const char *dst)
 {
-  return global_routing->get_route(src, dst);
+  return routing_get_route(src, dst);
 }
 
 static double net_get_link_bandwidth(const void *link)
 }
 
 static double net_get_link_bandwidth(const void *link)
index b15b936..7a8d6f4 100644 (file)
@@ -610,7 +610,7 @@ static surf_action_t im_net_communicate(const char *src_name,
 
 
   if (sg_network_fullduplex == 1) {
 
 
   if (sg_network_fullduplex == 1) {
-    back_route = global_routing->get_route(dst_name, src_name);
+    back_route = routing_get_route(dst_name, src_name);
   }
 
   /* LARGE PLATFORMS HACK:
   }
 
   /* LARGE PLATFORMS HACK:
@@ -747,7 +747,7 @@ static surf_action_t im_net_communicate(const char *src_name,
 
 static xbt_dynar_t im_net_get_route(const char *src, const char *dst)
 {
 
 static xbt_dynar_t im_net_get_route(const char *src, const char *dst)
 {
-  return global_routing->get_route(src, dst);
+  return routing_get_route(src, dst);
 }
 
 static double im_net_get_link_bandwidth(const void *link)
 }
 
 static double im_net_get_link_bandwidth(const void *link)
index 7c2e4ca..2963ec9 100644 (file)
@@ -169,7 +169,6 @@ struct s_routing_global {
   AS_t root;
   void *loopback;
   size_t size_of_link;
   AS_t root;
   void *loopback;
   size_t size_of_link;
-  xbt_dynar_t(*get_route) (const char *src, const char *dst);
   xbt_dynar_t(*get_route_or_null) (const char *src, const char *dst);
   xbt_dynar_t(*get_route_no_cleanup) (const char *src, const char *dst);
   xbt_dynar_t(*get_onelink_routes) (void);
   xbt_dynar_t(*get_route_or_null) (const char *src, const char *dst);
   xbt_dynar_t(*get_route_no_cleanup) (const char *src, const char *dst);
   xbt_dynar_t(*get_onelink_routes) (void);
@@ -184,6 +183,8 @@ XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback);
 XBT_PUBLIC(void) routing_exit(void);
 XBT_PUBLIC(void) routing_register_callbacks(void);
 
 XBT_PUBLIC(void) routing_exit(void);
 XBT_PUBLIC(void) routing_register_callbacks(void);
 
+XBT_PUBLIC(xbt_dynar_t) routing_get_route(const char *src, const char *dst);
+
 /**
  * Resource protected methods
  */
 /**
  * Resource protected methods
  */
index 0f469d5..cef2832 100644 (file)
@@ -605,7 +605,7 @@ static void get_route_latency(const char *src, const char *dst,
 }
 
 /**
 }
 
 /**
- * \brief Generic method: find a route between hosts
+ * \brief Find a route between hosts
  *
  * \param src the source host name 
  * \param dst the destination host name
  *
  * \param src the source host name 
  * \param dst the destination host name
@@ -614,8 +614,7 @@ static void get_route_latency(const char *src, const char *dst,
  * by calling the differents "get_route" functions in each routing component.
  * No need to free the returned dynar. It will be freed at the next call.
  */
  * by calling the differents "get_route" functions in each routing component.
  * No need to free the returned dynar. It will be freed at the next call.
  */
-static xbt_dynar_t get_route(const char *src, const char *dst)
-{
+xbt_dynar_t routing_get_route(const char *src, const char *dst) {
   xbt_dynar_t route = NULL;
   get_route_latency(src, dst, &route, NULL, 1);
   return route;
   xbt_dynar_t route = NULL;
   get_route_latency(src, dst, &route, NULL, 1);
   return route;
@@ -724,7 +723,6 @@ void routing_model_create(size_t size_of_links, void *loopback)
   /* config the uniq global routing */
   global_routing = xbt_new0(s_routing_global_t, 1);
   global_routing->root = NULL;
   /* config the uniq global routing */
   global_routing = xbt_new0(s_routing_global_t, 1);
   global_routing->root = NULL;
-  global_routing->get_route = get_route;
   global_routing->get_route_or_null = get_route_or_null;
   global_routing->get_latency = get_latency;
   global_routing->get_route_no_cleanup = get_route_no_cleanup;
   global_routing->get_route_or_null = get_route_or_null;
   global_routing->get_latency = get_latency;
   global_routing->get_route_no_cleanup = get_route_no_cleanup;
index 442c965..68ea411 100644 (file)
@@ -374,7 +374,7 @@ static route_extended_t dijkstra_get_route(AS_t asg,
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
-          (*(global_routing->get_route)) (gw_dst, prev_gw_src);
+          routing_get_route(gw_dst, prev_gw_src);
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
index 211cf92..c29b209 100644 (file)
@@ -116,7 +116,7 @@ static route_extended_t floyd_get_route(AS_t asg,
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
-          (*(global_routing->get_route)) (gw_dst, prev_gw_src);
+          routing_get_route(gw_dst, prev_gw_src);
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
index 5d94ad5..c558a2e 100644 (file)
@@ -82,7 +82,7 @@ static void ptask_update_action_bound(surf_action_workstation_L07_t action)
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       xbt_dynar_t route =
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       xbt_dynar_t route =
-          global_routing->get_route(surf_resource_name
+          routing_get_route(surf_resource_name
                                     (action->workstation_list[i]),
                                     surf_resource_name(action->
                                                        workstation_list
                                     (action->workstation_list[i]),
                                     surf_resource_name(action->
                                                        workstation_list
@@ -463,7 +463,7 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb,
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
       xbt_dynar_t route =
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
       xbt_dynar_t route =
-          global_routing->get_route(surf_resource_name
+          routing_get_route(surf_resource_name
                                     (workstation_list[i]),
                                     surf_resource_name(workstation_list
                                                        [j]));
                                     (workstation_list[i]),
                                     surf_resource_name(workstation_list
                                                        [j]));
@@ -517,7 +517,7 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb,
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
       xbt_dynar_t route =
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
       xbt_dynar_t route =
-          global_routing->get_route(surf_resource_name
+          routing_get_route(surf_resource_name
                                     (workstation_list[i]),
                                     surf_resource_name(workstation_list
                                                        [j]));
                                     (workstation_list[i]),
                                     surf_resource_name(workstation_list
                                                        [j]));
@@ -589,9 +589,9 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration)
   return (surf_action_t) action;
 }
 
   return (surf_action_t) action;
 }
 
-static xbt_dynar_t ptask_get_route(void *src, void *dst)
+static xbt_dynar_t ptask_get_route(void *src, void *dst) // FIXME: kill that callback kind?
 {
 {
-  return global_routing->get_route(surf_resource_name(src),
+  return routing_get_route(surf_resource_name(src),
                                    surf_resource_name(dst));
 }
 
                                    surf_resource_name(dst));
 }
 
index e7321c9..59f1ffe 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = global_routing->get_route(src,dst);
+                               xbt_dynar_t route = routing_get_route(src,dst);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = global_routing->get_route(src,dst);
+                               xbt_dynar_t route = routing_get_route(src,dst);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -176,7 +176,7 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = global_routing->get_route(src,dst);
+                               xbt_dynar_t route = routing_get_route(src,dst);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = global_routing->get_route(src,dst);
+                               xbt_dynar_t route = routing_get_route(src,dst);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);