From 1aeee3ce2981cd8db039d6be8f5b86e88eabb704 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 28 Jan 2016 09:23:18 +0100 Subject: [PATCH] this tentative of storage layer in SD was a bad idea. SimDag is on top of SURF, the existing functions might be enough. Exposing storage in the Simdag world still has to be defined properly --- include/surf/surf_routing.h | 1 - src/simdag/sd_global.cpp | 13 ------------ src/simdag/sd_workstation.cpp | 38 ----------------------------------- src/simdag/simdag_private.h | 15 -------------- src/surf/surf_routing.cpp | 1 - 5 files changed, 68 deletions(-) diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h index bbc3fec3a9..67434ae578 100644 --- a/include/surf/surf_routing.h +++ b/include/surf/surf_routing.h @@ -14,7 +14,6 @@ SG_BEGIN_DECL() XBT_PUBLIC_DATA(xbt_dict_t) host_list; XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL; //Simix storage level -XBT_PUBLIC_DATA(int) SD_STORAGE_LEVEL; //Simdag storage level XBT_PUBLIC_DATA(int) COORD_HOST_LEVEL; //Coordinates level XBT_PUBLIC_DATA(xbt_lib_t) as_router_lib; diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 3f6851efaf..697cc136a5 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -72,9 +72,6 @@ void SD_init(int *argc, char **argv) jedule_sd_init(); #endif - XBT_DEBUG("ADD SD LEVELS"); - SD_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,__SD_storage_destroy); - if (_sg_cfg_exit_asap) { SD_exit(); exit(0); @@ -161,18 +158,8 @@ void SD_application_reinit(void) */ void SD_create_environment(const char *platform_file) { - xbt_lib_cursor_t cursor = NULL; - char *name = NULL; - void **surf_storage = NULL; - parse_platform_file(platform_file); - /* now let's create the SD wrappers for storage elements */ - xbt_lib_foreach(storage_lib, cursor, name, surf_storage) { - if(surf_storage[SURF_STORAGE_LEVEL]) - __SD_storage_create(surf_storage[SURF_STORAGE_LEVEL], NULL); - } - XBT_DEBUG("Workstation number: %zu, link number: %d", sg_host_count(), sg_link_count()); #ifdef HAVE_JEDULE diff --git a/src/simdag/sd_workstation.cpp b/src/simdag/sd_workstation.cpp index 83343296ba..8f9cef43b7 100644 --- a/src/simdag/sd_workstation.cpp +++ b/src/simdag/sd_workstation.cpp @@ -14,32 +14,6 @@ #include "xbt/sysdep.h" #include "surf/surf.h" -/* Creates a storage and registers it in SD. - */ -SD_storage_t __SD_storage_create(void *surf_storage, void *data) -{ - - SD_storage_priv_t storage; - const char *name; - - storage = xbt_new(s_SD_storage_priv_t, 1); - storage->data = data; /* user data */ - name = surf_resource_name((surf_cpp_resource_t)surf_storage); - storage->host = (const char*)surf_storage_get_host( (surf_resource_t )surf_storage_resource_by_name(name)); - xbt_lib_set(storage_lib,name, SD_STORAGE_LEVEL, storage); - return xbt_lib_get_elm_or_null(storage_lib, name); -} - -/* Destroys a storage. - */ -void __SD_storage_destroy(void *storage) -{ - SD_storage_priv_t s; - - s = (SD_storage_priv_t) storage; - xbt_free(s); -} - /** @brief Returns the route between two workstations * * Use SD_route_get_size() to know the array size. @@ -128,15 +102,3 @@ double SD_route_get_bandwidth(sg_host_t src, sg_host_t dst) return min_bandwidth; } - - -/** - * \brief Returns the host name the storage is attached to - * - * This functions checks whether a storage is a valid pointer or not and return its name. - */ -const char *SD_storage_get_host(msg_storage_t storage) { - xbt_assert((storage != NULL), "Invalid parameters"); - SD_storage_priv_t priv = SD_storage_priv(storage); - return priv->host; -} diff --git a/src/simdag/simdag_private.h b/src/simdag/simdag_private.h index 7b81a5f175..4a1bdff10b 100644 --- a/src/simdag/simdag_private.h +++ b/src/simdag/simdag_private.h @@ -35,17 +35,6 @@ typedef struct SD_global { extern XBT_PRIVATE SD_global_t sd_global; -/* Storage */ -typedef s_xbt_dictelm_t s_SD_storage_t; -typedef struct SD_storage { - void *data; /* user data */ - const char *host; -} s_SD_storage_priv_t, *SD_storage_priv_t; - -static inline SD_storage_priv_t SD_storage_priv(SD_storage_t storage){ - return (SD_storage_priv_t)xbt_lib_get_level(storage, SD_STORAGE_LEVEL); -} - /* Task */ typedef struct SD_task { e_SD_task_state_t state; @@ -107,10 +96,6 @@ static XBT_INLINE int __SD_task_is_scheduled_or_runnable(SD_task_t task) return task->state == SD_SCHEDULED || task->state == SD_RUNNABLE; } -/********** Storage **********/ -XBT_PRIVATE SD_storage_t __SD_storage_create(void *surf_storage, void *data); -XBT_PRIVATE void __SD_storage_destroy(void *storage); - SG_END_DECL() #endif diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index f5cb8aa15c..8ff760626a 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -41,7 +41,6 @@ int MSG_FILE_LEVEL; //Msg file level int SIMIX_STORAGE_LEVEL; //Simix storage level int MSG_STORAGE_LEVEL; //Msg storage level -int SD_STORAGE_LEVEL; //Simdag storage level xbt_lib_t as_router_lib; int ROUTING_ASR_LEVEL; //Routing level -- 2.20.1