From 51dcb8e712855f3cb16800ddea745ef6fc8d79e9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 20 Dec 2012 09:33:36 +0100 Subject: [PATCH] remove the create_resource entry point in resource model APIs That's a leftover from ancient times that is not used anymore. Instead, these functions are registered by each model as callbacks within the sg_platf mechanism, which is now the unique way to create resources (we had up to 3 different ways to create resources in the code base :) --- src/include/surf/surf.h | 34 -------------------------------- src/surf/cpu_cas01.c | 2 +- src/surf/cpu_ti.c | 1 - src/surf/network.c | 2 -- src/surf/storage.c | 1 - src/surf/workstation_ptask_L07.c | 5 ----- 6 files changed, 1 insertion(+), 44 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 591de8d6a1..6100dfaa76 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -197,13 +197,6 @@ typedef struct surf_cpu_model_extension_public { e_surf_resource_state_t(*get_state) (void *cpu); double (*get_speed) (void *cpu, double load); double (*get_available_speed) (void *cpu); - void* (*create_resource) (const char *name, double power_peak, - double power_scale, - tmgr_trace_t power_trace, - int core, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties); void (*add_traces) (void); } s_surf_model_extension_cpu_t; @@ -223,16 +216,6 @@ typedef struct surf_network_model_extension_public { double (*get_link_latency) (const void *link); int (*link_shared) (const void *link); void (*add_traces) (void); - void* (*create_resource) (const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties); } s_surf_model_extension_network_t; /* Storage model */ @@ -251,7 +234,6 @@ typedef struct surf_storage_model_extension_public { surf_action_t(*stat) (void *storage, surf_file_t stream); surf_action_t(*unlink) (void *storage, surf_file_t stream); surf_action_t(*ls) (void *storage, const char *path); - void* (*create_resource) (const char* id, const char* model, const char* type_id, const char *content); } s_surf_model_extension_storage_t; /** \ingroup SURF_models @@ -289,22 +271,6 @@ typedef struct surf_workstation_model_extension_public { int (*link_shared) (const void *link); xbt_dict_t(*get_properties) (const void *resource); - void* (*link_create_resource) (const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, xbt_dict_t properties); - void* (*cpu_create_resource) (const char *name, double power_peak, - double power_scale, - tmgr_trace_t power_trace, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties); void (*add_traces) (void); } s_surf_model_extension_workstation_t; diff --git a/src/surf/cpu_cas01.c b/src/surf/cpu_cas01.c index 10332f9a05..79bbc86b73 100644 --- a/src/surf/cpu_cas01.c +++ b/src/surf/cpu_cas01.c @@ -43,6 +43,7 @@ static xbt_swag_t cpu_running_action_set_that_does_not_need_being_checked = NULL; +/* This function is registered as a callback to sg_platf_new_host() and never called directly */ static void *cpu_create_resource(const char *name, double power_peak, double power_scale, tmgr_trace_t power_trace, @@ -392,7 +393,6 @@ static void surf_cpu_model_init_internal() surf_cpu_model->extension.cpu.get_speed = cpu_get_speed; surf_cpu_model->extension.cpu.get_available_speed = cpu_get_available_speed; - surf_cpu_model->extension.cpu.create_resource = cpu_create_resource; surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu; if (!surf_cpu_model->model_private->maxmin_system) { diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index a4e40b94dc..30d23f88c1 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -795,7 +795,6 @@ static void surf_cpu_ti_model_init_internal(void) surf_cpu_model->extension.cpu.get_speed = cpu_ti_get_speed; surf_cpu_model->extension.cpu.get_available_speed = cpu_ti_get_available_speed; - surf_cpu_model->extension.cpu.create_resource = cpu_ti_create_resource; surf_cpu_model->extension.cpu.add_traces = add_traces_cpu_ti; cpu_ti_action_heap = xbt_heap_new(8, NULL); diff --git a/src/surf/network.c b/src/surf/network.c index 4b6d9259c1..b83aeee980 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -806,8 +806,6 @@ static void surf_network_model_init_internal(void) net_get_link_latency; surf_network_model->extension.network.link_shared = net_link_shared; surf_network_model->extension.network.add_traces = net_add_traces; - surf_network_model->extension.network.create_resource = - net_create_resource; if (!surf_network_model->model_private->maxmin_system) surf_network_model->model_private->maxmin_system = lmm_system_new(surf_network_model->model_private->selective_update); diff --git a/src/surf/storage.c b/src/surf/storage.c index 5dd92c0c1e..4d82cd3189 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -518,7 +518,6 @@ static void surf_storage_model_init_internal(void) surf_storage_model->extension.storage.stat = storage_action_stat; surf_storage_model->extension.storage.unlink = storage_action_unlink; surf_storage_model->extension.storage.ls = storage_action_ls; - surf_storage_model->extension.storage.create_resource = storage_create_resource; if (!storage_maxmin_system) { storage_maxmin_system = lmm_system_new(storage_selective_update); diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index b6460e0616..662b3844b0 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -890,10 +890,6 @@ static void ptask_model_init_internal(void) ptask_link_shared; surf_workstation_model->extension.workstation.get_properties = surf_resource_properties; - surf_workstation_model->extension.workstation.link_create_resource = - ptask_link_create_resource; - surf_workstation_model->extension.workstation.cpu_create_resource = - ptask_cpu_create_resource; surf_workstation_model->extension.workstation.add_traces = ptask_add_traces; @@ -914,7 +910,6 @@ static void ptask_model_init_internal(void) surf_network_model->extension.network.get_link_latency = ptask_get_link_latency; surf_network_model->extension.network.link_shared = ptask_link_shared; surf_network_model->extension.network.add_traces = NULL; - surf_network_model->extension.network.create_resource = NULL; } /**************************************/ -- 2.20.1