From: Michal Sojka Date: Thu, 13 Nov 2008 13:53:29 +0000 (+0100) Subject: Resource scheduler renamed to resource allocator X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/frsh-forb.git/commitdiff_plain/718cf07d1544020fabe665b4c0bffb7b4803fabe Resource scheduler renamed to resource allocator The new name is not so confusing as the old one. --- diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 00000000..72c0e878 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,12 @@ +FIGS = $(wildcard *.svg) + +all: $(FIGS:%.svg=%.pdf) + +%.ps: %.svg + inkscape -P $@ $< + +%-page.pdf: %.ps + ps2pdf $< $@ + +%.pdf: %-page.pdf + pdfcrop $< $@ diff --git a/doc/dtm-architecture.svg b/doc/frsh-forb-arch.svg similarity index 97% rename from doc/dtm-architecture.svg rename to doc/frsh-forb-arch.svg index adebc285..b6033c69 100644 --- a/doc/dtm-architecture.svg +++ b/doc/frsh-forb-arch.svg @@ -66,13 +66,13 @@ inkscape:zoom="1.0633221" inkscape:cx="526.18109" inkscape:cy="372.04724" - inkscape:current-layer="layer1" + inkscape:current-layer="g5379" inkscape:document-units="px" showgrid="false" inkscape:snap-global="false" - inkscape:window-width="1672" - inkscape:window-height="989" - inkscape:window-x="0" + inkscape:window-width="1272" + inkscape:window-height="963" + inkscape:window-x="1680" inkscape:window-y="0" inkscape:snap-intersection-line-segments="true" inkscape:object-paths="true" @@ -168,18 +168,18 @@ x="177.16187" style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" xml:space="preserve">Contract Contract BrokerBrokerAgent(CB) + sodipodi:role="line">(CBA) SchedulerAllocatorSchedulerAllocatorContract Contract BrokerBrokerAgent(CB) + y="429.10352">(CBA) SchedulerAllocatorSchedulerAllocator + + + - - - + borderlayer="false" + inkscape:snap-intersection-line-segments="true" + inkscape:snap-intersection-grid-guide="false" + inkscape:snap-center="true" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" /> @@ -112,6 +122,21 @@ inkscape:label="Contract flow" style="display:inline" transform="translate(-58.52032,-298.67903)"> + + + @@ -161,7 +186,7 @@ id="g3969" transform="matrix(0.8,0,0,0.8,193.40503,295.89545)"> + style="fill:#ff5f5f;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="opacity:1;fill:#ff5b5b;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> Variant A + style="fill:#ff5b5b;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#ff5b5b;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#ff5b5b;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> Basic params B Resource + style="fill:#ffc0c0;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:#ff5f5f;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> Basic params A + style="fill:#ff5f5f;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> Schedulable contract + style="fill:#ff5f5f;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> Interface to the real schedulerInterface to resource schedulerScheduler + id="tspan5412">Allocator RealResourcecommunication + + Contract blocks + + + + diff --git a/fres/Makefile.omk b/fres/Makefile.omk index e877a718..6e6d8e25 100644 --- a/fres/Makefile.omk +++ b/fres/Makefile.omk @@ -1 +1 @@ -SUBDIRS=contract cbroker resmng ressched +SUBDIRS=contract cbroker resmng resalloc diff --git a/fres/cbroker/Makefile.omk b/fres/cbroker/Makefile.omk index d827ca9c..0d74860d 100644 --- a/fres/cbroker/Makefile.omk +++ b/fres/cbroker/Makefile.omk @@ -1,7 +1,7 @@ bin_PROGRAMS += fcb fcb_SOURCES = fcb.c -fcb_LIBS = contract fosa forb pthread rt ulut frm_client frs_client +fcb_LIBS = contract fosa forb pthread rt ulut frm_client fra_client fcb_SERVER_IDL = fcb.idl lib_LIBRARIES += fcb_client diff --git a/fres/cbroker/dtm.idl b/fres/cbroker/dtm.idl index 2f5aa2c0..d15d5946 100644 --- a/fres/cbroker/dtm.idl +++ b/fres/cbroker/dtm.idl @@ -14,7 +14,7 @@ module cm { long get_contract(in contract_handle_t handle); void negotiate_contract(inout contract_t contract); void register_manager(in resource_type restype, in resource_manager m); - void register_scheduler(in resource_type restype, in resource_scheduler r); + void register_allocator(in resource_type restype, in resource_allocator r); }; }; diff --git a/fres/cbroker/fcb.c b/fres/cbroker/fcb.c index 6dc9a00d..41795eb6 100644 --- a/fres/cbroker/fcb.c +++ b/fres/cbroker/fcb.c @@ -83,16 +83,16 @@ struct res_mng { gavl_node_t node; struct res_key resource; fres_resource_manager rm; /**< Object reference of the resource manager */ - gavl_cust_root_field_t schedulers; /**< Registered schedulers for this resource (from multiple applications/nodes) */ + gavl_cust_root_field_t allocators; /**< Registered allocators for this resource (from multiple applications/nodes) */ }; /** - * Resource scheduler registered in different nodes/applications + * Resource allocator registered in different nodes/applications */ -struct res_sched { +struct res_alloc { gavl_node_t node; forb_server_id app; - fres_resource_scheduler rs; + fres_resource_allocator ra; }; struct fcb { @@ -132,20 +132,20 @@ GAVL_CUST_NODE_INT_IMP(fcb_resource /* cust_prefix */, \ resource /* cust_item_key */, \ res_key_cmp /* cust_cmp_fnc */); -GAVL_CUST_NODE_INT_DEC(fcb_sched /* cust_prefix */, \ +GAVL_CUST_NODE_INT_DEC(fcb_alloc /* cust_prefix */, \ struct res_mng /* cust_root_t */, \ - struct res_sched /* cust_item_t */, \ + struct res_alloc /* cust_item_t */, \ forb_server_id /* cust_key_t */, \ - schedulers /* cust_root_node */, \ + allocators /* cust_root_node */, \ node /* cust_item_node */, \ app /* cust_item_key */, \ fres_contract_id_cmp /* cust_cmp_fnc */); -GAVL_CUST_NODE_INT_IMP(fcb_sched /* cust_prefix */, \ +GAVL_CUST_NODE_INT_IMP(fcb_alloc /* cust_prefix */, \ struct res_mng /* cust_root_t */, \ - struct res_sched /* cust_item_t */, \ + struct res_alloc /* cust_item_t */, \ forb_server_id /* cust_key_t */, \ - schedulers /* cust_root_node */, \ + allocators /* cust_root_node */, \ node /* cust_item_node */, \ app /* cust_item_key */, \ forb_server_id_cmp /* cust_cmp_fnc */); @@ -163,7 +163,7 @@ negotiate_contract(fres_contract_broker obj, fres_block_resource *res; struct res_key res_key; struct res_mng *rm; - struct res_sched *rs; + struct res_alloc *ra; int ret; forb_server_id app; fres_contract_ptr contract_seq_buf; @@ -193,11 +193,11 @@ negotiate_contract(fres_contract_broker obj, contract->id = *id; forb_get_req_source(obj, &app); - rs = fcb_sched_find(rm, &app); - if (!rs) { + ra = fcb_alloc_find(rm, &app); + if (!ra) { char str[60]; forb_server_id_to_string(str, &app, sizeof(str)); - ul_logerr("No resource scheduler found for %d.%d and %s\n", + ul_logerr("No resource allocator found for %d.%d and %s\n", res_key.type, res_key.id, str); ret = -1; goto err; @@ -227,7 +227,7 @@ negotiate_contract(fres_contract_broker obj, } /* Create VRes */ - ret = fres_resource_scheduler_change_vreses(rs->rs, schedulable_contracts, ev); + ret = fres_resource_allocator_change_vreses(ra->ra, schedulable_contracts, ev); if (CORBA_sequence_get_release(schedulable_contracts)) { int i; for (i=0; i_length; i++) { @@ -271,7 +271,7 @@ CORBA_long register_resource(fres_contract_broker obj, restype, resid); forb_object_release(rm2->rm); fcb_resource_delete(fcb, rm2); - /* TODO: Delete also all schedulers associated + /* TODO: Delete also all allocators associated * with this stale resource manager. */ free(rm); rm = rm2; @@ -283,7 +283,7 @@ CORBA_long register_resource(fres_contract_broker obj, } rm->rm = forb_object_duplicate(desc->manager); - fcb_sched_init_root_field(rm); + fcb_alloc_init_root_field(rm); ul_logmsg("Registering manager for resource %d.%d\n", restype, resid); fcb_resource_insert(fcb, rm); @@ -295,47 +295,47 @@ err: } -CORBA_long register_scheduler(fres_contract_broker obj, +CORBA_long register_allocator(fres_contract_broker obj, const frsh_resource_type_t restype, const frsh_resource_id_t resid, - const fres_resource_scheduler rs_obj, + const fres_resource_allocator ra_obj, CORBA_Environment *ev) { struct fcb *fcb = o2fcb(obj); struct res_mng *rm; - struct res_sched *rs; + struct res_alloc *ra; struct res_key resource; forb_server_id server_id; char server_id_str[40]; - forb_get_server_id(rs_obj, &server_id); + forb_get_server_id(ra_obj, &server_id); forb_server_id_to_string(server_id_str, &server_id, sizeof(server_id_str)); - ul_logmsg("Registering scheduler for resource %d.%d in app %s\n", + ul_logmsg("Registering allocator for resource %d.%d in app %s\n", restype, resid, server_id_str); resource.type = restype; resource.id = resid; rm = fcb_resource_find(fcb, &resource); if (!rm) { - ul_logerr("No manager found for %d.%d. Unable to register the scheduler!\n", + ul_logerr("No manager found for %d.%d. Unable to register the allocator!\n", restype, resid); goto err; } - rs = fcb_sched_find(rm, &server_id); - if (rs) { - char *str = forb_object_to_string(rs_obj); - ul_logerr("Scheduler from already registered (%s)\n", + ra = fcb_alloc_find(rm, &server_id); + if (ra) { + char *str = forb_object_to_string(ra_obj); + ul_logerr("Allocator from already registered (%s)\n", str); forb_free(str); goto err; } - rs = malloc(sizeof(*rs)); - if (!rs) { + ra = malloc(sizeof(*ra)); + if (!ra) { goto err; } - rs->app = server_id; - rs->rs = forb_object_duplicate(rs_obj); - fcb_sched_insert(rm, rs); + ra->app = server_id; + ra->ra = forb_object_duplicate(ra_obj); + fcb_alloc_insert(rm, ra); return 0; err: return -1; @@ -344,7 +344,7 @@ err: struct forb_fres_contract_broker_impl impl = { .negotiate_contract = negotiate_contract, .register_resource = register_resource, - .register_scheduler = register_scheduler, + .register_allocator = register_allocator, }; int main(int argc, char *argv[]) diff --git a/fres/cbroker/fcb.idl b/fres/cbroker/fcb.idl index c4d8e4f6..ae786490 100644 --- a/fres/cbroker/fcb.idl +++ b/fres/cbroker/fcb.idl @@ -60,7 +60,7 @@ #include "../contract/fres_contract_idl.idl" #include "../contract/fres_blocks.idl" #include "../resmng/frm.idl" -#include "../ressched/frs.idl" +#include "../resalloc/fra.idl" module fres { @@ -85,7 +85,7 @@ module fres { in resource_desc res_desc); /** - * Registers a resource scheduler with the contract broker + * Registers a resource allocator with the contract broker * * @param restype * @param resid @@ -93,11 +93,11 @@ module fres { * * @return Zero on success, non-zero error code on error. */ - long register_scheduler(in frsh_resource_type_t restype, + long register_allocator(in frsh_resource_type_t restype, in frsh_resource_id_t resid, - in resource_scheduler rs_obj); + in resource_allocator rs_obj); - long deregister_scheduler(in resource_scheduler rs_obj); + long deregister_allocator(in resource_allocator rs_obj); /** * Tries to negotiate a contract diff --git a/fres/ressched/Makefile b/fres/resalloc/Makefile similarity index 100% rename from fres/ressched/Makefile rename to fres/resalloc/Makefile diff --git a/fres/resalloc/Makefile.omk b/fres/resalloc/Makefile.omk new file mode 100644 index 00000000..8f87c12a --- /dev/null +++ b/fres/resalloc/Makefile.omk @@ -0,0 +1,8 @@ +shared_LIBRARIES += fra +fra_SOURCES = fra_generic.c fres_vres.c +fra_SERVER_IDL = fra.idl +include_GEN_HEADERS += fra.h +include_HEADERS = fra_generic.h fres_vres.h + +lib_LIBRARIES += fra_client +fra_client_CLIENT_IDL = fra.idl diff --git a/fres/ressched/frs.idl b/fres/resalloc/fra.idl similarity index 74% rename from fres/ressched/frs.idl rename to fres/resalloc/fra.idl index 709d89f4..73c6edfa 100644 --- a/fres/ressched/frs.idl +++ b/fres/resalloc/fra.idl @@ -1,14 +1,23 @@ -#ifndef _RS_IDL -#define _RS_IDL +/** + * @file fra.idl + * @author Michal Sojka + * @date Thu Nov 13 14:05:39 2008 + * + * @brief FORB interface to resource allocator + * + * + */ +#ifndef _FRA_IDL +#define _FRA_IDL #include "../contract/fres_contract_idl.idl" module fres { /** - * Interface to the scheduler + * Interface to the allocator * */ - interface resource_scheduler { + interface resource_allocator { /** * Creates or changes VRESes. * @@ -17,12 +26,12 @@ module fres { * together with the contract broker ensure that the * state after applying the changes specified by @a * schedulable_contracts parameter is schedulable. It - * is up to the scheduler to apply the changes in such + * is up to the allocator to apply the changes in such * way that schedulability is maintained during the * change. The changes are received in the same order * as returned by the manager, so if the manager * already prepares the order of aplying changes, the - * scheduler can use it. + * allocator can use it. * * @param schedulable_contracts Contracts for VRESes * to be created or (if they already exist) diff --git a/fres/ressched/frs_generic.c b/fres/resalloc/fra_generic.c similarity index 77% rename from fres/ressched/frs_generic.c rename to fres/resalloc/fra_generic.c index 48f78973..30dc4d13 100644 --- a/fres/ressched/frs_generic.c +++ b/fres/resalloc/fra_generic.c @@ -1,20 +1,20 @@ /** - * @file frs_generic.c + * @file fra_generic.c * @author Michal Sojka * @date Thu Oct 23 15:26:19 2008 * - * @brief FORB interface of FRES Resource Scheduler + * @brief FORB interface of FRES Resource Allocator * * */ #include -#include +#include #include #include -#include "frs_generic.h" +#include "fra_generic.h" -UL_LOG_CUST(ulogd_frs); -ul_log_domain_t ulogd_frs = {UL_LOGL_MSG, "frs"}; +UL_LOG_CUST(ulogd_fra); +ul_log_domain_t ulogd_fra = {UL_LOGL_MSG, "fra"}; /** * Global "registry" of all virtual resources in one application. @@ -70,14 +70,14 @@ fres_vreses_find(fres_contract_id_t *id) #define save_errno(cmd) do { int _e = errno; cmd; errno = _e; } while(0) -CORBA_long change_vreses(fres_resource_scheduler obj, +CORBA_long change_vreses(fres_resource_allocator obj, const fres_contract_ptr_seq* contracts, CORBA_Environment *ev) { int ret; unsigned len = contracts->_length; unsigned i; - struct fres_scheduler *sch = forb_instance_data(obj); + struct fres_allocator *sch = forb_instance_data(obj); struct fres_vres **vreses; /* Prepare the vres structures */ @@ -106,7 +106,7 @@ CORBA_long change_vreses(fres_resource_scheduler obj, assert(ret > 0); /* Nobody else inserted the same vres. */ } vres->new = contract; - vres->scheduler = sch; + vres->allocator = sch; vreses[i] = vres; } @@ -158,12 +158,12 @@ err: return ret; } -void cancel_vreses(fres_resource_scheduler obj, +void cancel_vreses(fres_resource_allocator obj, const fres_contract_id_seq* ids, CORBA_Environment *ev) { int ret, i; - struct fres_scheduler *sch = forb_instance_data(obj); + struct fres_allocator *sch = forb_instance_data(obj); for (i=0; i < ids->_length; i++) { struct fres_vres *vres; @@ -181,81 +181,81 @@ void cancel_vreses(fres_resource_scheduler obj, err:; } -static const struct forb_fres_resource_scheduler_impl frs_impl = { +static const struct forb_fres_resource_allocator_impl fra_impl = { .change_vreses = change_vreses, .cancel_vreses = cancel_vreses, }; /** - * Creates scheduler object and registeres it with the given executor. + * Creates allocator object and registeres it with the given executor. * * @param orb * @param executor - * @param scheduler + * @param allocator * * @return Object reference on success or NULL on error. */ -fres_resource_scheduler frs_new(forb_orb orb, +fres_resource_allocator fra_new(forb_orb orb, forb_executor_t *executor, - struct fres_scheduler *scheduler) + struct fres_allocator *allocator) { int ret; - fres_resource_scheduler frs; + fres_resource_allocator fra; - frs = forb_fres_resource_scheduler_new(orb, &frs_impl, scheduler); - if (!frs) { + fra = forb_fres_resource_allocator_new(orb, &fra_impl, allocator); + if (!fra) { save_errno(ul_logerr("forb_fres_resource_manager_new error")); goto err; } - /* Prepare executor before we register the resource scheduler + /* Prepare executor before we register the resource allocator * with contract broker */ - ret = forb_executor_register_object(executor, frs); + ret = forb_executor_register_object(executor, fra); if (ret) goto err_release; - return frs; + return fra; err_release: - save_errno(forb_object_release(frs)); + save_errno(forb_object_release(fra)); err: return NULL; } /** - * Creates and registeres the scheduler with contract broker. + * Creates and registeres the allocator with contract broker. * * @param orb * @param fcb * * @param executor Executor which will execute requests for this fres - * scheduler. + * allocator. * - * @param scheduler + * @param allocator * * @return Zero on success, -1 on error. */ -int frs_register(forb_orb orb, +int fra_register(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor, - struct fres_scheduler *scheduler) + struct fres_allocator *allocator) { int ret; struct forb_env env; - fres_resource_scheduler frs; + fres_resource_allocator fra; - frs = frs_new(orb, executor, scheduler); - /* Register resource scheduler */ - ret = fres_contract_broker_register_scheduler(fcb, - scheduler->res_type, - scheduler->res_id, - frs, &env); + fra = fra_new(orb, executor, allocator); + /* Register resource allocator */ + ret = fres_contract_broker_register_allocator(fcb, + allocator->res_type, + allocator->res_id, + fra, &env); if (forb_exception_occurred(&env) || ret != 0) { goto err_release; } return 0; err_release: - save_errno(forb_object_release(frs)); + save_errno(forb_object_release(fra)); return -1; } @@ -267,7 +267,7 @@ err_release: * * @return Pointer to VRes, or NULL in the VRes doesn't exist. */ -fres_vres_t *frs_get_vres(fres_contract_id_t *id) +fres_vres_t *fra_get_vres(fres_contract_id_t *id) { return fres_vreses_find(id); } diff --git a/fres/ressched/frs_generic.h b/fres/resalloc/fra_generic.h similarity index 78% rename from fres/ressched/frs_generic.h rename to fres/resalloc/fra_generic.h index d2007d75..09e43622 100644 --- a/fres/ressched/frs_generic.h +++ b/fres/resalloc/fra_generic.h @@ -1,16 +1,16 @@ /** - * @file frs_generic.h + * @file fra_generic.h * @author Michal Sojka * @date Mon Nov 3 15:32:54 2008 * - * @brief FORB interface of FRES Resource Scheduler + * @brief FORB interface of FRES Resource Allocator * * */ -#ifndef FRS_GENERIC_H -#define FRS_GENERIC_H +#ifndef FRA_GENERIC_H +#define FRA_GENERIC_H #include -#include +#include #include #include #include @@ -20,7 +20,7 @@ /** Registry of all virtual resources in an application. */ struct fres_vreses { - fosa_mutex_t mutex; /**< Mutex for manipulation with vreses tree. If all schedulers are executed from one executor, locking can be avoided. */ + fosa_mutex_t mutex; /**< Mutex for manipulation with vreses tree. If all allocators are executed from one executor, locking can be avoided. */ gavl_cust_root_field_t vreses; /**< Container of all virtual resources */ }; @@ -37,16 +37,16 @@ extern struct fres_vreses fres_vreses; /** - * Structure describing FRES scheduler. It is used as a parameter to - * frs_register(), which registeres this scheduler with contract - * broker and provides FORB interface to the real scheduler. + * Structure describing FRES allocator. It is used as a parameter to + * fra_register(), which registeres this allocator with contract + * broker and provides FORB interface to the real allocator. * */ -struct fres_scheduler { +struct fres_allocator { frsh_resource_type_t res_type; /**< Resource type */ frsh_resource_id_t res_id; /**< Resource ID */ /** @name Simple interface - * The scheduler cannot influence the order of applying changes. */ + * The allocator cannot influence the order of applying changes. */ /*@{*/ /** * Should create the VRES according to the parameters in @@ -75,10 +75,10 @@ struct fres_scheduler { int (*change_vres)(fres_vres_t *vres, void *priv); /*@}*/ /** @name Full interface - * The scheduler can influence the order of applying changes. */ + * The allocator can influence the order of applying changes. */ /*@{*/ /** - * A more general (and more compilcated) scheduler + * A more general (and more compilcated) allocator * interface. If this field is non-NULL, the simple interface * is not used. * @@ -109,18 +109,18 @@ struct fres_scheduler { * @return */ int (*cancel_vres)(fres_vres_t *vres, void *priv); - void *priv; /**< Pointer to scheduler's private data */ + void *priv; /**< Pointer to allocator's private data */ }; -fres_resource_scheduler frs_new(forb_orb orb, +fres_resource_allocator fra_new(forb_orb orb, forb_executor_t *executor, - struct fres_scheduler *scheduler); + struct fres_allocator *allocator); -int frs_register(forb_orb orb, +int fra_register(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor, - struct fres_scheduler *scheduler); + struct fres_allocator *allocator); -fres_vres_t *frs_get_vres(fres_contract_id_t *id); +fres_vres_t *fra_get_vres(fres_contract_id_t *id); #endif diff --git a/fres/ressched/fres_vres.c b/fres/resalloc/fres_vres.c similarity index 100% rename from fres/ressched/fres_vres.c rename to fres/resalloc/fres_vres.c diff --git a/fres/ressched/fres_vres.h b/fres/resalloc/fres_vres.h similarity index 87% rename from fres/ressched/fres_vres.h rename to fres/resalloc/fres_vres.h index 289a7a74..d10b92fc 100644 --- a/fres/ressched/fres_vres.h +++ b/fres/resalloc/fres_vres.h @@ -4,7 +4,7 @@ #include #include -struct fres_scheduler; +struct fres_allocator; /** Description of VRES (virtual resource) */ typedef struct fres_vres { @@ -32,15 +32,15 @@ typedef struct fres_vres { struct fres_contract *perceived; /** - * The schedulable contract received by the scheduler. The + * The schedulable contract received by the allocator. The * shceduler callback should use this contract to * create/change VRES and must not change the value of this * field. */ struct fres_contract *new; - struct fres_scheduler *scheduler; - void *priv; /**< Resource scheduler private data */ + struct fres_allocator *allocator; + void *priv; /**< Resource allocator private data */ gavl_node_t node; } fres_vres_t; diff --git a/fres/resmng/frm.idl b/fres/resmng/frm.idl index ceca1968..cd5a049e 100644 --- a/fres/resmng/frm.idl +++ b/fres/resmng/frm.idl @@ -44,7 +44,7 @@ module fres { * @param[out] schedulable_contracts Schedulable * contracts, for new or changed VRESes. These * contract may be extened by one or more data blocks - * for use by the scheduler. The scheduler receives + * for use by the allocator. The allocator receives * the contracts in the same order as they are * returned. */ diff --git a/fres/resmng/frm_generic.h b/fres/resmng/frm_generic.h index 7cdead0b..9ba99457 100644 --- a/fres/resmng/frm_generic.h +++ b/fres/resmng/frm_generic.h @@ -12,7 +12,7 @@ #include #include -#include +#include /** * Admission test for a given resource. diff --git a/fres/ressched/Makefile.omk b/fres/ressched/Makefile.omk deleted file mode 100644 index d75d6d9f..00000000 --- a/fres/ressched/Makefile.omk +++ /dev/null @@ -1,8 +0,0 @@ -shared_LIBRARIES += frs -frs_SOURCES = frs_generic.c fres_vres.c -frs_SERVER_IDL = frs.idl -include_GEN_HEADERS += frs.h -include_HEADERS = frs_generic.h fres_vres.h - -lib_LIBRARIES += frs_client -frs_client_CLIENT_IDL = frs.idl diff --git a/frsh_api/Makefile.omk b/frsh_api/Makefile.omk index 6fe21ef9..37b8d7a6 100644 --- a/frsh_api/Makefile.omk +++ b/frsh_api/Makefile.omk @@ -3,13 +3,13 @@ SUBDIRS = tests shared_LIBRARIES = frsh frsh_SOURCES = frsh_contract.c frsh_distributed.c frsh_core.c frsh_error.c include_HEADERS = frsh_opaque_types.h frsh_forb.h -frsh_LIBS = fna fcb_client forb contract frs ulut fosa $(scheduler-libs-y) +frsh_LIBS = fna fcb_client forb contract fra ulut fosa $(allocator-libs-y) config_include_HEADERS = frsh_resources.h frsh_resources_DEFINES = CONFIG_RESOURCE_DUMMY \ CONFIG_FWP \ CONFIG_RESOURCE_ITEM -scheduler-libs-$(CONFIG_RESOURCE_DUMMY) += frs_dummy -scheduler-libs-$(CONFIG_RESOURCE_ITEM) += frs_item -scheduler-libs-$(CONFIG_FWP) += frsh_fwp fwp +allocator-libs-$(CONFIG_RESOURCE_DUMMY) += fra_dummy +allocator-libs-$(CONFIG_RESOURCE_ITEM) += fra_item +allocator-libs-$(CONFIG_FWP) += frsh_fwp fwp diff --git a/frsh_api/frsh_contract.c b/frsh_api/frsh_contract.c index 825b4bf2..742225ed 100644 --- a/frsh_api/frsh_contract.c +++ b/frsh_api/frsh_contract.c @@ -14,7 +14,7 @@ #include #include #include "frsh_forb.h" -#include +#include /**********************************/ /* -----===== FRSH API =====----- */ @@ -171,7 +171,7 @@ int frsh_contract_negotiate } if (ret == 0) { - *vres = frs_get_vres(&id); + *vres = fra_get_vres(&id); } return ret; diff --git a/frsh_api/frsh_core.c b/frsh_api/frsh_core.c index 91e6bc2a..62e05b80 100644 --- a/frsh_api/frsh_core.c +++ b/frsh_api/frsh_core.c @@ -18,9 +18,9 @@ struct frsh_forb frsh_forb_global; -static void *sch_executor_thread(void *arg) +static void *alloc_executor_thread(void *arg) { - return (void*)forb_executor_run(&frsh_forb_global.sch_executor); + return (void*)forb_executor_run(&frsh_forb_global.alloc_executor); } @@ -41,13 +41,13 @@ int frsh_init() goto err; } - /* Initialize resource schedulers */ - ret = forb_executor_init(&frsh_forb_global.sch_executor); + /* Initialize resource allocators */ + ret = forb_executor_init(&frsh_forb_global.alloc_executor); if (ret) goto err; #ifdef CONFIG_RESOURCE_DUMMY - ret = frs_dummy_init(frsh_forb_global.orb, frsh_forb_global.fcb, - &frsh_forb_global.sch_executor); + ret = fra_dummy_init(frsh_forb_global.orb, frsh_forb_global.fcb, + &frsh_forb_global.alloc_executor); if (ret) goto err; #endif @@ -57,14 +57,14 @@ int frsh_init() #endif #ifdef CONFIG_RESOURCE_ITEM - ret = frs_item_init(frsh_forb_global.orb, frsh_forb_global.fcb, - &frsh_forb_global.sch_executor); + ret = fra_item_init(frsh_forb_global.orb, frsh_forb_global.fcb, + &frsh_forb_global.alloc_executor); if (ret) goto err; #endif - /* Run resource schedulers */ - fosa_thread_create(&frsh_forb_global.sch_executor_thread, NULL, - sch_executor_thread, NULL); - + /* Run resource allocators */ + fosa_thread_create(&frsh_forb_global.alloc_executor_thread, NULL, + alloc_executor_thread, NULL); + return 0; err: return ret; diff --git a/frsh_api/frsh_forb.h b/frsh_api/frsh_forb.h index 08aa85a8..8f9c3364 100644 --- a/frsh_api/frsh_forb.h +++ b/frsh_api/frsh_forb.h @@ -9,8 +9,8 @@ struct frsh_forb { forb_orb orb; /**< ORB used to communicate with contract broker */ fres_contract_broker fcb; /**< Contract broker object referemce */ - forb_executor_t sch_executor; /**< Executor to execute schedulers */ - fosa_thread_id_t sch_executor_thread; /**< Thread to run @a sch_executor */ + forb_executor_t alloc_executor; /**< Executor to execute allocators */ + fosa_thread_id_t alloc_executor_thread; /**< Thread to run @a alloc_executor */ }; extern struct frsh_forb frsh_forb_global; diff --git a/resources/dummy/Makefile.omk b/resources/dummy/Makefile.omk index 61fd5aeb..c9b8511b 100644 --- a/resources/dummy/Makefile.omk +++ b/resources/dummy/Makefile.omk @@ -5,10 +5,10 @@ frm_dummy_SOURCES = frm_dummy.c dummy_block.c frm_dummy_CLIENT_IDL = res_dummy_idl.idl frm_dummy_LIBS = frm forb contract fosa rt ulut fcb_client -shared_LIBRARIES = frs_dummy -frs_dummy_SOURCES = frs_dummy.c dummy_block.c -frs_dummy_LIBS = frs -frs_dummy_CLIENT_IDL = res_dummy_idl.idl +shared_LIBRARIES = fra_dummy +fra_dummy_SOURCES = fra_dummy.c dummy_block.c +fra_dummy_LIBS = fra +fra_dummy_CLIENT_IDL = res_dummy_idl.idl include_HEADERS = res_dummy.h include_GEN_HEADERS = res_dummy_idl.h diff --git a/resources/dummy/frs_dummy.c b/resources/dummy/fra_dummy.c similarity index 89% rename from resources/dummy/frs_dummy.c rename to resources/dummy/fra_dummy.c index 971b2143..2463fcf2 100644 --- a/resources/dummy/frs_dummy.c +++ b/resources/dummy/fra_dummy.c @@ -1,5 +1,5 @@ #include -#include +#include #include "res_dummy.h" #include @@ -57,7 +57,7 @@ static int change_vres(fres_vres_t *vres, void *priv) static int my_data; -static struct fres_scheduler dummy_scheduler = { +static struct fres_allocator dummy_allocator = { .res_type = DUMMY_RESOURCE_TYPE, .res_id = DUMMY_RESOURCE_ID, /* Here we are using the "simple interface" */ @@ -67,8 +67,8 @@ static struct fres_scheduler dummy_scheduler = { .priv = &my_data }; -int frs_dummy_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor) +int fra_dummy_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor) { fres_block_register_dummy(); - return frs_register(orb, fcb, executor, &dummy_scheduler); + return fra_register(orb, fcb, executor, &dummy_allocator); } diff --git a/resources/dummy/res_dummy.h b/resources/dummy/res_dummy.h index 84a5c1a7..189abb96 100644 --- a/resources/dummy/res_dummy.h +++ b/resources/dummy/res_dummy.h @@ -8,7 +8,7 @@ #define DUMMY_RESOURCE_TYPE FRSH_RT_PROCESSOR #define DUMMY_RESOURCE_ID 0 -int frs_dummy_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor); +int fra_dummy_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor); int fres_block_register_dummy(void); #endif diff --git a/resources/dummy/res_dummy_idl.idl b/resources/dummy/res_dummy_idl.idl index 1cfa58ee..ff5dd186 100644 --- a/resources/dummy/res_dummy_idl.idl +++ b/resources/dummy/res_dummy_idl.idl @@ -10,7 +10,7 @@ module fres { module block { /// Dummy data to demonstrate information transfer from - // manager to scheduler + // manager to allocator struct dummy_sched { long priority; }; diff --git a/resources/item/Makefile.omk b/resources/item/Makefile.omk index af407d96..4d91efdd 100644 --- a/resources/item/Makefile.omk +++ b/resources/item/Makefile.omk @@ -8,10 +8,10 @@ frm_item_SOURCES = frm_item.c item_blocks.c frm_item_SERVER_IDL = item_idl.idl frm_item_LIBS = frm forb contract fosa rt ulut fcb_client m -shared_LIBRARIES = frs_item -frs_item_SOURCES = item_blocks.c frs_item.c -frs_item_LIBS = frs -frs_item_CLIENT_IDL = item_idl.idl +shared_LIBRARIES = fra_item +fra_item_SOURCES = item_blocks.c fra_item.c +fra_item_LIBS = fra +fra_item_CLIENT_IDL = item_idl.idl include_HEADERS = item.h include_GEN_HEADERS = item_idl.h diff --git a/resources/item/frs_item.c b/resources/item/fra_item.c similarity index 90% rename from resources/item/frs_item.c rename to resources/item/fra_item.c index f80ecf33..87e86674 100644 --- a/resources/item/frs_item.c +++ b/resources/item/fra_item.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ static int change_vres(fres_vres_t *vres, void *priv) static struct item item; -static struct fres_scheduler item_scheduler = { +static struct fres_allocator item_allocator = { .res_type = FRSH_RT_NETWORK, .res_id = FRSH_NETPF_ITEM, /* Here we are using the "simple interface" */ @@ -62,7 +62,7 @@ static struct fres_scheduler item_scheduler = { .priv = &item }; -int frs_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor) +int fra_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor) { fres_block_register_item(); @@ -71,7 +71,7 @@ int frs_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *execu ul_logerr("forb_resolve_reference(item_scheduler) failed\n"); return errno; } - return frs_register(orb, fcb, executor, &item_scheduler); + return fra_register(orb, fcb, executor, &item_allocator); } /** @@ -85,7 +85,7 @@ int frs_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *execu * * @return Number of elements returned in @a data array, -1 on error. */ -int frs_item_receive(frsh_vres_id_t vres, unsigned *data[]) +int fra_item_receive(frsh_vres_id_t vres, unsigned *data[]) { fres_item_data_seq *seq; fres_block_item_nodes *nodes; diff --git a/resources/item/item.h b/resources/item/item.h index e103d088..1d0533d7 100644 --- a/resources/item/item.h +++ b/resources/item/item.h @@ -6,8 +6,8 @@ #include int fres_block_register_item(); -int frs_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor); -int frs_item_receive(frsh_vres_id_t vres, unsigned *data[]); +int fra_item_init(forb_orb orb, fres_contract_broker fcb, forb_executor_t *executor); +int fra_item_receive(frsh_vres_id_t vres, unsigned *data[]); #endif diff --git a/resources/item/tests/test_item.c b/resources/item/tests/test_item.c index 8195c6fc..3f21ad47 100644 --- a/resources/item/tests/test_item.c +++ b/resources/item/tests/test_item.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) printf("Reading data\n"); for (j=0; j