diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-06-09 17:45:32 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:52:51 +0200 |
commit | 14412fb98e96921c710407a1c336b628a449ebc5 (patch) | |
tree | 3e57c18304f554338c55d3edfd077a5ef6b8abde /4a-hal/4a-hal-manager/4a-hal-manager.c | |
parent | ce6c73e669a84f07bc85326514775130077585fc (diff) |
Use a local strucuture to store hal manager data
Use a local strucuture to store hal manager global data.
Also declare a function that allows to get the first hal data structure in
the list managed by hal manager.
Change-Id: I4b36030435bca506b5ba3a08dfbca039eb02e43e
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-manager/4a-hal-manager.c')
-rw-r--r-- | 4a-hal/4a-hal-manager/4a-hal-manager.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c index df35d12..f3ebe14 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager.c @@ -31,6 +31,9 @@ // Default api to print log when apihandle not available AFB_ApiT AFB_default; +// Local (static) Hal manager data structure +static struct HalMgrData localHalMgrGlobalData; + /******************************************************************************* * HAL Manager verbs table * ******************************************************************************/ @@ -49,6 +52,16 @@ struct HalUtlApiVerb HalManagerApiStaticVerbs[] = }; /******************************************************************************* + * HAL Manager get first 'SpecificHalData' structure * + from HAL list function * + ******************************************************************************/ + +struct SpecificHalData **HalMngGetFirstHalData(void) +{ + return &localHalMgrGlobalData.first; +} + +/******************************************************************************* * Dynamic API functions for hal manager * * TBD JAI : Use API-V3 instead of API-PRE-V3 * ******************************************************************************/ @@ -120,27 +133,22 @@ int HalMgrCreateApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData) int afbBindingVdyn(AFB_ApiT apiHandle) { int status = 0, rc; - struct HalMgrData *HalMgrGlobalData; if(! apiHandle) return -1; - HalMgrGlobalData = (struct HalMgrData *) calloc(1, sizeof(struct HalMgrData)); - if(! HalMgrGlobalData) - return -2; - // Hugely hack to make all V2 AFB_DEBUG to work in fileutils AFB_default = apiHandle; AFB_ApiNotice(apiHandle, "In %s", __func__); // Load Hal-Manager using DynApi - rc = HalMgrCreateApi(apiHandle, HalMgrGlobalData); + rc = HalMgrCreateApi(apiHandle, &localHalMgrGlobalData); if(rc < 0) status--; // Load Hal-Ctls using DynApi - rc = HalCtlsCreateAllApi(apiHandle, HalMgrGlobalData); + rc = HalCtlsCreateAllApi(apiHandle, &localHalMgrGlobalData); if(rc < 0) status -= rc; |