static void _get_route_and_latency(const char *src, const char *dst,
xbt_dynar_t * links, double *latency)
{
- void *link;
- unsigned int cpt;
s_route_t route;
memset(&route,0,sizeof(route));
// // FIXME this path is never tested. I need examples to check the bypass mechanism...
// THROW_UNIMPLEMENTED; // let's warn the users of the problem
- xbt_dynar_foreach(e_route_bypass->link_list, cpt, link) {
- xbt_dynar_push(*links, &link);
- }
-
+ xbt_dynar_merge(links,&(e_route_bypass->link_list));
generic_free_route(e_route_bypass);
return;
}
if (strcmp(src, src_gateway))
_get_route_and_latency(src, src_gateway, links, latency);
- xbt_dynar_foreach(route.link_list, cpt, link) {
- xbt_dynar_push(*links, &link);
- }
+ xbt_dynar_merge(links,&(route.link_list));
/* If dest gateway is not our destination, we have to recursively find our way from this point */
// FIXME why can't I factorize it the same way than [src;src_gw] without breaking the examples??
if (strcmp(dst_gateway, dst)) {
- xbt_dynar_t route_dst = xbt_dynar_new(global_routing->size_of_link,NULL);
-
- _get_route_and_latency(dst_gateway, dst, &route_dst, latency);
-
- xbt_dynar_foreach(route_dst, cpt, link) {
- xbt_dynar_push(*links, &link);
- }
- xbt_dynar_free(&route_dst);
+ _get_route_and_latency(dst_gateway, dst, links, latency);
}
xbt_free(src_gateway);
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
//adding my one link routes
- unsigned int cpt;
- void *link;
xbt_dynar_t onelink_mine = rc->get_onelink_routes(rc);
- if (onelink_mine) {
- xbt_dynar_foreach(onelink_mine, cpt, link) {
- xbt_dynar_push(ret, &link);
- }
- }
+ if (onelink_mine)
+ xbt_dynar_merge(&ret,&onelink_mine);
+
//recursing
char *key;
xbt_dict_cursor_t cursor = NULL;
AS_t rc_child;
xbt_dict_foreach(rc->routing_sons, cursor, key, rc_child) {
xbt_dynar_t onelink_child = recursive_get_onelink_routes(rc_child);
- if (onelink_child) {
- xbt_dynar_foreach(onelink_child, cpt, link) {
- xbt_dynar_push(ret, &link);
- }
- }
+ if (onelink_child)
+ xbt_dynar_merge(&ret,&onelink_child);
}
return ret;
}
static void mount_free(void *p)
{
mount_t mnt = p;
- xbt_free(mnt->id);
xbt_free(mnt->name);
}
static void routing_parse_mount(sg_platf_mount_cbarg_t mount)
{
-
// Verification of an existing storage
void* storage = xbt_lib_get_or_null(storage_lib, mount->id,ROUTING_STORAGE_LEVEL);
xbt_assert(storage,"Disk id \"%s\" does not exists", mount->id);
XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->id, mount->name);
- mount_t mnt = xbt_new0(s_mount_t, 1);
- mnt->id = xbt_strdup(mount->id);
- mnt->name = xbt_strdup(mount->name);
+ s_mount_t mnt;
+ mnt.id = surf_storage_resource_by_name(mount->id);
+ mnt.name = xbt_strdup(mount->name);
if(!mount_list){
XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free);
}
xbt_dynar_push(mount_list,&mnt);
-
}
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)