3 * @author Michal Sojka <sojkam1@fel.cvut.cz>
4 * @date Tue Nov 11 08:34:09 2008
6 * @brief Generic resource manager declarations
14 #include <fres_sa_scenario.h>
15 #include <fra_generic.h>
18 * Admission test for a given resource.
20 * The admission test is called from
21 * fres::resource_manager::reserve_contracts() to evaluate
22 * schedulability of the scenario given as a parameter. It can use
23 * fres_sa_scenario_for_each_contract() macro to traverse through all
24 * the contracts in the scenario. No constract should be added or
25 * deleted, but any data (blocks) can be added to the contracts. If
26 * the scenario is schedulable, the contracts (with possibly added
27 * data) are sent to resource scheduler, which can use this additional
28 * data as parameters for VRes creation.
30 * During the admission test, the contracts in scenariou can be
31 * processed in any way as the test desires. The contract to be tested
32 * is stored in fres_sa_contract::contract. If the test want to know
33 * about the state of the contract it can compare the value of
34 * fres_sa_contract::contract with fres_sa_contract::new,
35 * fres_sa_contract::reserved and fres_sa_contract::commited.
37 * @param[in] scenario Scenario to check its schedulability.
38 * @param[in] priv Pointer to private data, registered by frm_generic_run().
39 * @param[out] schedulable Set to true if the scenario is schedulable, to false otherwise.
41 * @return Zero on success, non-zero error code on return.
43 typedef int (*frm_adm_test_fnc_t)(struct fres_sa_scenario *scenario, void *priv, bool *schedulable);
45 /** Description of a resource manager */
46 struct fres_res_manager {
47 frsh_resource_type_t res_type;
48 frsh_resource_id_t res_id;
49 frm_adm_test_fnc_t admission_test; /**< Pointer to the admission test routine */
50 void *priv; /**< Any data to be passed to admission test */
54 struct fres_sa_scenario *scenario;
55 const struct fres_res_manager *desc;
58 fres_resource_manager frm_register(forb_orb orb, struct frm_data *frm_data,
59 forb_executor_t *executor,
60 const struct fres_res_manager *desc);
61 int frm_register_and_run(forb_orb orb,
62 const struct fres_res_manager *desc);