From: mquinson Date: Wed, 1 Jul 2009 20:31:13 +0000 (+0000) Subject: move action_ref one layer up: not a model method anymore, but function surf_action_re... X-Git-Tag: SVN~1214 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4959dfb50f77f6569ae7c59a2b1bdb18d07bfc02 move action_ref one layer up: not a model method anymore, but function surf_action_ref instead git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6427 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/ChangeLog b/ChangeLog index d6bb2feff9..0f14722777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,9 +22,10 @@ SimGrid (3.3.2-svn) unstable; urgency=low TODO: integrate the properties into that ancestor * Rename model methods: action_free -> action_unref - action_use -> action_ref action_change_state -> action_state_set action_get_state -> action_state_get + * Change model methods into classical functions: + action_use -> surf_action_ref XBT: * Add xbt_set_get_by_name_or_null() [Silas De Munck] diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 12bcb4177c..90f7069b9c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -28,7 +28,10 @@ SG_BEGIN_DECL() * * \see e_surf_action_state_t */ - typedef struct surf_action *surf_action_t; +typedef struct surf_action *surf_action_t; +/** @Brief Specify that we use that action */ +XBT_PUBLIC(void) surf_action_ref(surf_action_t action); + /** \brief Model datatype * \ingroup SURF_models @@ -217,7 +220,6 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table, double (*action_get_start_time) (surf_action_t action);/**< Return the start time of an action */ double (*action_get_finish_time) (surf_action_t action);/**< Return the finish time of an action */ - void (*action_ref) (surf_action_t action);/**< Specify that we use that action */ int (*action_unref) (surf_action_t action);/**< Specify that we don't use that action anymore */ void (*action_cancel) (surf_action_t action);/**< Cancel a running action */ void (*action_recycle) (surf_action_t action);/**< Recycle an action */ diff --git a/src/surf/cpu.c b/src/surf/cpu.c index ea6af9fd8d..7f26a7c5b2 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -148,11 +148,6 @@ static int action_unref(surf_action_t action) return 0; } -static void action_ref(surf_action_t action) -{ - action->refcount++; -} - static void action_cancel(surf_action_t action) { surf_action_state_set(action, SURF_ACTION_FAILED); @@ -402,7 +397,6 @@ static void surf_cpu_model_init_internal(void) surf_cpu_model->name = "CPU"; surf_cpu_model->action_unref = action_unref; - surf_cpu_model->action_ref = action_ref; surf_cpu_model->action_cancel = action_cancel; surf_cpu_model->action_state_set = cpu_action_state_set; diff --git a/src/surf/network.c b/src/surf/network.c index f0c5e325f0..e308f36098 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -314,11 +314,6 @@ static int action_unref(surf_action_t action) return 0; } -static void action_ref(surf_action_t action) -{ - action->refcount++; -} - static void action_cancel(surf_action_t action) { return; @@ -668,7 +663,6 @@ static void surf_network_model_init_internal(void) surf_network_model->name = "network"; surf_network_model->action_unref = action_unref; - surf_network_model->action_ref = action_ref; surf_network_model->action_cancel = action_cancel; surf_network_model->action_recycle = action_recycle; diff --git a/src/surf/network_constant.c b/src/surf/network_constant.c index 2c91cc399d..2ee44513cc 100644 --- a/src/surf/network_constant.c +++ b/src/surf/network_constant.c @@ -96,11 +96,6 @@ static int action_unref(surf_action_t action) return 0; } -static void action_ref(surf_action_t action) -{ - action->refcount++; -} - static void action_cancel(surf_action_t action) { return; @@ -274,7 +269,6 @@ static void surf_network_model_init_internal(void) surf_network_model->name = "network constant"; surf_network_model->action_unref = action_unref; - surf_network_model->action_ref = action_ref; surf_network_model->action_cancel = action_cancel; surf_network_model->action_recycle = action_recycle; diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index 6ed902d66e..c00a72e75c 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -325,20 +325,15 @@ static int action_unref(surf_action_t action) return 0; } -static void action_ref(surf_action_t action) -{ - action->refcount++; -} - static void action_cancel(surf_action_t action) { - xbt_assert0(0, "Cannot cancel GTNetS flow"); + xbt_die("Cannot cancel GTNetS flow"); return; } static void action_recycle(surf_action_t action) { - xbt_assert0(0, "Cannot recycle GTNetS flow"); + xbt_die("Cannot recycle GTNetS flow"); return; } @@ -530,7 +525,6 @@ static void surf_network_model_init_internal(void) surf_network_model = surf_model_init(); surf_network_model->name = "network GTNetS"; - surf_network_model->action_ref = action_ref; surf_network_model->action_unref = action_unref; surf_network_model->action_cancel = action_cancel; surf_network_model->action_recycle = action_recycle; diff --git a/src/surf/surf_action.c b/src/surf/surf_action.c index 173f5c522e..431baa6cad 100644 --- a/src/surf/surf_action.c +++ b/src/surf/surf_action.c @@ -75,3 +75,8 @@ void surf_action_data_set(surf_action_t action, void *data) { action->data = data; } + +void surf_action_ref(surf_action_t action) +{ + action->refcount++; +} diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 54f40fa410..1ce1f71553 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -63,11 +63,6 @@ static int parallel_action_free(surf_action_t action) THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */ } -static void parallel_action_use(surf_action_t action) -{ - THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */ -} - static int action_unref(surf_action_t action) { if (action->model_type == surf_network_model) @@ -81,19 +76,6 @@ static int action_unref(surf_action_t action) return 0; } -static void action_ref(surf_action_t action) -{ - if (action->model_type == surf_network_model) - surf_network_model->action_ref(action); - else if (action->model_type == surf_cpu_model) - surf_cpu_model->action_ref(action); - else if (action->model_type == surf_workstation_model) - parallel_action_use(action); - else - DIE_IMPOSSIBLE; - return; -} - static void action_cancel(surf_action_t action) { if (action->model_type == surf_network_model) @@ -291,7 +273,6 @@ static void surf_workstation_model_init_internal(void) surf_workstation_model->name = "Workstation"; surf_workstation_model->action_unref = action_unref; - surf_workstation_model->action_ref = action_ref; surf_workstation_model->action_cancel = action_cancel; surf_workstation_model->action_state_set = ws_action_state_set; diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 0b81b79ec2..666d7d7fd0 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -127,14 +127,6 @@ static xbt_dict_t get_properties(void *r) return ((cpu_L07_t) r)->properties; } -/* action_get_state is inherited from the surf module */ - -static void action_ref(surf_action_t action) -{ - action->refcount++; - return; -} - static int action_unref(surf_action_t action) { action->refcount--; @@ -985,7 +977,6 @@ static void model_init_internal(void) { surf_workstation_model = surf_model_init(); - surf_workstation_model->action_ref = action_ref; surf_workstation_model->action_unref = action_unref; surf_workstation_model->action_cancel = action_cancel; surf_workstation_model->action_state_set = surf_action_state_set;