From: Martin Quinson Date: Mon, 9 Apr 2012 18:44:47 +0000 (-1000) Subject: [routing] rename routing_global_t -> routing_platf_t (and friends) X-Git-Tag: v3_7~68 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/346c06db41ebb088e88351d8381d0c232d2ddbb5?ds=sidebyside [routing] rename routing_global_t -> routing_platf_t (and friends) One day maybe, this could be usefull to enable the declaration (and simulation) of several platform within one simgrid run. But for now, I mainly want to make the sg/platf interface less context sensitive and more usual by expressing directly the AS to which elements are added. --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index d5d2114bce..0d6cd04a1c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -147,8 +147,8 @@ typedef struct surf_action_state { /***************************/ /* Generic model object */ /***************************/ -typedef struct s_routing_global s_routing_global_t, *routing_global_t; -XBT_PUBLIC_DATA(routing_global_t) global_routing; +typedef struct s_routing_platf s_routing_platf_t, *routing_platf_t; +XBT_PUBLIC_DATA(routing_platf_t) routing_platf; /** \ingroup SURF_models diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index c00078e2ab..d2c91ee8bb 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -329,7 +329,7 @@ static void instr_routing_parse_end_platform () xbt_dynar_free(¤tContainer); currentContainer = NULL; xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free); - recursiveGraphExtraction (global_routing->root, PJ_container_get_root(), filter); + recursiveGraphExtraction (routing_platf->root, PJ_container_get_root(), filter); xbt_dict_free(&filter); platform_created = 1; TRACE_paje_dump_buffer(1); @@ -514,7 +514,7 @@ xbt_graph_t instr_routing_platform_graph (void) xbt_graph_t ret = xbt_graph_new_graph (0, NULL); xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL); xbt_dict_t edges = xbt_dict_new_homogeneous(NULL); - recursiveXBTGraphExtraction (ret, nodes, edges, global_routing->root, PJ_container_get_root()); + recursiveXBTGraphExtraction (ret, nodes, edges, routing_platf->root, PJ_container_get_root()); xbt_dict_free (&nodes); xbt_dict_free (&edges); return ret; diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index 0ff71c75ff..7193b0df57 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -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; @@ -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; diff --git a/src/surf/network_ns3.c b/src/surf/network_ns3.c index 6741f6f253..5083d948ba 100644 --- a/src/surf/network_ns3.c +++ b/src/surf/network_ns3.c @@ -18,7 +18,7 @@ extern xbt_lib_t as_router_lib; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_ns3, surf, "Logging specific to the SURF network NS3 module"); -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; extern xbt_dict_t dict_socket; static double time_to_next_flow_completion = -1; @@ -253,7 +253,7 @@ static void create_ns3_topology(void) xbt_dynar_shrink(IPV4addr,0); //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) xbt_die("There is no routes!"); XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used); diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 6e10c38dfc..f115c1256d 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -175,7 +175,7 @@ typedef struct s_as { const char *dst, route_t e_route); } s_as_t; -struct s_routing_global { +struct s_routing_platf { AS_t root; void *loopback; xbt_dynar_t last_route; diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index cf601596c7..53a5d6223e 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -54,7 +54,7 @@ sg_routing_edge_t sg_routing_edge_by_name_or_null(const char *name) { } /* Global vars */ -routing_global_t global_routing = NULL; +routing_platf_t routing_platf = NULL; AS_t current_routing = NULL; /* global parse functions */ @@ -406,13 +406,13 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type) sg_routing_edge_t info = NULL; info = xbt_new0(s_network_element_t, 1); - if (current_routing == NULL && global_routing->root == NULL) { + if (current_routing == NULL && routing_platf->root == NULL) { /* it is the first one */ new_as->routing_father = NULL; - global_routing->root = new_as; + routing_platf->root = new_as; info->id = -1; - } else if (current_routing != NULL && global_routing->root != NULL) { + } else if (current_routing != NULL && routing_platf->root != NULL) { xbt_assert(!xbt_dict_get_or_null (current_routing->routing_sons, AS_id), @@ -639,8 +639,8 @@ void routing_get_route_and_latency(sg_routing_edge_t src, { XBT_DEBUG("routing_get_route_and_latency from %s to %s",src->name,dst->name); if (!*route) { - xbt_dynar_reset(global_routing->last_route); - *route = global_routing->last_route; + xbt_dynar_reset(routing_platf->last_route); + *route = routing_platf->last_route; } _get_route_and_latency(src, dst, route, latency); @@ -672,7 +672,7 @@ static xbt_dynar_t recursive_get_onelink_routes(AS_t rc) static xbt_dynar_t get_onelink_routes(void) { - return recursive_get_onelink_routes(global_routing->root); + return recursive_get_onelink_routes(routing_platf->root); } e_surf_network_element_type_t routing_get_network_element_type(const char *name) @@ -692,11 +692,11 @@ e_surf_network_element_type_t routing_get_network_element_type(const char *name) void routing_model_create( void *loopback) { /* config the uniq global routing */ - global_routing = xbt_new0(s_routing_global_t, 1); - global_routing->root = NULL; - global_routing->get_onelink_routes = get_onelink_routes; - global_routing->loopback = loopback; - global_routing->last_route = xbt_dynar_new(sizeof(sg_routing_link_t),NULL); + routing_platf = xbt_new0(s_routing_platf_t, 1); + routing_platf->root = NULL; + routing_platf->get_onelink_routes = get_onelink_routes; + routing_platf->loopback = loopback; + routing_platf->last_route = xbt_dynar_new(sizeof(sg_routing_link_t),NULL); /* no current routing at moment */ current_routing = NULL; } @@ -1203,9 +1203,9 @@ static void finalize_rec(AS_t as) { /** \brief Frees all memory allocated by the routing module */ void routing_exit(void) { - if (!global_routing) + if (!routing_platf) return; - xbt_dynar_free(&global_routing->last_route); - finalize_rec(global_routing->root); - xbt_free(global_routing); + xbt_dynar_free(&routing_platf->last_route); + finalize_rec(routing_platf->root); + xbt_free(routing_platf); } diff --git a/src/surf/surf_routing_dijkstra.c b/src/surf/surf_routing_dijkstra.c index 4ae034e1e1..27c04b8479 100644 --- a/src/surf/surf_routing_dijkstra.c +++ b/src/surf/surf_routing_dijkstra.c @@ -7,7 +7,7 @@ #include "surf_routing_private.h" /* Global vars */ -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic"); @@ -159,7 +159,7 @@ static void add_loopback_dijkstra(as_dijkstra_t as) { route_t e_route = xbt_new0(s_route_t, 1); e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); xbt_dynar_push(e_route->link_list, - &global_routing->loopback); + &routing_platf->loopback); xbt_graph_new_edge(as->route_graph, node, node, e_route); } } @@ -456,7 +456,7 @@ void model_dijkstra_both_end(AS_t as) THIS_AS->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free); /* Add the loopback if needed */ - if (global_routing->loopback && as->hierarchy == SURF_ROUTING_BASE) + if (routing_platf->loopback && as->hierarchy == SURF_ROUTING_BASE) add_loopback_dijkstra(THIS_AS); /* initialize graph indexes in nodes after graph has been built */ diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index 92020e8bba..4207401113 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -7,7 +7,7 @@ #include "surf_routing_private.h" /* Global vars */ -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf"); @@ -207,7 +207,7 @@ void model_floyd_end(AS_t current_routing) } /* Add the loopback if needed */ - if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) { + if (routing_platf->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) { for (i = 0; i < table_size; i++) { route_t e_route = TO_FLOYD_LINK(i, i); if (!e_route) { @@ -215,7 +215,7 @@ void model_floyd_end(AS_t current_routing) e_route->src_gateway = NULL; e_route->dst_gateway = NULL; e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); - xbt_dynar_push(e_route->link_list, &global_routing->loopback); + xbt_dynar_push(e_route->link_list, &routing_platf->loopback); TO_FLOYD_LINK(i, i) = e_route; TO_FLOYD_PRED(i, i) = i; TO_FLOYD_COST(i, i) = 1; diff --git a/src/surf/surf_routing_full.c b/src/surf/surf_routing_full.c index 776d2edcce..ab14bf6b0f 100644 --- a/src/surf/surf_routing_full.c +++ b/src/surf/surf_routing_full.c @@ -7,7 +7,7 @@ #include "surf_routing_private.h" /* Global vars */ -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; extern int surf_parse_lineno; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf"); @@ -136,7 +136,7 @@ void model_full_end(AS_t current_routing) routing->routing_table = xbt_new0(route_t, table_size * table_size); /* Add the loopback if needed */ - if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) { + if (routing_platf->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) { for (i = 0; i < table_size; i++) { e_route = TO_ROUTE_FULL(i, i); if (!e_route) { @@ -144,7 +144,7 @@ void model_full_end(AS_t current_routing) e_route->src_gateway = NULL; e_route->dst_gateway = NULL; e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); - xbt_dynar_push(e_route->link_list, &global_routing->loopback); + xbt_dynar_push(e_route->link_list, &routing_platf->loopback); TO_ROUTE_FULL(i, i) = e_route; } } diff --git a/src/surf/surf_routing_rulebased.c b/src/surf/surf_routing_rulebased.c index c2230321c9..ca03d309fa 100644 --- a/src/surf/surf_routing_rulebased.c +++ b/src/surf/surf_routing_rulebased.c @@ -7,7 +7,7 @@ #include /* regular expression library */ /* Global vars */ -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of surf"); @@ -340,9 +340,9 @@ static void rulebased_get_route_and_latency(AS_t rc, if (rc_src >= 0 && rc_dst >= 0) { /* matched src and dest, nothing more to do (?) */ } else if (!strcmp(src_name, dst_name) && are_processing_units) { - xbt_dynar_push(route->link_list, &(global_routing->loopback)); + xbt_dynar_push(route->link_list, &(routing_platf->loopback)); if (lat) - *lat += surf_network_model->extension.network.get_link_latency(global_routing->loopback); + *lat += surf_network_model->extension.network.get_link_latency(routing_platf->loopback); } else { THROWF(arg_error,0,"No route from '%s' to '%s'??",src_name,dst_name); //xbt_dynar_reset(route->link_list); diff --git a/teshsuite/simdag/platforms/Evaluate_get_route_time.c b/teshsuite/simdag/platforms/Evaluate_get_route_time.c index 0994999f34..6c4fda905a 100644 --- a/teshsuite/simdag/platforms/Evaluate_get_route_time.c +++ b/teshsuite/simdag/platforms/Evaluate_get_route_time.c @@ -14,7 +14,7 @@ #include "xbt/xbt_os_time.h" #define BILLION 1000000000L; -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; int main(int argc, char **argv) { diff --git a/teshsuite/simdag/platforms/Evaluate_parse_time.c b/teshsuite/simdag/platforms/Evaluate_parse_time.c index 42f2f6236d..9b822dd4db 100644 --- a/teshsuite/simdag/platforms/Evaluate_parse_time.c +++ b/teshsuite/simdag/platforms/Evaluate_parse_time.c @@ -12,7 +12,7 @@ #include "surf/surf_private.h" #include "xbt/xbt_os_time.h" -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; int main(int argc, char **argv) { diff --git a/teshsuite/simdag/platforms/basic_parsing_test.c b/teshsuite/simdag/platforms/basic_parsing_test.c index 2d841f36c5..2f58cb5e00 100644 --- a/teshsuite/simdag/platforms/basic_parsing_test.c +++ b/teshsuite/simdag/platforms/basic_parsing_test.c @@ -9,7 +9,7 @@ #include "simdag/simdag.h" #include "surf/surf_private.h" -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; int main(int argc, char **argv) { diff --git a/teshsuite/simdag/platforms/is_router_test.c b/teshsuite/simdag/platforms/is_router_test.c index d9dcd421ae..d6bf9b1056 100644 --- a/teshsuite/simdag/platforms/is_router_test.c +++ b/teshsuite/simdag/platforms/is_router_test.c @@ -9,7 +9,7 @@ #include "simdag/simdag.h" #include "surf/surf_private.h" -extern routing_global_t global_routing; +extern routing_platf_t routing_platf; int main(int argc, char **argv) {