]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_bwres_analysis.c
add group negotiations to frescan and change all the requests and messages to map...
[frescor/fna.git] / src_frescan / frescan_bwres_analysis.c
index e55b835691370d7beafaf3e0735217489528f0e7..c77d616b66c05e5546ebc29cb9d6126afc871496 100644 (file)
 #include "frescan_debug.h"
 
 /**
- * frescan_sa_init() - init the scenario
+ * frescan_bwres_sa_init() - init the scenario
  *
  * Initialize the vres list and copy the initialization parameters
  */
 
-int frescan_sa_init(frescan_sa_scenario_t *scenario,
-                    const frescan_sa_init_params_t *params)
+int frescan_bwres_sa_init(frescan_bwres_sa_scenario_t          *scenario,
+                          const frescan_bwres_sa_init_params_t *params)
 {
         int ret;
         frsh_sa_scenario_init_data_t fsa_scenario_init_data;
@@ -93,7 +93,7 @@ int frescan_sa_init(frescan_sa_scenario_t *scenario,
         INIT_LIST_HEAD(&scenario->vres_head.list);
         scenario->init_params = *params;
 
-        ret = freelist_init(&scenario->fsa_id_freelist,
+        ret = freelist_init(&scenario->fsa_vres_global_id_freelist,
                             FRESCAN_MX_NODES*FRESCAN_MX_IDS);
         if (ret != 0) return ret;
 
@@ -110,25 +110,25 @@ int frescan_sa_init(frescan_sa_scenario_t *scenario,
 }
 
 /**
- * frescan_sa_add_contract() - add a contract to the scenario
+ * frescan_bwres_sa_add_contract() - add a contract to the scenario
  *
  * create the corresponding vres structure and set its values, and add the
  * vres to the vres list
  */
 
-int frescan_sa_add_contract(frescan_sa_scenario_t *scenario,
-                            frescan_ss_t          ss,
-                            frescan_node_t        node,
-                            const frsh_contract_t *contract)
+int frescan_bwres_sa_add_contract(frescan_bwres_sa_scenario_t *scenario,
+                                  frescan_ss_t          ss,
+                                  frescan_node_t        node,
+                                  const frsh_contract_t *contract)
 {
         int ret;
-        frescan_sa_vres_t *sa_vres = &scenario->vres_pool[node][ss];
+        frescan_bwres_vres_t *sa_vres = &scenario->vres_pool[node][ss];
 
         sa_vres->contract = *contract;
         sa_vres->node     = node;
         sa_vres->ss       = ss;
 
-        ret = freelist_alloc(&scenario->fsa_id_freelist);
+        ret = freelist_alloc(&scenario->fsa_vres_global_id_freelist);
         if (ret < 0) return -1;
 
         sa_vres->fsa_vres_global_id = (frsh_sa_vres_id_t)ret;
@@ -145,17 +145,17 @@ int frescan_sa_add_contract(frescan_sa_scenario_t *scenario,
 }
 
 /**
- * frescan_sa_update_contract() - update a contract in the scenario
+ * frescan_bwres_sa_update_contract() - update a contract in the scenario
  */
 
-int frescan_sa_update_contract(frescan_sa_scenario_t  *scenario,
-                               frescan_ss_t           ss,
-                               frescan_node_t         node,
-                               const frsh_contract_t  *contract,
-                               frsh_contract_t        *old_contract)
+int frescan_bwres_sa_update_contract(frescan_bwres_sa_scenario_t  *scenario,
+                                     frescan_ss_t           ss,
+                                     frescan_node_t         node,
+                                     const frsh_contract_t  *contract,
+                                     frsh_contract_t        *old_contract)
 {
         int ret;
-        frescan_sa_vres_t *sa_vres = &scenario->vres_pool[node][ss];
+        frescan_bwres_vres_t *sa_vres = &scenario->vres_pool[node][ss];
 
         if (old_contract != NULL) {
                 *old_contract = sa_vres->contract;
@@ -172,21 +172,26 @@ int frescan_sa_update_contract(frescan_sa_scenario_t  *scenario,
 }
 
 /**
- * frescan_sa_remove_contract() - remove a contract from the scenario
+ * frescan_bwres_sa_remove_contract() - remove a contract from the scenario
  */
 
-int frescan_sa_remove_contract(frescan_sa_scenario_t *scenario,
-                               frescan_ss_t          ss,
-                               frescan_node_t        node)
+int frescan_bwres_sa_remove_contract(frescan_bwres_sa_scenario_t *scenario,
+                                     frescan_ss_t                ss,
+                                     frescan_node_t              node,
+                                     frsh_contract_t             *contract)
 {
         int ret;
-        frescan_sa_vres_t *sa_vres = &scenario->vres_pool[node][ss];
+        frescan_bwres_vres_t *sa_vres = &scenario->vres_pool[node][ss];
+
+        if (contract != NULL) {
+                *contract = sa_vres->contract;
+        }
 
         ret = frsh_sa_scenario_del_vres(&scenario->fsa_scenario,
                                         sa_vres->fsa_vres_global_id);
         if (ret != 0) return -1;
 
-        ret = freelist_free(&scenario->fsa_id_freelist,
+        ret = freelist_free(&scenario->fsa_vres_global_id_freelist,
                             sa_vres->fsa_vres_global_id);
         if (ret < 0) return -1;
 
@@ -196,12 +201,12 @@ int frescan_sa_remove_contract(frescan_sa_scenario_t *scenario,
 }
 
 /**
- * frescan_sa_sched_test() - perform a scheduling test on the scenario
+ * frescan_bwres_sa_sched_test() - perform a scheduling test on the scenario
  *
  */
 
-int frescan_sa_sched_test(frescan_sa_scenario_t *scenario,
-                          bool *is_schedulable)
+int frescan_bwres_sa_sched_test(frescan_bwres_sa_scenario_t *scenario,
+                                bool                        *is_schedulable)
 {
         int ret;
 
@@ -218,10 +223,10 @@ int frescan_sa_sched_test(frescan_sa_scenario_t *scenario,
 }
 
 /**
- * frescan_sa_spare_capacity() - distribute the spare capacity
+ * frescan_bwres_sa_spare_capacity() - distribute the spare capacity
  */
 
-int frescan_sa_spare_capacity(frescan_sa_scenario_t *scenario)
+int frescan_bwres_sa_spare_capacity(frescan_bwres_sa_scenario_t *scenario)
 {
         int ret;