From: Martin Quinson Date: Sun, 27 Dec 2015 20:05:21 +0000 (+0100) Subject: code simplification: directly give the host name to SD_workstation_create X-Git-Tag: v3_13~1382 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cbedb536b5462febbf3ccff143ce5e298a983b87?hp=94f91fddf6aa49b80b881571a2575f1ab3c67755 code simplification: directly give the host name to SD_workstation_create --- diff --git a/src/simdag/private.h b/src/simdag/private.h index 906a85b07e..0a3bc8c1c1 100644 --- a/src/simdag/private.h +++ b/src/simdag/private.h @@ -121,8 +121,7 @@ typedef struct SD_dependency { XBT_PUBLIC(xbt_swag_t) SD_simulate_swag(double how_long); /* could be public, but you need to see the internals of the SD_task_t to use it */ -XBT_PRIVATE SD_workstation_t __SD_workstation_create(void *surf_workstation, - void *data); +XBT_PRIVATE SD_workstation_t __SD_workstation_create(const char* name); XBT_PRIVATE void __SD_workstation_destroy(void *workstation); XBT_PRIVATE int __SD_workstation_is_busy(SD_workstation_t workstation); diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index b625857f8b..5c5539805a 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -211,9 +211,7 @@ void SD_create_environment(const char *platform_file) xbt_dict_cursor_t cursor = NULL; simgrid_Host* host = NULL; xbt_dict_foreach(host_list, cursor, name, host){ - surf_Host* surf_host = (surf_Host*) surf_host_resource_priv(host); - if (surf_host != NULL) - __SD_workstation_create(surf_host, NULL); + __SD_workstation_create((const char*)name); } } diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 8162d2efbb..7a4a17cecf 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -17,22 +17,18 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_workstation, sd, /* Creates a workstation and registers it in SD. */ -SD_workstation_t __SD_workstation_create(void *surf_workstation, - void *data) +SD_workstation_t __SD_workstation_create(const char *name) { SD_workstation_priv_t workstation; - const char *name; workstation = xbt_new(s_SD_workstation_priv_t, 1); workstation->access_mode = SD_WORKSTATION_SHARED_ACCESS; /* default mode is shared */ workstation->task_fifo = NULL; workstation->current_task = NULL; - name = surf_resource_name(surf_workstation); sg_host_t sg_host = sg_host_by_name(name); sg_host_sd_set(sg_host,workstation); - sg_host_user_set(sg_host,data); return sg_host; }