summaryrefslogtreecommitdiffstats
path: root/lib/4a-hal-utilities/4a-hal-utilities-data.h
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-14 17:59:20 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-18 11:34:34 +0200
commit66f27bce6355cc7df978a9d7a6bc725542057a01 (patch)
treebed31fbbd60ec80a2f6f57f8182c326ae048d5b7 /lib/4a-hal-utilities/4a-hal-utilities-data.h
parent870d396127c2e5e247cb85a7921143e78ee81ce4 (diff)
Refactoring 'probed devices' linked list
Refactoring 'probed devices' linked list code using liburcu. BUG-AGL: SPEC-2329 Change-Id: I4d0255bc020733b1abbea1f3e6195c73cf8da8f6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'lib/4a-hal-utilities/4a-hal-utilities-data.h')
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-data.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.h b/lib/4a-hal-utilities/4a-hal-utilities-data.h
index c051373..8ac4c25 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/lib/4a-hal-utilities/4a-hal-utilities-data.h
@@ -20,6 +20,8 @@
#include <stdio.h>
+#include <urcu/list.h>
+
#include <wrap-json.h>
#include <afb/afb-binding.h>
@@ -32,6 +34,11 @@
#define HAL_STREAM_UPDATES_EVENT_NAME "stream-updates"
+// Enum for linked list type
+enum LinkedListType {
+ LINKED_LIST_FOR_DEPENDENCIES_DATA = 0
+};
+
// Enum for hal status
enum HalStatus {
HAL_STATUS_UNAVAILABLE = 0,
@@ -83,7 +90,7 @@ struct InternalHalProbedDevice {
struct InternalHalDeviceData *deviceData;
- struct InternalHalProbedDevice *next;
+ struct cds_list_head node;
};
// Structure to store stream data
@@ -102,7 +109,7 @@ struct InternalHalData {
char *prefix;
json_object *halMixerJ;
- struct InternalHalProbedDevice *probedDevicesList;
+ struct cds_list_head probedDevicesListHead;
struct InternalHalMixerData *streamsData;
afb_event_t streamUpdates;
@@ -146,26 +153,26 @@ struct HalMgrData {
// Internal Hal - Probed devices structure handling functions
enum ProbedDeviceClasses HalUtlGetProbedDeviceClassFromString(char *probedDeviceString);
char *HalUtlGetProbedDeviceClassString(enum ProbedDeviceClasses deviceClass);
-struct InternalHalProbedDevice *HalUtlAddProbedDeviceToProbedDeviceList(struct InternalHalProbedDevice **probedDevicesList);
-int HalUtlRemoveSelectedProbedDeviceFromList(struct InternalHalProbedDevice **probedDevicesList,
+struct InternalHalProbedDevice *HalUtlAddProbedDeviceToProbedDeviceList(struct cds_list_head *probedDevicesListHead);
+int HalUtlRemoveSelectedProbedDeviceFromList(struct cds_list_head *probedDevicesListHead,
struct InternalHalProbedDevice *probedDeviceToRemove);
-int HalUtlRemoveAllProbedDevicesFromList(struct InternalHalProbedDevice **probedDevicesList);
-int HalUtlGetNumberOfProbedDevicesInList(struct InternalHalProbedDevice **probedDevicesList);
-struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct InternalHalProbedDevice **probedDevicesList,
+int HalUtlRemoveAllProbedDevicesFromList(struct cds_list_head *probedDevicesListHead);
+int HalUtlGetNumberOfProbedDevicesInList(struct cds_list_head *probedDevicesListHead);
+struct InternalHalProbedDevice *HalUtlSearchProbedDeviceDataById(struct cds_list_head *probedDevicesListHead,
char *uid);
struct InternalHalDeviceData *HalUtlAllocateAndFillProbedDeviceDataUsingInfoGetResponse(json_object *responseJ);
json_object *HalUtlGetJsonForSpecificDependencies(afb_api_t apiHandle,
struct InternalHalProbedDevice *requestedProbedDevice,
enum DependencyInfoJsonFormat jsonFormat);
json_object *HalUtlGetJsonForSpecificDependenciesUsingUid(afb_api_t apiHandle,
- struct InternalHalProbedDevice **probedDevicesList,
+ struct cds_list_head *probedDevicesListHead,
char *uid,
enum DependencyInfoJsonFormat jsonFormat);
json_object *HalUtlGetJsonArrayForAvailableDependencies(afb_api_t apiHandle,
- struct InternalHalProbedDevice **probedDevicesList,
+ struct cds_list_head *probedDevicesListHead,
enum DependencyInfoJsonFormat jsonFormat);
json_object *HalUtlGetJsonArrayForAllDependencies(afb_api_t apiHandle,
- struct InternalHalProbedDevice **probedDevicesList,
+ struct cds_list_head *probedDevicesListHead,
enum DependencyInfoJsonFormat jsonFormat);
// Internal Hal - Streams data handling functions