X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f61360c08e9c687b08b57ad2c42bc54f0708e3d8..a4fd78fffedc66dc0e6cf7b8978f1741c2e3d22e:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index ac8f058eca..6ce1552706 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -95,7 +95,7 @@ struct s_model_type routing_models[] = { {"DijkstraCache", "Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only)", model_dijkstracache_create, model_dijkstra_both_end}, - {"none", "No routing (usable with Constant network only)", + {"none", "No routing (Unless you know what you are doing, avoid using this mode in combination with a non Constant network model).", model_none_create, NULL}, {"RuleBased", "Rule-Based routing data (...)", model_rulebased_create, NULL}, @@ -293,17 +293,20 @@ static void routing_parse_E_ASroute(void) route_t e_route = xbt_new0(s_route_t, 1); e_route->link_list = parsed_link_list; - if(!strcmp(current_routing->model_desc->name,"RuleBased")) { + if (!strcmp(current_routing->model_desc->name,"RuleBased")) { e_route->src_gateway = (network_element_t) gw_src; // DIRTY HACK possible only e_route->dst_gateway = (network_element_t) gw_dst; // because of what is in routing_parse_E_ASroute - } - else{ - e_route->src_gateway = ((network_element_t)xbt_lib_get_or_null(as_router_lib,gw_src,ROUTING_ASR_LEVEL)); - if(!e_route->src_gateway) - e_route->src_gateway = ((network_element_t)xbt_lib_get_or_null(host_lib,gw_src,ROUTING_HOST_LEVEL)); - e_route->dst_gateway = ((network_element_t)xbt_lib_get_or_null(as_router_lib,gw_dst,ROUTING_ASR_LEVEL)); - if(!e_route->dst_gateway) - e_route->dst_gateway = ((network_element_t)xbt_lib_get_or_null(host_lib,gw_dst,ROUTING_HOST_LEVEL)); + } else { + e_route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src, + ROUTING_ASR_LEVEL); + if (!e_route->src_gateway) + e_route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src, + ROUTING_HOST_LEVEL); + e_route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst, + ROUTING_ASR_LEVEL); + if (!e_route->dst_gateway) + e_route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst, + ROUTING_HOST_LEVEL); } xbt_assert(current_routing->parse_ASroute, "no defined method \"set_ASroute\" in \"%s\"", @@ -324,12 +327,16 @@ static void routing_parse_E_bypassRoute(void) { route_t e_route = xbt_new0(s_route_t, 1); e_route->link_list = parsed_link_list; - e_route->src_gateway = ((network_element_t)xbt_lib_get_or_null(as_router_lib,gw_src,ROUTING_ASR_LEVEL)); - if(!e_route->src_gateway) - e_route->src_gateway = ((network_element_t)xbt_lib_get_or_null(host_lib,gw_src,ROUTING_HOST_LEVEL)); - e_route->dst_gateway = ((network_element_t)xbt_lib_get_or_null(as_router_lib,gw_dst,ROUTING_ASR_LEVEL)); - if(!e_route->dst_gateway) - e_route->dst_gateway = ((network_element_t)xbt_lib_get_or_null(host_lib,gw_dst,ROUTING_HOST_LEVEL)); + e_route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src, + ROUTING_ASR_LEVEL); + if (!e_route->src_gateway) + e_route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src, + ROUTING_HOST_LEVEL); + e_route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst, + ROUTING_ASR_LEVEL); + if (!e_route->dst_gateway) + e_route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst, + ROUTING_HOST_LEVEL); xbt_assert(current_routing->parse_bypassroute, "Bypassing mechanism not implemented by routing '%s'", current_routing->name); @@ -482,8 +489,10 @@ static void elements_father(network_element_t src, network_element_t dst, network_element_t dst_data = dst; src_as = src_data->rc_component; dst_as = dst_data->rc_component; +#ifndef NDEBUG char* src_name = src_data->name; char* dst_name = dst_data->name; +#endif xbt_assert(src_as && dst_as, "Ask for route \"from\"(%s) or \"to\"(%s) no found", src_name, dst_name); @@ -617,7 +626,8 @@ static void _get_route_and_latency(network_element_t src, network_element_t dst, * walk through the routing components tree and find a route between hosts * by calling the differents "get_route" functions in each routing component. */ -void routing_get_route_and_latency(network_element_t src, network_element_t dst, +void routing_get_route_and_latency(network_element_t src, + network_element_t dst, xbt_dynar_t * route, double *latency) { if (!*route) { @@ -743,7 +753,9 @@ static void routing_parse_storage(sg_platf_storage_cbarg_t storage) "Reading a storage, processing unit \"%s\" already exists", storage->id); // Verification of an existing type_id +#ifndef NDEBUG void* storage_type = xbt_lib_get_or_null(storage_type_lib, storage->type_id,ROUTING_STORAGE_TYPE_LEVEL); +#endif xbt_assert(storage_type,"Reading a storage, type id \"%s\" does not exists", storage->type_id); XBT_DEBUG("ROUTING Create a storage name '%s' with type_id '%s'", @@ -756,15 +768,6 @@ static void routing_parse_storage(sg_platf_storage_cbarg_t storage) (void *) xbt_strdup(storage->type_id)); } -typedef struct s_content { - char *user_rights; - char *user; - char *group; - char *date; - char *time; - int size; -} s_content_t, *content_t; - static void free_storage_content(void *p) { content_t content = p; @@ -813,7 +816,7 @@ static xbt_dict_t parse_storage_content(const char *filename) xbt_dict_set(parse_content,path,content,NULL); } else { xbt_die("Be sure of passing a good format for content file.\n"); - // You can generate tjis kind of file with command line: + // You can generate this kind of file with command line: // find /path/you/want -type f -exec ls -l {} \; 2>/dev/null > ./content.txt } } @@ -835,7 +838,7 @@ static void routing_parse_storage_type(sg_platf_storage_type_cbarg_t storage_typ stype->content = parse_storage_content(storage_type->content); stype->type_id = xbt_strdup(storage_type->id); - XBT_INFO("ROUTING Create a storage type id '%s' with model '%s' content '%s' and properties '%p'", + XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s' content '%s' and properties '%p'", stype->type_id, stype->model, storage_type->content, @@ -873,7 +876,9 @@ static void mount_free(void *p) static void routing_parse_mount(sg_platf_mount_cbarg_t mount) { // Verification of an existing storage +#ifndef NDEBUG void* storage = xbt_lib_get_or_null(storage_lib, mount->id,ROUTING_STORAGE_LEVEL); +#endif xbt_assert(storage,"Disk id \"%s\" does not exists", mount->id); XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->id, mount->name);