未验证 提交 7525b21e 编写于 作者: O openharmony_ci 提交者: Gitee

!894 隐藏libbegetutil不对外开放的符号,解决util类函数符号冲突

Merge pull request !894 from Mupceet/master_cc
...@@ -45,7 +45,7 @@ struct MountFlags { ...@@ -45,7 +45,7 @@ struct MountFlags {
unsigned long flags; unsigned long flags;
}; };
unsigned int ConvertFlags(char *flagBuffer) static unsigned int ConvertFlags(char *flagBuffer)
{ {
static struct FsManagerFlags fsFlags[] = { static struct FsManagerFlags fsFlags[] = {
{"check", FS_MANAGER_CHECK}, {"check", FS_MANAGER_CHECK},
......
...@@ -333,7 +333,7 @@ int MountOneItem(FstabItem *item) ...@@ -333,7 +333,7 @@ int MountOneItem(FstabItem *item)
return rc; return rc;
} }
int CheckRequiredAndMount(FstabItem *item, bool required) static int CheckRequiredAndMount(FstabItem *item, bool required)
{ {
int rc = 0; int rc = 0;
if (item == NULL) { if (item == NULL) {
......
...@@ -85,7 +85,7 @@ static void hookStageDestroy(ListNode *node) ...@@ -85,7 +85,7 @@ static void hookStageDestroy(ListNode *node)
BEGET_CHECK(node != NULL, return); BEGET_CHECK(node != NULL, return);
stage = (HOOK_STAGE *)node; stage = (HOOK_STAGE *)node;
ListRemoveAll(&(stage->hooks), NULL); OH_ListRemoveAll(&(stage->hooks), NULL);
free((void *)stage); free((void *)stage);
} }
...@@ -94,7 +94,7 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou ...@@ -94,7 +94,7 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou
{ {
HOOK_STAGE *stageItem; HOOK_STAGE *stageItem;
stageItem = (HOOK_STAGE *)ListFind(&(hookMgr->stages), (void *)(&stage), hookStageCompare); stageItem = (HOOK_STAGE *)OH_ListFind(&(hookMgr->stages), (void *)(&stage), hookStageCompare);
BEGET_CHECK(stageItem == NULL, return stageItem); BEGET_CHECK(stageItem == NULL, return stageItem);
BEGET_CHECK(createIfNotFound, return NULL); BEGET_CHECK(createIfNotFound, return NULL);
...@@ -103,8 +103,8 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou ...@@ -103,8 +103,8 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou
stageItem = (HOOK_STAGE *)malloc(sizeof(HOOK_STAGE)); stageItem = (HOOK_STAGE *)malloc(sizeof(HOOK_STAGE));
BEGET_CHECK(stageItem != NULL, return NULL); BEGET_CHECK(stageItem != NULL, return NULL);
stageItem->stage = stage; stageItem->stage = stage;
ListInit(&(stageItem->hooks)); OH_ListInit(&(stageItem->hooks));
ListAddTail(&(hookMgr->stages), (ListNode *)stageItem); OH_ListAddTail(&(hookMgr->stages), (ListNode *)stageItem);
return stageItem; return stageItem;
} }
...@@ -143,7 +143,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void * ...@@ -143,7 +143,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void *
// Check if exists // Check if exists
compareVal.prio = prio; compareVal.prio = prio;
compareVal.hook = hook; compareVal.hook = hook;
hookItem = (HOOK_ITEM *)ListFind(&(hookStage->hooks), (void *)(&compareVal), hookItemCompareValue); hookItem = (HOOK_ITEM *)OH_ListFind(&(hookStage->hooks), (void *)(&compareVal), hookItemCompareValue);
BEGET_CHECK(hookItem == NULL, return 0); BEGET_CHECK(hookItem == NULL, return 0);
// Create new item // Create new item
...@@ -156,7 +156,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void * ...@@ -156,7 +156,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void *
hookItem->stage = hookStage; hookItem->stage = hookStage;
// Insert with order // Insert with order
ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare); OH_ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare);
return 0; return 0;
} }
...@@ -196,7 +196,7 @@ static int hookTraversalDelProc(ListNode *node, void *cookie) ...@@ -196,7 +196,7 @@ static int hookTraversalDelProc(ListNode *node, void *cookie)
BEGET_CHECK((void *)hookItem->info.hook == cookie, return 0); BEGET_CHECK((void *)hookItem->info.hook == cookie, return 0);
// Remove from the list // Remove from the list
ListRemove(node); OH_ListRemove(node);
// Destroy myself // Destroy myself
free((void *)node); free((void *)node);
...@@ -220,12 +220,12 @@ void HookMgrDel(HOOK_MGR *hookMgr, int stage, OhosHook hook) ...@@ -220,12 +220,12 @@ void HookMgrDel(HOOK_MGR *hookMgr, int stage, OhosHook hook)
BEGET_CHECK(stageItem != NULL, return); BEGET_CHECK(stageItem != NULL, return);
if (hook != NULL) { if (hook != NULL) {
ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0); OH_ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0);
return; return;
} }
// Remove from list // Remove from list
ListRemove((ListNode *)stageItem); OH_ListRemove((ListNode *)stageItem);
// Destroy stage item // Destroy stage item
hookStageDestroy((ListNode *)stageItem); hookStageDestroy((ListNode *)stageItem);
...@@ -279,8 +279,7 @@ int HookMgrExecute(HOOK_MGR *hookMgr, int stage, void *executionContext, const H ...@@ -279,8 +279,7 @@ int HookMgrExecute(HOOK_MGR *hookMgr, int stage, void *executionContext, const H
args.options = options; args.options = options;
// Traversal all hooks in the specified stage // Traversal all hooks in the specified stage
return ListTraversal(&(stageItem->hooks), (void *)(&args), return OH_ListTraversal(&(stageItem->hooks), (void *)(&args), hookExecutionProc, flags);
hookExecutionProc, flags);
} }
HOOK_MGR *HookMgrCreate(const char *name) HOOK_MGR *HookMgrCreate(const char *name)
...@@ -296,7 +295,7 @@ HOOK_MGR *HookMgrCreate(const char *name) ...@@ -296,7 +295,7 @@ HOOK_MGR *HookMgrCreate(const char *name)
free((void *)ret); free((void *)ret);
return NULL; return NULL;
} }
ListInit(&(ret->stages)); OH_ListInit(&(ret->stages));
return ret; return ret;
} }
...@@ -305,7 +304,7 @@ void HookMgrDestroy(HOOK_MGR *hookMgr) ...@@ -305,7 +304,7 @@ void HookMgrDestroy(HOOK_MGR *hookMgr)
hookMgr = getHookMgr(hookMgr, 0); hookMgr = getHookMgr(hookMgr, 0);
BEGET_CHECK(hookMgr != NULL, return); BEGET_CHECK(hookMgr != NULL, return);
ListRemoveAll(&(hookMgr->stages), hookStageDestroy); OH_ListRemoveAll(&(hookMgr->stages), hookStageDestroy);
if (hookMgr == defaultHookMgr) { if (hookMgr == defaultHookMgr) {
defaultHookMgr = NULL; defaultHookMgr = NULL;
...@@ -336,7 +335,7 @@ static int hookItemTraversal(ListNode *node, void *data) ...@@ -336,7 +335,7 @@ static int hookItemTraversal(ListNode *node, void *data)
static int hookStageTraversal(ListNode *node, void *data) static int hookStageTraversal(ListNode *node, void *data)
{ {
HOOK_STAGE *stageItem = (HOOK_STAGE *)node; HOOK_STAGE *stageItem = (HOOK_STAGE *)node;
ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0); OH_ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0);
return 0; return 0;
} }
...@@ -355,7 +354,7 @@ void HookMgrTraversal(HOOK_MGR *hookMgr, void *traversalCookie, OhosHookTraversa ...@@ -355,7 +354,7 @@ void HookMgrTraversal(HOOK_MGR *hookMgr, void *traversalCookie, OhosHookTraversa
// Prepare common args // Prepare common args
stageArgs.traversalCookie = traversalCookie; stageArgs.traversalCookie = traversalCookie;
stageArgs.traversal = traversal; stageArgs.traversal = traversal;
ListTraversal(&(hookMgr->stages), (void *)(&stageArgs), hookStageTraversal, 0); OH_ListTraversal(&(hookMgr->stages), (void *)(&stageArgs), hookStageTraversal, 0);
} }
/* /*
...@@ -372,7 +371,7 @@ int HookMgrGetHooksCnt(HOOK_MGR *hookMgr, int stage) ...@@ -372,7 +371,7 @@ int HookMgrGetHooksCnt(HOOK_MGR *hookMgr, int stage)
stageItem = getHookStage(hookMgr, stage, false); stageItem = getHookStage(hookMgr, stage, false);
BEGET_CHECK(stageItem != NULL, return 0); BEGET_CHECK(stageItem != NULL, return 0);
return ListGetCnt(&(stageItem->hooks)); return OH_ListGetCnt(&(stageItem->hooks));
} }
/* /*
...@@ -383,5 +382,5 @@ int HookMgrGetStagesCnt(HOOK_MGR *hookMgr) ...@@ -383,5 +382,5 @@ int HookMgrGetStagesCnt(HOOK_MGR *hookMgr)
hookMgr = getHookMgr(hookMgr, 0); hookMgr = getHookMgr(hookMgr, 0);
BEGET_CHECK(hookMgr != NULL, return 0); BEGET_CHECK(hookMgr != NULL, return 0);
return ListGetCnt(&(hookMgr->stages)); return OH_ListGetCnt(&(hookMgr->stages));
} }
...@@ -48,7 +48,7 @@ MODULE_MGR *ModuleMgrCreate(const char *name) ...@@ -48,7 +48,7 @@ MODULE_MGR *ModuleMgrCreate(const char *name)
moduleMgr = (MODULE_MGR *)malloc(sizeof(MODULE_MGR)); moduleMgr = (MODULE_MGR *)malloc(sizeof(MODULE_MGR));
BEGET_CHECK(moduleMgr != NULL, return NULL); BEGET_CHECK(moduleMgr != NULL, return NULL);
ListInit(&(moduleMgr->modules)); OH_ListInit(&(moduleMgr->modules));
moduleMgr->name = strdup(name); moduleMgr->name = strdup(name);
if (moduleMgr->name == NULL) { if (moduleMgr->name == NULL) {
free((void *)moduleMgr); free((void *)moduleMgr);
...@@ -154,7 +154,7 @@ int ModuleMgrInstall(MODULE_MGR *moduleMgr, const char *moduleName, ...@@ -154,7 +154,7 @@ int ModuleMgrInstall(MODULE_MGR *moduleMgr, const char *moduleName,
} }
// Add to list // Add to list
ListAddTail(&(moduleMgr->modules), (ListNode *)module); OH_ListAddTail(&(moduleMgr->modules), (ListNode *)module);
return 0; return 0;
} }
...@@ -252,16 +252,16 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name) ...@@ -252,16 +252,16 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name)
BEGET_CHECK(moduleMgr != NULL, return); BEGET_CHECK(moduleMgr != NULL, return);
// Uninstall all modules if no name specified // Uninstall all modules if no name specified
if (name == NULL) { if (name == NULL) {
ListRemoveAll(&(moduleMgr->modules), moduleDestroy); OH_ListRemoveAll(&(moduleMgr->modules), moduleDestroy);
return; return;
} }
BEGET_LOGV("ModuleMgrUninstall moduleName %s", name); BEGET_LOGV("ModuleMgrUninstall moduleName %s", name);
// Find module by name // Find module by name
module = (MODULE_ITEM *)ListFind(&(moduleMgr->modules), (void *)name, moduleCompare); module = (MODULE_ITEM *)OH_ListFind(&(moduleMgr->modules), (void *)name, moduleCompare);
BEGET_ERROR_CHECK(module != NULL, return, "Can not find module %s", name); BEGET_ERROR_CHECK(module != NULL, return, "Can not find module %s", name);
// Remove from the list // Remove from the list
ListRemove((ListNode *)module); OH_ListRemove((ListNode *)module);
// Destroy the module // Destroy the module
moduleDestroy((ListNode *)module); moduleDestroy((ListNode *)module);
} }
...@@ -269,7 +269,7 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name) ...@@ -269,7 +269,7 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name)
int ModuleMgrGetCnt(const MODULE_MGR *moduleMgr) int ModuleMgrGetCnt(const MODULE_MGR *moduleMgr)
{ {
BEGET_CHECK(moduleMgr != NULL, return 0); BEGET_CHECK(moduleMgr != NULL, return 0);
return ListGetCnt(&(moduleMgr->modules)); return OH_ListGetCnt(&(moduleMgr->modules));
} }
typedef struct tagMODULE_TRAVERSAL_ARGS { typedef struct tagMODULE_TRAVERSAL_ARGS {
...@@ -312,5 +312,5 @@ void ModuleMgrTraversal(const MODULE_MGR *moduleMgr, void *cookie, OhosModuleTra ...@@ -312,5 +312,5 @@ void ModuleMgrTraversal(const MODULE_MGR *moduleMgr, void *cookie, OhosModuleTra
args.cookie = cookie; args.cookie = cookie;
args.traversal = traversal; args.traversal = traversal;
ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0); OH_ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0);
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define DOREBOOT_PARAM "reboot.ut" #define DOREBOOT_PARAM "reboot.ut"
#endif #endif
int DoReboot_(const char *option) static int DoReboot_(const char *option)
{ {
char value[MAX_REBOOT_OPTION_SIZE]; char value[MAX_REBOOT_OPTION_SIZE];
int ret = 0; int ret = 0;
......
...@@ -51,15 +51,15 @@ typedef struct { ...@@ -51,15 +51,15 @@ typedef struct {
typedef void *HashMapHandle; typedef void *HashMapHandle;
int HashMapIsEmpty(HashMapHandle handle); int OH_HashMapIsEmpty(HashMapHandle handle);
int32_t HashMapCreate(HashMapHandle *handle, const HashInfo *info); int32_t OH_HashMapCreate(HashMapHandle *handle, const HashInfo *info);
void HashMapDestory(HashMapHandle handle); void OH_HashMapDestory(HashMapHandle handle);
int32_t HashMapAdd(HashMapHandle handle, HashNode *hashNode); int32_t OH_HashMapAdd(HashMapHandle handle, HashNode *hashNode);
void HashMapRemove(HashMapHandle handle, const void *key); void OH_HashMapRemove(HashMapHandle handle, const void *key);
HashNode *HashMapGet(HashMapHandle handle, const void *key); HashNode *OH_HashMapGet(HashMapHandle handle, const void *key);
HashNode *HashMapFind(HashMapHandle handle, HashNode *OH_HashMapFind(HashMapHandle handle,
int hashCode, const void *key, HashKeyCompare keyCompare); int hashCode, const void *key, HashKeyCompare keyCompare);
void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context), void OH_HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
const void *context); const void *context);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
......
...@@ -43,7 +43,7 @@ extern "C" { ...@@ -43,7 +43,7 @@ extern "C" {
* int value; * int value;
* } TEST_LIST_ITEM; * } TEST_LIST_ITEM;
* *
* 2. Define a list and init list by ListAddTail * 2. Define a list and init list by OH_ListAddTail
* ListNode testList; * ListNode testList;
* c(&testList); * c(&testList);
* *
...@@ -52,7 +52,7 @@ extern "C" { ...@@ -52,7 +52,7 @@ extern "C" {
* item.value = 0; * item.value = 0;
* *
* 4. Add list item to list * 4. Add list item to list
* ListAddTail(&testList, (ListNode *)(&item)); * OH_ListAddTail(&testList, (ListNode *)(&item));
* *
* 5. Advanced usage: add with order * 5. Advanced usage: add with order
* // Ordering compare function * // Ordering compare function
...@@ -62,7 +62,7 @@ extern "C" { ...@@ -62,7 +62,7 @@ extern "C" {
* TEST_LIST_ITEM *right = (TEST_LIST_ITEM *)newNode; * TEST_LIST_ITEM *right = (TEST_LIST_ITEM *)newNode;
* return left->value - right->value; * return left->value - right->value;
* } * }
* ListAddWithOrder(&testList, (ListNode *)(&item)) * OH_ListAddWithOrder(&testList, (ListNode *)(&item))
*/ */
/** /**
...@@ -85,7 +85,7 @@ typedef struct ListNode { ...@@ -85,7 +85,7 @@ typedef struct ListNode {
* @param head list head, make sure head is valid pointer * @param head list head, make sure head is valid pointer
* @return None * @return None
*/ */
void ListInit(struct ListNode *list); void OH_ListInit(struct ListNode *list);
/** /**
* @brief Add a node to the end of the list * @brief Add a node to the end of the list
...@@ -94,7 +94,7 @@ void ListInit(struct ListNode *list); ...@@ -94,7 +94,7 @@ void ListInit(struct ListNode *list);
* @param item new node to be added * @param item new node to be added
* @return None * @return None
*/ */
void ListAddTail(struct ListNode *list, struct ListNode *item); void OH_ListAddTail(struct ListNode *list, struct ListNode *item);
/** /**
* @brief Remove a node from the list * @brief Remove a node from the list
...@@ -103,7 +103,7 @@ void ListAddTail(struct ListNode *list, struct ListNode *item); ...@@ -103,7 +103,7 @@ void ListAddTail(struct ListNode *list, struct ListNode *item);
* This function does not free any memory within item. * This function does not free any memory within item.
* @return None * @return None
*/ */
void ListRemove(struct ListNode *item); void OH_ListRemove(struct ListNode *item);
/** /**
* @brief ListNode comparison function prototype * @brief ListNode comparison function prototype
...@@ -128,7 +128,7 @@ typedef int (*ListCompareProc)(ListNode *node, ListNode *newNode); ...@@ -128,7 +128,7 @@ typedef int (*ListCompareProc)(ListNode *node, ListNode *newNode);
* respectively less than, equal to, or greater than the second. * respectively less than, equal to, or greater than the second.
* @return None * @return None
*/ */
void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc); void OH_ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc);
/** /**
* @brief ListNode traversing and find function prototype * @brief ListNode traversing and find function prototype
...@@ -136,7 +136,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP ...@@ -136,7 +136,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP
* @param node ListNode to be compared. * @param node ListNode to be compared.
* @param data value for traversing * @param data value for traversing
* @return * @return
* return 0 if node value equals data for ListFind * return 0 if node value equals data for OH_ListFind
*/ */
typedef int (*ListTraversalProc)(ListNode *node, void *data); typedef int (*ListTraversalProc)(ListNode *node, void *data);
...@@ -148,7 +148,7 @@ typedef int (*ListTraversalProc)(ListNode *node, void *data); ...@@ -148,7 +148,7 @@ typedef int (*ListTraversalProc)(ListNode *node, void *data);
* @param compareProc comparing function, return 0 if matched. * @param compareProc comparing function, return 0 if matched.
* @return the found node; return NULL if none is found. * @return the found node; return NULL if none is found.
*/ */
ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc compareProc); ListNode *OH_ListFind(const ListNode *head, void *data, ListTraversalProc compareProc);
/* Traversing from end to start */ /* Traversing from end to start */
#define TRAVERSE_REVERSE_ORDER 0x1 #define TRAVERSE_REVERSE_ORDER 0x1
...@@ -169,7 +169,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr ...@@ -169,7 +169,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @return return -1 for invalid input arguments. * @return return -1 for invalid input arguments.
* when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc * when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc
*/ */
int ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags); int OH_ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags);
/** /**
* @brief ListNode destroy function prototype * @brief ListNode destroy function prototype
...@@ -186,7 +186,7 @@ typedef void (*ListDestroyProc)(ListNode *node); ...@@ -186,7 +186,7 @@ typedef void (*ListDestroyProc)(ListNode *node);
* @param destroyProc destroy function; if NULL, it will free each node by default. * @param destroyProc destroy function; if NULL, it will free each node by default.
* @return None * @return None
*/ */
void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc); void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc);
/** /**
* @brief Get list count * @brief Get list count
...@@ -194,7 +194,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc); ...@@ -194,7 +194,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc);
* @param head list head, make sure head is valid pointer. * @param head list head, make sure head is valid pointer.
* @return the count of nodes in the list; return 0 if error * @return the count of nodes in the list; return 0 if error
*/ */
int ListGetCnt(const ListNode *head); int OH_ListGetCnt(const ListNode *head);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
......
...@@ -99,7 +99,7 @@ static int InitFreeGroupNodes_(InitGroupNode *groupRoot) ...@@ -99,7 +99,7 @@ static int InitFreeGroupNodes_(InitGroupNode *groupRoot)
while (groupNode != NULL) { while (groupNode != NULL) {
groupRoot = groupNode->next; groupRoot = groupNode->next;
if (groupNode->type < NODE_TYPE_GROUPS) { // remove from hashmap if (groupNode->type < NODE_TYPE_GROUPS) { // remove from hashmap
HashMapRemove(g_initWorkspace.hashMap[groupNode->type], groupNode->name); OH_HashMapRemove(g_initWorkspace.hashMap[groupNode->type], groupNode->name);
} }
free(groupNode); free(groupNode);
groupNode = groupRoot; groupNode = groupRoot;
...@@ -173,7 +173,7 @@ void InitServiceSpace(void) ...@@ -173,7 +173,7 @@ void InitServiceSpace(void)
GROUP_HASHMAP_BUCKET GROUP_HASHMAP_BUCKET
}; };
for (size_t i = 0; i < ARRAY_LENGTH(g_initWorkspace.hashMap); i++) { for (size_t i = 0; i < ARRAY_LENGTH(g_initWorkspace.hashMap); i++) {
int ret = HashMapCreate(&g_initWorkspace.hashMap[i], &info); int ret = OH_HashMapCreate(&g_initWorkspace.hashMap[i], &info);
if (ret != 0) { if (ret != 0) {
INIT_LOGE("%s", "Failed to create hash map"); INIT_LOGE("%s", "Failed to create hash map");
} }
...@@ -242,7 +242,7 @@ InitGroupNode *AddGroupNode(int type, const char *name) ...@@ -242,7 +242,7 @@ InitGroupNode *AddGroupNode(int type, const char *name)
g_initWorkspace.groupNodes[type] = groupNode; g_initWorkspace.groupNodes[type] = groupNode;
if (type < NODE_TYPE_GROUPS) { // add hashmap if (type < NODE_TYPE_GROUPS) { // add hashmap
HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode); OH_HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode);
} }
return groupNode; return groupNode;
} }
...@@ -253,7 +253,7 @@ InitGroupNode *GetGroupNode(int type, const char *name) ...@@ -253,7 +253,7 @@ InitGroupNode *GetGroupNode(int type, const char *name)
return NULL; return NULL;
} }
INIT_LOGV("GetGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name); INIT_LOGV("GetGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name);
HashNode *node = HashMapGet(g_initWorkspace.hashMap[type], name); HashNode *node = OH_HashMapGet(g_initWorkspace.hashMap[type], name);
if (node == NULL) { if (node == NULL) {
return NULL; return NULL;
} }
...@@ -275,7 +275,7 @@ void DelGroupNode(int type, const char *name) ...@@ -275,7 +275,7 @@ void DelGroupNode(int type, const char *name)
return; return;
} }
INIT_LOGV("DelGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name); INIT_LOGV("DelGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name);
HashMapRemove(g_initWorkspace.hashMap[type], name); OH_HashMapRemove(g_initWorkspace.hashMap[type], name);
InitGroupNode *groupNode = g_initWorkspace.groupNodes[type]; InitGroupNode *groupNode = g_initWorkspace.groupNodes[type];
InitGroupNode *preNode = groupNode; InitGroupNode *preNode = groupNode;
while (groupNode != NULL) { while (groupNode != NULL) {
...@@ -299,7 +299,7 @@ int CheckNodeValid(int type, const char *name) ...@@ -299,7 +299,7 @@ int CheckNodeValid(int type, const char *name)
if (type >= NODE_TYPE_GROUPS) { if (type >= NODE_TYPE_GROUPS) {
return -1; return -1;
} }
HashNode *node = HashMapGet(g_initWorkspace.hashMap[type], name); HashNode *node = OH_HashMapGet(g_initWorkspace.hashMap[type], name);
if (node != NULL) { if (node != NULL) {
INIT_LOGI("Found %s in %s group", name, type == NODE_TYPE_JOBS ? "job" : "service"); INIT_LOGI("Found %s in %s group", name, type == NODE_TYPE_JOBS ? "job" : "service");
return 0; return 0;
......
...@@ -43,17 +43,17 @@ int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd) ...@@ -43,17 +43,17 @@ int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd)
groupNode->data.cmd = cmd; groupNode->data.cmd = cmd;
cmd->cmdId = g_cmdId++; cmd->cmdId = g_cmdId++;
cmd->name = groupNode->name; cmd->name = groupNode->name;
ListInit(&cmd->cmdExecutor); OH_ListInit(&cmd->cmdExecutor);
} }
if (execCmd == NULL) { if (execCmd == NULL) {
return 0; return 0;
} }
PluginCmdExecutor *cmdExec = (PluginCmdExecutor *)calloc(1, sizeof(PluginCmdExecutor)); PluginCmdExecutor *cmdExec = (PluginCmdExecutor *)calloc(1, sizeof(PluginCmdExecutor));
INIT_ERROR_CHECK(cmdExec != NULL, return -1, "Failed to create cmd listener"); INIT_ERROR_CHECK(cmdExec != NULL, return -1, "Failed to create cmd listener");
ListInit(&cmdExec->node); OH_ListInit(&cmdExec->node);
cmdExec->id = ++g_cmdExecutorId; cmdExec->id = ++g_cmdExecutorId;
cmdExec->execCmd = execCmd; cmdExec->execCmd = execCmd;
ListAddTail(&cmd->cmdExecutor, &cmdExec->node); OH_ListAddTail(&cmd->cmdExecutor, &cmdExec->node);
return cmdExec->id; return cmdExec->id;
} }
...@@ -69,7 +69,7 @@ void RemoveCmdExecutor(const char *cmdName, int id) ...@@ -69,7 +69,7 @@ void RemoveCmdExecutor(const char *cmdName, int id)
while (node != &cmd->cmdExecutor) { while (node != &cmd->cmdExecutor) {
PluginCmdExecutor *cmdExec = ListEntry(node, PluginCmdExecutor, node); PluginCmdExecutor *cmdExec = ListEntry(node, PluginCmdExecutor, node);
if (cmdExec->id == id) { if (cmdExec->id == id) {
ListRemove(&cmdExec->node); OH_ListRemove(&cmdExec->node);
free(cmdExec); free(cmdExec);
break; break;
} }
...@@ -148,7 +148,7 @@ void PluginExecCmdByCmdIndex(int index, const char *cmdContent) ...@@ -148,7 +148,7 @@ void PluginExecCmdByCmdIndex(int index, const char *cmdContent)
{ {
int hashCode = ((index >> 16) & 0x0000ffff) - 1; // 16 left shift int hashCode = ((index >> 16) & 0x0000ffff) - 1; // 16 left shift
int cmdId = (index & 0x0000ffff); int cmdId = (index & 0x0000ffff);
HashNode *node = HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS), HashNode *node = OH_HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS),
hashCode, (const void *)&cmdId, CompareCmdId); hashCode, (const void *)&cmdId, CompareCmdId);
if (node == NULL) { if (node == NULL) {
return; return;
......
...@@ -68,7 +68,7 @@ static LE_STATUS CreateLoop_(EventLoop **loop, uint32_t maxevents, uint32_t time ...@@ -68,7 +68,7 @@ static LE_STATUS CreateLoop_(EventLoop **loop, uint32_t maxevents, uint32_t time
TaskNodeFree, TaskNodeFree,
128 128
}; };
return HashMapCreate(&(*loop)->taskMap, &info); return OH_HashMapCreate(&(*loop)->taskMap, &info);
} }
LE_STATUS CloseLoop(EventLoop *loop) LE_STATUS CloseLoop(EventLoop *loop)
...@@ -76,7 +76,7 @@ LE_STATUS CloseLoop(EventLoop *loop) ...@@ -76,7 +76,7 @@ LE_STATUS CloseLoop(EventLoop *loop)
if (!loop->stop) { if (!loop->stop) {
return LE_SUCCESS; return LE_SUCCESS;
} }
HashMapDestory(loop->taskMap); OH_HashMapDestory(loop->taskMap);
if (loop->close) { if (loop->close) {
loop->close(loop); loop->close(loop);
} }
...@@ -100,7 +100,7 @@ LE_STATUS ProcessEvent(const EventLoop *loop, int fd, uint32_t oper) ...@@ -100,7 +100,7 @@ LE_STATUS ProcessEvent(const EventLoop *loop, int fd, uint32_t oper)
LE_STATUS AddTask(EventLoop *loop, BaseTask *task) LE_STATUS AddTask(EventLoop *loop, BaseTask *task)
{ {
LoopMutexLock(&loop->mutex); LoopMutexLock(&loop->mutex);
HashMapAdd(loop->taskMap, &task->hashNode); OH_HashMapAdd(loop->taskMap, &task->hashNode);
LoopMutexUnlock(&loop->mutex); LoopMutexUnlock(&loop->mutex);
return LE_SUCCESS; return LE_SUCCESS;
} }
...@@ -110,7 +110,7 @@ BaseTask *GetTaskByFd(EventLoop *loop, int fd) ...@@ -110,7 +110,7 @@ BaseTask *GetTaskByFd(EventLoop *loop, int fd)
BaseTask *task = NULL; BaseTask *task = NULL;
LoopMutexLock(&loop->mutex); LoopMutexLock(&loop->mutex);
TaskId id = {0, {fd}}; TaskId id = {0, {fd}};
HashNode *node = HashMapGet(loop->taskMap, &id); HashNode *node = OH_HashMapGet(loop->taskMap, &id);
if (node != NULL) { if (node != NULL) {
task = HASHMAP_ENTRY(node, BaseTask, hashNode); task = HASHMAP_ENTRY(node, BaseTask, hashNode);
} }
...@@ -123,7 +123,7 @@ void DelTask(EventLoop *loop, BaseTask *task) ...@@ -123,7 +123,7 @@ void DelTask(EventLoop *loop, BaseTask *task)
loop->delEvent(loop, task->taskId.fd, loop->delEvent(loop, task->taskId.fd,
Event_Read | Event_Write | Event_Error | Event_Free | Event_Timeout | Event_Signal); Event_Read | Event_Write | Event_Error | Event_Free | Event_Timeout | Event_Signal);
LoopMutexLock(&loop->mutex); LoopMutexLock(&loop->mutex);
HashMapRemove(loop->taskMap, (TaskId *)task); OH_HashMapRemove(loop->taskMap, (TaskId *)task);
LoopMutexUnlock(&loop->mutex); LoopMutexUnlock(&loop->mutex);
return; return;
} }
......
...@@ -80,7 +80,7 @@ static int CreatePipeSocket_(const char *server) ...@@ -80,7 +80,7 @@ static int CreatePipeSocket_(const char *server)
return fd; return fd;
} }
LE_STATUS GetSockaddrFromServer_(const char *server, struct sockaddr_in *addr) static LE_STATUS GetSockaddrFromServer_(const char *server, struct sockaddr_in *addr)
{ {
int ret = memset_s(addr, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in)); int ret = memset_s(addr, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in));
LE_CHECK(ret == 0, return ret, "Failed to memory set. error: %s", strerror(errno)); LE_CHECK(ret == 0, return ret, "Failed to memory set. error: %s", strerror(errno));
......
...@@ -84,7 +84,7 @@ LE_STATUS LE_CreateAsyncTask(const LoopHandle loopHandle, ...@@ -84,7 +84,7 @@ LE_STATUS LE_CreateAsyncTask(const LoopHandle loopHandle,
task->stream.base.handleEvent = HandleAsyncEvent_; task->stream.base.handleEvent = HandleAsyncEvent_;
task->stream.base.innerClose = HandleAsyncTaskClose_; task->stream.base.innerClose = HandleAsyncTaskClose_;
ListInit(&task->stream.buffHead); OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex); LoopMutexInit(&task->stream.mutex);
task->processAsyncEvent = processAsyncEvent; task->processAsyncEvent = processAsyncEvent;
EventLoop *loop = (EventLoop *)loopHandle; EventLoop *loop = (EventLoop *)loopHandle;
......
...@@ -195,7 +195,7 @@ LE_STATUS LE_CreateStreamClient(const LoopHandle loopHandle, ...@@ -195,7 +195,7 @@ LE_STATUS LE_CreateStreamClient(const LoopHandle loopHandle,
return LE_NO_MEMORY, "Failed to create task"); return LE_NO_MEMORY, "Failed to create task");
task->stream.base.handleEvent = HandleClientEvent_; task->stream.base.handleEvent = HandleClientEvent_;
task->stream.base.innerClose = HandleStreamTaskClose_; task->stream.base.innerClose = HandleStreamTaskClose_;
ListInit(&task->stream.buffHead); OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex); LoopMutexInit(&task->stream.mutex);
task->connectComplete = info->connectComplete; task->connectComplete = info->connectComplete;
...@@ -229,7 +229,7 @@ LE_STATUS LE_AcceptStreamClient(const LoopHandle loopHandle, const TaskHandle se ...@@ -229,7 +229,7 @@ LE_STATUS LE_AcceptStreamClient(const LoopHandle loopHandle, const TaskHandle se
task->sendMessageComplete = info->sendMessageComplete; task->sendMessageComplete = info->sendMessageComplete;
task->recvMessage = info->recvMessage; task->recvMessage = info->recvMessage;
task->serverTask = (StreamServerTask *)server; task->serverTask = (StreamServerTask *)server;
ListInit(&task->stream.buffHead); OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex); LoopMutexInit(&task->stream.mutex);
if ((info->baseInfo.flags & TASK_TEST) != TASK_TEST) { if ((info->baseInfo.flags & TASK_TEST) != TASK_TEST) {
EventLoop *loop = (EventLoop *)loopHandle; EventLoop *loop = (EventLoop *)loopHandle;
......
...@@ -81,7 +81,7 @@ LE_Buffer *CreateBuffer(uint32_t bufferSize) ...@@ -81,7 +81,7 @@ LE_Buffer *CreateBuffer(uint32_t bufferSize)
LE_Buffer *buffer = NULL; LE_Buffer *buffer = NULL;
LE_CHECK((buffer = (LE_Buffer *)malloc(sizeof(LE_Buffer) + bufferSize)) != NULL, LE_CHECK((buffer = (LE_Buffer *)malloc(sizeof(LE_Buffer) + bufferSize)) != NULL,
return NULL, "Failed to alloc memory for buffer"); return NULL, "Failed to alloc memory for buffer");
ListInit(&buffer->node); OH_ListInit(&buffer->node);
buffer->buffSize = bufferSize; buffer->buffSize = bufferSize;
buffer->dataSize = 0; buffer->dataSize = 0;
return buffer; return buffer;
...@@ -110,7 +110,7 @@ LE_Buffer *GetFirstBuffer(StreamTask *task) ...@@ -110,7 +110,7 @@ LE_Buffer *GetFirstBuffer(StreamTask *task)
void AddBuffer(StreamTask *task, LE_Buffer *buffer) void AddBuffer(StreamTask *task, LE_Buffer *buffer)
{ {
LoopMutexLock(&task->mutex); LoopMutexLock(&task->mutex);
ListAddTail(&task->buffHead, &buffer->node); OH_ListAddTail(&task->buffHead, &buffer->node);
LoopMutexUnlock(&task->mutex); LoopMutexUnlock(&task->mutex);
} }
...@@ -141,7 +141,7 @@ void FreeBuffer(const LoopHandle loop, StreamTask *task, LE_Buffer *buffer) ...@@ -141,7 +141,7 @@ void FreeBuffer(const LoopHandle loop, StreamTask *task, LE_Buffer *buffer)
if (CheckTaskFlags((BaseTask *)task, TASK_STREAM | TASK_CONNECT) || if (CheckTaskFlags((BaseTask *)task, TASK_STREAM | TASK_CONNECT) ||
CheckTaskFlags((BaseTask *)task, TASK_EVENT | TASK_ASYNC_EVENT)) { CheckTaskFlags((BaseTask *)task, TASK_EVENT | TASK_ASYNC_EVENT)) {
LoopMutexLock(&task->mutex); LoopMutexLock(&task->mutex);
ListRemove(&buffer->node); OH_ListRemove(&buffer->node);
LoopMutexUnlock(&task->mutex); LoopMutexUnlock(&task->mutex);
} }
free(buffer); free(buffer);
......
...@@ -41,7 +41,7 @@ static ListNode *getBootEventParaList(bool autoCreate) ...@@ -41,7 +41,7 @@ static ListNode *getBootEventParaList(bool autoCreate)
if (bootEventList == NULL) { if (bootEventList == NULL) {
return NULL; return NULL;
} }
ListInit(bootEventList); OH_ListInit(bootEventList);
return bootEventList; return bootEventList;
} }
...@@ -77,7 +77,7 @@ static void BootEventParaAdd(const char *paramName) ...@@ -77,7 +77,7 @@ static void BootEventParaAdd(const char *paramName)
} }
// Add to list // Add to list
ListAddTail(list, (ListNode *)item); OH_ListAddTail(list, (ListNode *)item);
} }
static int BootEventParaListCompareProc(ListNode *node, void *data) static int BootEventParaListCompareProc(ListNode *node, void *data)
...@@ -109,15 +109,15 @@ static void BootEventParaFireByName(const char *paramName) ...@@ -109,15 +109,15 @@ static void BootEventParaFireByName(const char *paramName)
return; return;
} }
found = ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc); found = OH_ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc);
if (found != NULL) { if (found != NULL) {
// Remove from list // Remove from list
ListRemove(found); OH_ListRemove(found);
BootEventParaItemDestroy((BOOT_EVENT_PARAM_ITEM *)found); BootEventParaItemDestroy((BOOT_EVENT_PARAM_ITEM *)found);
} }
// Check if all boot event params are fired // Check if all boot event params are fired
if (ListGetCnt(getBootEventParaList(false)) > 0) { if (OH_ListGetCnt(getBootEventParaList(false)) > 0) {
return; return;
} }
......
...@@ -130,10 +130,10 @@ INIT_PUBLIC_API int InitParamWorkSpace(int onlyRead) ...@@ -130,10 +130,10 @@ INIT_PUBLIC_API int InitParamWorkSpace(int onlyRead)
WorkSpaceFree, WorkSpaceFree,
HASH_BUTT HASH_BUTT
}; };
int ret = HashMapCreate(&g_paramWorkSpace.workSpaceHashHandle, &info); int ret = OH_HashMapCreate(&g_paramWorkSpace.workSpaceHashHandle, &info);
PARAM_CHECK(ret == 0, return -1, "Failed to create hash map for workspace"); PARAM_CHECK(ret == 0, return -1, "Failed to create hash map for workspace");
WORKSPACE_INIT_LOCK(g_paramWorkSpace); WORKSPACE_INIT_LOCK(g_paramWorkSpace);
ListInit(&g_paramWorkSpace.workSpaceList); OH_ListInit(&g_paramWorkSpace.workSpaceList);
PARAM_SET_FLAG(g_paramWorkSpace.flags, WORKSPACE_FLAGS_INIT); PARAM_SET_FLAG(g_paramWorkSpace.flags, WORKSPACE_FLAGS_INIT);
ret = RegisterSecurityOps(onlyRead); ret = RegisterSecurityOps(onlyRead);
...@@ -173,7 +173,7 @@ INIT_INNER_API void CloseParamWorkSpace(void) ...@@ -173,7 +173,7 @@ INIT_INNER_API void CloseParamWorkSpace(void)
} }
WORKSPACE_RW_LOCK(g_paramWorkSpace); WORKSPACE_RW_LOCK(g_paramWorkSpace);
if (g_paramWorkSpace.workSpaceHashHandle != NULL) { if (g_paramWorkSpace.workSpaceHashHandle != NULL) {
HashMapDestory(g_paramWorkSpace.workSpaceHashHandle); OH_HashMapDestory(g_paramWorkSpace.workSpaceHashHandle);
g_paramWorkSpace.workSpaceHashHandle = NULL; g_paramWorkSpace.workSpaceHashHandle = NULL;
} }
WORKSPACE_RW_UNLOCK(g_paramWorkSpace); WORKSPACE_RW_UNLOCK(g_paramWorkSpace);
...@@ -198,7 +198,7 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi ...@@ -198,7 +198,7 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi
const char *realName = WORKSPACE_NAME_NORMAL; const char *realName = WORKSPACE_NAME_NORMAL;
#endif #endif
WORKSPACE_RW_LOCK(g_paramWorkSpace); WORKSPACE_RW_LOCK(g_paramWorkSpace);
HashNode *node = HashMapGet(g_paramWorkSpace.workSpaceHashHandle, (const void *)realName); HashNode *node = OH_HashMapGet(g_paramWorkSpace.workSpaceHashHandle, (const void *)realName);
if (node != NULL) { if (node != NULL) {
WORKSPACE_RW_UNLOCK(g_paramWorkSpace); WORKSPACE_RW_UNLOCK(g_paramWorkSpace);
return 0; return 0;
...@@ -212,17 +212,17 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi ...@@ -212,17 +212,17 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi
PARAM_CHECK(workSpace != NULL, break, "Failed to create workspace for %s", realName); PARAM_CHECK(workSpace != NULL, break, "Failed to create workspace for %s", realName);
workSpace->flags = 0; workSpace->flags = 0;
workSpace->area = NULL; workSpace->area = NULL;
ListInit(&workSpace->node); OH_ListInit(&workSpace->node);
ret = ParamStrCpy(workSpace->fileName, size, realName); ret = ParamStrCpy(workSpace->fileName, size, realName);
PARAM_CHECK(ret == 0, break, "Failed to copy file name %s", realName); PARAM_CHECK(ret == 0, break, "Failed to copy file name %s", realName);
HASHMAPInitNode(&workSpace->hashNode); HASHMAPInitNode(&workSpace->hashNode);
ret = InitWorkSpace(workSpace, onlyRead, spaceSize); ret = InitWorkSpace(workSpace, onlyRead, spaceSize);
PARAM_CHECK(ret == 0, break, "Failed to init workspace %s", realName); PARAM_CHECK(ret == 0, break, "Failed to init workspace %s", realName);
ret = HashMapAdd(g_paramWorkSpace.workSpaceHashHandle, &workSpace->hashNode); ret = OH_HashMapAdd(g_paramWorkSpace.workSpaceHashHandle, &workSpace->hashNode);
PARAM_CHECK(ret == 0, CloseWorkSpace(workSpace); PARAM_CHECK(ret == 0, CloseWorkSpace(workSpace);
workSpace = NULL; workSpace = NULL;
break, "Failed to add hash node"); break, "Failed to add hash node");
ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node); OH_ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node);
ret = 0; ret = 0;
workSpace = NULL; workSpace = NULL;
} while (0); } while (0);
......
...@@ -34,7 +34,7 @@ INIT_LOCAL_API WorkSpace *GetWorkSpace(const char *name) ...@@ -34,7 +34,7 @@ INIT_LOCAL_API WorkSpace *GetWorkSpace(const char *name)
#endif #endif
WorkSpace *space = NULL; WorkSpace *space = NULL;
WORKSPACE_RD_LOCK(*paramSpace); WORKSPACE_RD_LOCK(*paramSpace);
HashNode *node = HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName); HashNode *node = OH_HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName);
if (node != NULL) { if (node != NULL) {
space = HASHMAP_ENTRY(node, WorkSpace, hashNode); space = HASHMAP_ENTRY(node, WorkSpace, hashNode);
} }
...@@ -63,7 +63,7 @@ INIT_LOCAL_API ParamTrieNode *GetTrieNodeByHandle(ParamHandle handle) ...@@ -63,7 +63,7 @@ INIT_LOCAL_API ParamTrieNode *GetTrieNodeByHandle(ParamHandle handle)
int hashCode = ((handle >> 24) & 0x000000ff); // 24 left shift int hashCode = ((handle >> 24) & 0x000000ff); // 24 left shift
uint32_t index = handle & 0x00ffffff; uint32_t index = handle & 0x00ffffff;
WORKSPACE_RD_LOCK(*paramSpace); WORKSPACE_RD_LOCK(*paramSpace);
HashNode *node = HashMapFind(paramSpace->workSpaceHashHandle, hashCode, (const void *)&index, CompareIndex); HashNode *node = OH_HashMapFind(paramSpace->workSpaceHashHandle, hashCode, (const void *)&index, CompareIndex);
if (node == NULL) { if (node == NULL) {
WORKSPACE_RW_UNLOCK(*paramSpace); WORKSPACE_RW_UNLOCK(*paramSpace);
PARAM_LOGV("Failed to get workspace for 0x%x index %d hashCode %d", handle, index, hashCode); PARAM_LOGV("Failed to get workspace for 0x%x index %d hashCode %d", handle, index, hashCode);
......
...@@ -124,7 +124,7 @@ INIT_LOCAL_API void CloseWorkSpace(WorkSpace *workSpace) ...@@ -124,7 +124,7 @@ INIT_LOCAL_API void CloseWorkSpace(WorkSpace *workSpace)
free(workSpace); free(workSpace);
return; return;
} }
ListRemove(&workSpace->node); OH_ListRemove(&workSpace->node);
PARAM_CHECK(workSpace->area != NULL, return, "The workspace area is null"); PARAM_CHECK(workSpace->area != NULL, return, "The workspace area is null");
#ifdef WORKSPACE_AREA_NEED_MUTEX #ifdef WORKSPACE_AREA_NEED_MUTEX
ParamRWMutexDelete(&workSpace->rwlock); ParamRWMutexDelete(&workSpace->rwlock);
......
...@@ -240,16 +240,16 @@ static int32_t AddWatchNode(struct tagTriggerNode_ *trigger, const struct Trigge ...@@ -240,16 +240,16 @@ static int32_t AddWatchNode(struct tagTriggerNode_ *trigger, const struct Trigge
PARAM_CHECK(watcher != NULL, return -1, "Failed to get param watcher data"); PARAM_CHECK(watcher != NULL, return -1, "Failed to get param watcher data");
if (extInfo->type == TRIGGER_PARAM_WAIT) { if (extInfo->type == TRIGGER_PARAM_WAIT) {
WaitNode *node = (WaitNode *)trigger; WaitNode *node = (WaitNode *)trigger;
ListInit(&node->item); OH_ListInit(&node->item);
node->timeout = extInfo->info.waitInfo.timeout; node->timeout = extInfo->info.waitInfo.timeout;
node->stream = extInfo->stream; node->stream = extInfo->stream;
node->waitId = extInfo->info.waitInfo.waitId; node->waitId = extInfo->info.waitInfo.waitId;
ListAddTail(&watcher->triggerHead, &node->item); OH_ListAddTail(&watcher->triggerHead, &node->item);
} else { } else {
WatchNode *node = (WatchNode *)trigger; WatchNode *node = (WatchNode *)trigger;
ListInit(&node->item); OH_ListInit(&node->item);
node->watchId = extInfo->info.watchInfo.watchId; node->watchId = extInfo->info.watchInfo.watchId;
ListAddTail(&watcher->triggerHead, &node->item); OH_ListAddTail(&watcher->triggerHead, &node->item);
} }
return 0; return 0;
} }
...@@ -401,7 +401,7 @@ PARAM_STATIC int OnIncomingConnect(LoopHandle loop, TaskHandle server) ...@@ -401,7 +401,7 @@ PARAM_STATIC int OnIncomingConnect(LoopHandle loop, TaskHandle server)
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != NULL, return -1, "Failed to get watcher"); PARAM_CHECK(watcher != NULL, return -1, "Failed to get watcher");
ListInit(&watcher->triggerHead); OH_ListInit(&watcher->triggerHead);
watcher->stream = client; watcher->stream = client;
#ifdef STARTUP_INIT_TEST #ifdef STARTUP_INIT_TEST
g_paramService.watcherTask = client; g_paramService.watcherTask = client;
......
...@@ -93,8 +93,8 @@ static TriggerNode *AddTriggerNode_(TriggerHeader *triggerHead, ...@@ -93,8 +93,8 @@ static TriggerNode *AddTriggerNode_(TriggerHeader *triggerHead,
return NULL, "Failed to copy conditition"); return NULL, "Failed to copy conditition");
node->type = type; node->type = type;
node->flags = 0; node->flags = 0;
ListInit(&node->node); OH_ListInit(&node->node);
ListAddTail(&triggerHead->triggerList, &node->node); OH_ListAddTail(&triggerHead->triggerList, &node->node);
triggerHead->triggerCount++; triggerHead->triggerCount++;
return node; return node;
} }
...@@ -106,7 +106,7 @@ static int32_t AddJobNode_(TriggerNode *trigger, const TriggerExtInfo *extInfo) ...@@ -106,7 +106,7 @@ static int32_t AddJobNode_(TriggerNode *trigger, const TriggerExtInfo *extInfo)
PARAM_CHECK(ret == EOK, return -1, "Failed to copy name for trigger"); PARAM_CHECK(ret == EOK, return -1, "Failed to copy name for trigger");
node->firstCmd = NULL; node->firstCmd = NULL;
node->lastCmd = NULL; node->lastCmd = NULL;
ret = HashMapAdd(GetTriggerWorkSpace()->hashMap, &node->hashNode); ret = OH_HashMapAdd(GetTriggerWorkSpace()->hashMap, &node->hashNode);
PARAM_CHECK(ret == 0, return -1, "Failed to add hash node"); PARAM_CHECK(ret == 0, return -1, "Failed to add hash node");
return 0; return 0;
} }
...@@ -153,9 +153,9 @@ static void DelJobTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *trigg ...@@ -153,9 +153,9 @@ static void DelJobTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *trigg
} }
jobNode->lastCmd = NULL; jobNode->lastCmd = NULL;
jobNode->firstCmd = NULL; jobNode->firstCmd = NULL;
ListRemove(&trigger->node); OH_ListRemove(&trigger->node);
triggerHead->triggerCount--; triggerHead->triggerCount--;
HashMapRemove(workSpace->hashMap, jobNode->name); OH_HashMapRemove(workSpace->hashMap, jobNode->name);
if (!TRIGGER_IN_QUEUE(trigger)) { if (!TRIGGER_IN_QUEUE(trigger)) {
free(jobNode); free(jobNode);
...@@ -203,13 +203,13 @@ static void DelWatchTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *tri ...@@ -203,13 +203,13 @@ static void DelWatchTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *tri
PARAM_CHECK(workSpace != NULL, return, "Param is null"); PARAM_CHECK(workSpace != NULL, return, "Param is null");
TriggerHeader *triggerHead = GetTriggerHeader(workSpace, trigger->type); TriggerHeader *triggerHead = GetTriggerHeader(workSpace, trigger->type);
PARAM_CHECK(triggerHead != NULL, return, "Failed to get header %d", trigger->type); PARAM_CHECK(triggerHead != NULL, return, "Failed to get header %d", trigger->type);
ListRemove(&trigger->node); OH_ListRemove(&trigger->node);
if (trigger->type == TRIGGER_PARAM_WAIT) { if (trigger->type == TRIGGER_PARAM_WAIT) {
WaitNode *node = (WaitNode *)trigger; WaitNode *node = (WaitNode *)trigger;
ListRemove(&node->item); OH_ListRemove(&node->item);
} else if (trigger->type == TRIGGER_PARAM_WATCH) { } else if (trigger->type == TRIGGER_PARAM_WATCH) {
WatchNode *node = (WatchNode *)trigger; WatchNode *node = (WatchNode *)trigger;
ListRemove(&node->item); OH_ListRemove(&node->item);
} }
PARAM_LOGV("DelWatchTrigger_ %s count %d", GetTriggerName(trigger), triggerHead->triggerCount); PARAM_LOGV("DelWatchTrigger_ %s count %d", GetTriggerName(trigger), triggerHead->triggerCount);
triggerHead->triggerCount--; triggerHead->triggerCount--;
...@@ -285,7 +285,7 @@ JobNode *UpdateJobTrigger(const TriggerWorkSpace *workSpace, ...@@ -285,7 +285,7 @@ JobNode *UpdateJobTrigger(const TriggerWorkSpace *workSpace,
JobNode *GetTriggerByName(const TriggerWorkSpace *workSpace, const char *triggerName) JobNode *GetTriggerByName(const TriggerWorkSpace *workSpace, const char *triggerName)
{ {
PARAM_CHECK(workSpace != NULL && triggerName != NULL, return NULL, "Invalid param"); PARAM_CHECK(workSpace != NULL && triggerName != NULL, return NULL, "Invalid param");
HashNode *node = HashMapGet(workSpace->hashMap, triggerName); HashNode *node = OH_HashMapGet(workSpace->hashMap, triggerName);
if (node == NULL) { if (node == NULL) {
return NULL; return NULL;
} }
...@@ -313,7 +313,7 @@ void ClearTrigger(const TriggerWorkSpace *workSpace, int8_t type) ...@@ -313,7 +313,7 @@ void ClearTrigger(const TriggerWorkSpace *workSpace, int8_t type)
FreeTrigger(workSpace, trigger); FreeTrigger(workSpace, trigger);
trigger = next; trigger = next;
} }
ListInit(&head->triggerList); OH_ListInit(&head->triggerList);
} }
int ExecuteQueuePush(TriggerWorkSpace *workSpace, const TriggerNode *trigger) int ExecuteQueuePush(TriggerWorkSpace *workSpace, const TriggerNode *trigger)
...@@ -565,7 +565,7 @@ static int32_t CompareData_(const struct tagTriggerNode_ *trigger, const void *d ...@@ -565,7 +565,7 @@ static int32_t CompareData_(const struct tagTriggerNode_ *trigger, const void *d
static void TriggerHeadSetDefault(TriggerHeader *head) static void TriggerHeadSetDefault(TriggerHeader *head)
{ {
ListInit(&head->triggerList); OH_ListInit(&head->triggerList);
head->triggerCount = 0; head->triggerCount = 0;
head->cmdNodeCount = 0; head->cmdNodeCount = 0;
head->addTrigger = AddJobTrigger_; head->addTrigger = AddJobTrigger_;
...@@ -633,7 +633,7 @@ void InitTriggerHead(const TriggerWorkSpace *workSpace) ...@@ -633,7 +633,7 @@ void InitTriggerHead(const TriggerWorkSpace *workSpace)
64 64
}; };
PARAM_CHECK(workSpace != NULL, return, "Invalid workSpace"); PARAM_CHECK(workSpace != NULL, return, "Invalid workSpace");
int ret = HashMapCreate((HashMapHandle *)&workSpace->hashMap, &info); int ret = OH_HashMapCreate((HashMapHandle *)&workSpace->hashMap, &info);
PARAM_CHECK(ret == 0, return, "Failed to create hash map"); PARAM_CHECK(ret == 0, return, "Failed to create hash map");
TriggerHeader *head = (TriggerHeader *)&workSpace->triggerHead[TRIGGER_BOOT]; TriggerHeader *head = (TriggerHeader *)&workSpace->triggerHead[TRIGGER_BOOT];
......
...@@ -173,7 +173,7 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP ...@@ -173,7 +173,7 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP
std::lock_guard<std::mutex> lock(watcherMutex_); std::lock_guard<std::mutex> lock(watcherMutex_);
groupMap_[keyPrefix] = groupId; groupMap_[keyPrefix] = groupId;
watchers_[watcher->GetWatcherId()] = watcher; watchers_[watcher->GetWatcherId()] = watcher;
ListAddTail(group->GetWatchers(), watcher->GetGroupNode()); OH_ListAddTail(group->GetWatchers(), watcher->GetGroupNode());
if (watcherGroups_.find(groupId) != watcherGroups_.end()) { if (watcherGroups_.find(groupId) != watcherGroups_.end()) {
return; return;
...@@ -184,8 +184,8 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP ...@@ -184,8 +184,8 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP
void WatcherManager::DelParamWatcher(ParamWatcherPtr watcher) void WatcherManager::DelParamWatcher(ParamWatcherPtr watcher)
{ {
std::lock_guard<std::mutex> lock(watcherMutex_); std::lock_guard<std::mutex> lock(watcherMutex_);
ListRemove(watcher->GetGroupNode()); OH_ListRemove(watcher->GetGroupNode());
ListInit(watcher->GetGroupNode()); OH_ListInit(watcher->GetGroupNode());
watchers_.erase(watcher->GetWatcherId()); watchers_.erase(watcher->GetWatcherId());
WATCHER_LOGV("DelParamWatcher watcherId %u", watcher->GetWatcherId()); WATCHER_LOGV("DelParamWatcher watcherId %u", watcher->GetWatcherId());
} }
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
ParamWatcher(uint32_t watcherId, const sptr<IWatcher> &watcher, const WatcherGroupPtr &group) ParamWatcher(uint32_t watcherId, const sptr<IWatcher> &watcher, const WatcherGroupPtr &group)
: watcherId_(watcherId), watcher_(watcher), group_(group) : watcherId_(watcherId), watcher_(watcher), group_(group)
{ {
ListInit(&groupNode_); OH_ListInit(&groupNode_);
} }
~ParamWatcher() = default; ~ParamWatcher() = default;
...@@ -104,7 +104,7 @@ public: ...@@ -104,7 +104,7 @@ public:
public: public:
WatcherGroup(uint32_t groupId, const std::string &key) : groupId_(groupId), keyPrefix_(key) WatcherGroup(uint32_t groupId, const std::string &key) : groupId_(groupId), keyPrefix_(key)
{ {
ListInit(&watchers_); OH_ListInit(&watchers_);
} }
~WatcherGroup() = default; ~WatcherGroup() = default;
void AddWatcher(const ParamWatcherPtr &watcher); void AddWatcher(const ParamWatcherPtr &watcher);
......
...@@ -27,7 +27,7 @@ typedef struct { ...@@ -27,7 +27,7 @@ typedef struct {
} HashTab; } HashTab;
static uint32_t g_tableId = 0; static uint32_t g_tableId = 0;
int32_t HashMapCreate(HashMapHandle *handle, const HashInfo *info) int32_t OH_HashMapCreate(HashMapHandle *handle, const HashInfo *info)
{ {
INIT_ERROR_CHECK(handle != NULL && info != NULL && info->maxBucket > 0, return -1, "Invalid param"); INIT_ERROR_CHECK(handle != NULL && info != NULL && info->maxBucket > 0, return -1, "Invalid param");
INIT_ERROR_CHECK(info->keyHash != NULL && info->nodeHash != NULL, return -1, "Invalid param"); INIT_ERROR_CHECK(info->keyHash != NULL && info->nodeHash != NULL, return -1, "Invalid param");
...@@ -71,7 +71,7 @@ static HashNode *GetHashNodeByKey(const HashTab *tab, const HashNode *root, cons ...@@ -71,7 +71,7 @@ static HashNode *GetHashNodeByKey(const HashTab *tab, const HashNode *root, cons
return NULL; return NULL;
} }
int32_t HashMapAdd(HashMapHandle handle, HashNode *node) int32_t OH_HashMapAdd(HashMapHandle handle, HashNode *node)
{ {
INIT_ERROR_CHECK(handle != NULL, return -1, "Invalid param"); INIT_ERROR_CHECK(handle != NULL, return -1, "Invalid param");
INIT_ERROR_CHECK(node != NULL && node->next == NULL, return -1, "Invalid param"); INIT_ERROR_CHECK(node != NULL && node->next == NULL, return -1, "Invalid param");
...@@ -89,11 +89,11 @@ int32_t HashMapAdd(HashMapHandle handle, HashNode *node) ...@@ -89,11 +89,11 @@ int32_t HashMapAdd(HashMapHandle handle, HashNode *node)
} }
node->next = tab->buckets[hashCode]; node->next = tab->buckets[hashCode];
tab->buckets[hashCode] = node; tab->buckets[hashCode] = node;
INIT_LOGV("HashMapAdd tableId %d hashCode %d node %p", tab->tableId, hashCode, node); INIT_LOGV("OH_HashMapAdd tableId %d hashCode %d node %p", tab->tableId, hashCode, node);
return 0; return 0;
} }
void HashMapRemove(HashMapHandle handle, const void *key) void OH_HashMapRemove(HashMapHandle handle, const void *key)
{ {
INIT_ERROR_CHECK(handle != NULL && key != NULL, return, "Invalid param"); INIT_ERROR_CHECK(handle != NULL && key != NULL, return, "Invalid param");
HashTab *tab = (HashTab *)handle; HashTab *tab = (HashTab *)handle;
...@@ -119,7 +119,7 @@ void HashMapRemove(HashMapHandle handle, const void *key) ...@@ -119,7 +119,7 @@ void HashMapRemove(HashMapHandle handle, const void *key)
} }
} }
HashNode *HashMapGet(HashMapHandle handle, const void *key) HashNode *OH_HashMapGet(HashMapHandle handle, const void *key)
{ {
INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param %s", key); INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param %s", key);
HashTab *tab = (HashTab *)handle; HashTab *tab = (HashTab *)handle;
...@@ -146,7 +146,7 @@ static void HashListFree(HashTab *tab, HashNode *root) ...@@ -146,7 +146,7 @@ static void HashListFree(HashTab *tab, HashNode *root)
} }
} }
void HashMapDestory(HashMapHandle handle) void OH_HashMapDestory(HashMapHandle handle)
{ {
INIT_ERROR_CHECK(handle != NULL, return, "Invalid param"); INIT_ERROR_CHECK(handle != NULL, return, "Invalid param");
HashTab *tab = (HashTab *)handle; HashTab *tab = (HashTab *)handle;
...@@ -156,7 +156,7 @@ void HashMapDestory(HashMapHandle handle) ...@@ -156,7 +156,7 @@ void HashMapDestory(HashMapHandle handle)
free(tab); free(tab);
} }
HashNode *HashMapFind(HashMapHandle handle, HashNode *OH_HashMapFind(HashMapHandle handle,
int hashCode, const void *key, HashKeyCompare keyCompare) int hashCode, const void *key, HashKeyCompare keyCompare)
{ {
INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param"); INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param");
...@@ -167,7 +167,7 @@ HashNode *HashMapFind(HashMapHandle handle, ...@@ -167,7 +167,7 @@ HashNode *HashMapFind(HashMapHandle handle,
return GetHashNodeByKey(tab, tab->buckets[hashCode], key, keyCompare); return GetHashNodeByKey(tab, tab->buckets[hashCode], key, keyCompare);
} }
void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context), void OH_HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
const void *context) const void *context)
{ {
INIT_ERROR_CHECK(handle != NULL && hashNodeTraverse != NULL, return, "Invalid param"); INIT_ERROR_CHECK(handle != NULL && hashNodeTraverse != NULL, return, "Invalid param");
...@@ -182,7 +182,7 @@ void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNo ...@@ -182,7 +182,7 @@ void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNo
} }
} }
int HashMapIsEmpty(HashMapHandle handle) int OH_HashMapIsEmpty(HashMapHandle handle)
{ {
INIT_ERROR_CHECK(handle != NULL, return 1, "Invalid param"); INIT_ERROR_CHECK(handle != NULL, return 1, "Invalid param");
HashTab *tab = (HashTab *)handle; HashTab *tab = (HashTab *)handle;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* @param head list head, make sure head is valid pointer * @param head list head, make sure head is valid pointer
* @return None * @return None
*/ */
void ListInit(struct ListNode *node) void OH_ListInit(struct ListNode *node)
{ {
if (node == NULL) { if (node == NULL) {
return; return;
...@@ -43,7 +43,7 @@ void ListInit(struct ListNode *node) ...@@ -43,7 +43,7 @@ void ListInit(struct ListNode *node)
* @param item new node to be added * @param item new node to be added
* @return None * @return None
*/ */
void ListAddTail(struct ListNode *head, struct ListNode *item) void OH_ListAddTail(struct ListNode *head, struct ListNode *item)
{ {
if (head == NULL || item == NULL) { if (head == NULL || item == NULL) {
return; return;
...@@ -61,7 +61,7 @@ void ListAddTail(struct ListNode *head, struct ListNode *item) ...@@ -61,7 +61,7 @@ void ListAddTail(struct ListNode *head, struct ListNode *item)
* This function does not free any memory within item. * This function does not free any memory within item.
* @return None * @return None
*/ */
void ListRemove(struct ListNode *item) void OH_ListRemove(struct ListNode *item)
{ {
if (item == NULL) { if (item == NULL) {
return; return;
...@@ -81,7 +81,7 @@ void ListRemove(struct ListNode *item) ...@@ -81,7 +81,7 @@ void ListRemove(struct ListNode *item)
* respectively less than, equal to, or greater than the second. * respectively less than, equal to, or greater than the second.
* @return None * @return None
*/ */
void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc) void OH_ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc)
{ {
ListNode *match; ListNode *match;
int ret; int ret;
...@@ -117,7 +117,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP ...@@ -117,7 +117,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP
* @param compareProc comparing function, return 0 if matched. * @param compareProc comparing function, return 0 if matched.
* @return the found node; return NULL if none is found. * @return the found node; return NULL if none is found.
*/ */
ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc compareProc) ListNode *OH_ListFind(const ListNode *head, void *data, ListTraversalProc compareProc)
{ {
ListNode *match; ListNode *match;
if ((head == NULL) || (compareProc == NULL)) { if ((head == NULL) || (compareProc == NULL)) {
...@@ -152,7 +152,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr ...@@ -152,7 +152,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @return return -1 for invalid input arguments. * @return return -1 for invalid input arguments.
* when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc * when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc
*/ */
int ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags) int OH_ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags)
{ {
int ret; int ret;
ListNode *match; ListNode *match;
...@@ -203,14 +203,14 @@ static int listDestroyTraversal(ListNode *node, void *data) ...@@ -203,14 +203,14 @@ static int listDestroyTraversal(ListNode *node, void *data)
* @param destroyProc destroy function; if NULL, it will free each node by default. * @param destroyProc destroy function; if NULL, it will free each node by default.
* @return None * @return None
*/ */
void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc) void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc)
{ {
if (head == NULL) { if (head == NULL) {
return; return;
} }
ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0); OH_ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0);
ListInit(head); OH_ListInit(head);
} }
/** /**
...@@ -219,7 +219,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc) ...@@ -219,7 +219,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc)
* @param head list head, make sure head is valid pointer. * @param head list head, make sure head is valid pointer.
* @return the count of nodes in the list; return 0 if error * @return the count of nodes in the list; return 0 if error
*/ */
int ListGetCnt(const ListNode *head) int OH_ListGetCnt(const ListNode *head)
{ {
int cnt; int cnt;
ListNode *node; ListNode *node;
......
...@@ -108,54 +108,54 @@ HashInfo g_info = { ...@@ -108,54 +108,54 @@ HashInfo g_info = {
HWTEST_F(InitGroupManagerUnitTest, TestHashMap, TestSize.Level1) HWTEST_F(InitGroupManagerUnitTest, TestHashMap, TestSize.Level1)
{ {
HashMapHandle handle; HashMapHandle handle;
HashMapCreate(&handle, &g_info); OH_HashMapCreate(&handle, &g_info);
const char *str1 = "Test hash map node 1"; const char *str1 = "Test hash map node 1";
const char *str2 = "Test hash map node 2"; const char *str2 = "Test hash map node 2";
const char *str3 = "Test hash map node 3"; const char *str3 = "Test hash map node 3";
TestHashNode *node1 = TestCreateHashNode(str1); TestHashNode *node1 = TestCreateHashNode(str1);
TestHashNode *node2 = TestCreateHashNode(str2); TestHashNode *node2 = TestCreateHashNode(str2);
HashMapAdd(handle, &node1->node); OH_HashMapAdd(handle, &node1->node);
HashMapAdd(handle, &node2->node); OH_HashMapAdd(handle, &node2->node);
HashNode *node = HashMapGet(handle, (const void *)str1); HashNode *node = OH_HashMapGet(handle, (const void *)str1);
EXPECT_NE(node != nullptr, 0); EXPECT_NE(node != nullptr, 0);
if (node) { if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str1), 0); EXPECT_EQ(strcmp(tmp->name, str1), 0);
} }
node = HashMapGet(handle, (const void *)str2); node = OH_HashMapGet(handle, (const void *)str2);
EXPECT_NE(node != nullptr, 0); EXPECT_NE(node != nullptr, 0);
if (node) { if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str2), 0); EXPECT_EQ(strcmp(tmp->name, str2), 0);
} }
TestHashNode *node3 = TestCreateHashNode(str3); TestHashNode *node3 = TestCreateHashNode(str3);
HashMapAdd(handle, &node3->node); OH_HashMapAdd(handle, &node3->node);
node3 = TestCreateHashNode("Test hash map node 4"); node3 = TestCreateHashNode("Test hash map node 4");
HashMapAdd(handle, &node3->node); OH_HashMapAdd(handle, &node3->node);
node3 = TestCreateHashNode("Test hash map node 5"); node3 = TestCreateHashNode("Test hash map node 5");
HashMapAdd(handle, &node3->node); OH_HashMapAdd(handle, &node3->node);
node = HashMapGet(handle, (const void *)str3); node = OH_HashMapGet(handle, (const void *)str3);
EXPECT_NE(node != nullptr, 0); EXPECT_NE(node != nullptr, 0);
if (node) { if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str3), 0); EXPECT_EQ(strcmp(tmp->name, str3), 0);
} }
TestHashNode *node4 = TestCreateHashNode("pre-init"); TestHashNode *node4 = TestCreateHashNode("pre-init");
HashMapAdd(handle, &node4->node); OH_HashMapAdd(handle, &node4->node);
const char *act = "load_persist_props_action"; const char *act = "load_persist_props_action";
TestHashNode *node5 = TestCreateHashNode(act); TestHashNode *node5 = TestCreateHashNode(act);
HashMapAdd(handle, &node5->node); OH_HashMapAdd(handle, &node5->node);
HashMapRemove(handle, "pre-init"); OH_HashMapRemove(handle, "pre-init");
node = HashMapGet(handle, (const void *)act); node = OH_HashMapGet(handle, (const void *)act);
EXPECT_NE(node != nullptr, 0); EXPECT_NE(node != nullptr, 0);
if (node) { if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, act), 0); EXPECT_EQ(strcmp(tmp->name, act), 0);
} }
HashMapIsEmpty(handle); OH_HashMapIsEmpty(handle);
HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr); OH_HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr);
HashMapDestory(handle); OH_HashMapDestory(handle);
} }
HWTEST_F(InitGroupManagerUnitTest, TestInitGroupMgrInit, TestSize.Level1) HWTEST_F(InitGroupManagerUnitTest, TestInitGroupMgrInit, TestSize.Level1)
......
...@@ -194,7 +194,7 @@ public: ...@@ -194,7 +194,7 @@ public:
EXPECT_EQ(GetNextBuffer((StreamTask *)client, next), nullptr); EXPECT_EQ(GetNextBuffer((StreamTask *)client, next), nullptr);
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != nullptr, return, "Failed to get watcher"); PARAM_CHECK(watcher != nullptr, return, "Failed to get watcher");
ListInit(&watcher->triggerHead); OH_ListInit(&watcher->triggerHead);
OnClose(client); OnClose(client);
LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)client, nullptr); LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)client, nullptr);
return; return;
......
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
}; };
HWTEST_F(ServiceUnitTest, TestDestoryHashMap, TestSize.Level1) HWTEST_F(ServiceUnitTest, TestDestoryHashMap, TestSize.Level1)
{ {
HashMapDestory(GetInitWorkspace()->hashMap[0]); OH_HashMapDestory(GetInitWorkspace()->hashMap[0]);
} }
HWTEST_F(ServiceUnitTest, case01, TestSize.Level1) HWTEST_F(ServiceUnitTest, case01, TestSize.Level1)
{ {
......
...@@ -313,7 +313,7 @@ public: ...@@ -313,7 +313,7 @@ public:
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != NULL, return NULL, "Failed to get watcher"); PARAM_CHECK(watcher != NULL, return NULL, "Failed to get watcher");
ListInit(&watcher->triggerHead); OH_ListInit(&watcher->triggerHead);
watcher->stream = client; watcher->stream = client;
GetParamService()->watcherTask = client; GetParamService()->watcherTask = client;
return GetParamService()->watcherTask; return GetParamService()->watcherTask;
......
...@@ -470,7 +470,7 @@ public: ...@@ -470,7 +470,7 @@ public:
{ {
RegisterBootStateChange(BootStateChange); RegisterBootStateChange(BootStateChange);
(void)AddCompleteJob("param:ohos.servicectrl.display", "ohos.servicectrl.display=*", "display system"); (void)AddCompleteJob("param:ohos.servicectrl.display", "ohos.servicectrl.display=*", "display system");
HashMapDestory(GetTriggerWorkSpace()->hashMap); OH_HashMapDestory(GetTriggerWorkSpace()->hashMap);
return 0; return 0;
} }
}; };
......
...@@ -54,8 +54,8 @@ static struct DeviceUdevConf *GetFristParameter(DeviceParameterCtrl *parameterCt ...@@ -54,8 +54,8 @@ static struct DeviceUdevConf *GetFristParameter(DeviceParameterCtrl *parameterCt
pthread_mutex_lock(&(parameterCtrl->parameterLock)); pthread_mutex_lock(&(parameterCtrl->parameterLock));
if (!ListEmpty(parameterCtrl->parameterList)) { if (!ListEmpty(parameterCtrl->parameterList)) {
conf = ListEntry(parameterCtrl->parameterList.next, struct DeviceUdevConf, paramNode); conf = ListEntry(parameterCtrl->parameterList.next, struct DeviceUdevConf, paramNode);
ListRemove(&conf->paramNode); OH_ListRemove(&conf->paramNode);
ListInit(&conf->paramNode); OH_ListInit(&conf->paramNode);
} }
pthread_mutex_unlock(&(parameterCtrl->parameterLock)); pthread_mutex_unlock(&(parameterCtrl->parameterLock));
return conf; return conf;
...@@ -93,7 +93,7 @@ static void *ThreadRun(void *data) ...@@ -93,7 +93,7 @@ static void *ThreadRun(void *data)
if (SystemSetParameter(config->parameter, paramValue) != 0) { if (SystemSetParameter(config->parameter, paramValue) != 0) {
INIT_LOGE("[uevent] SystemSetParameter %s failed", config->parameter); INIT_LOGE("[uevent] SystemSetParameter %s failed", config->parameter);
pthread_mutex_lock(&(parameterCtrl->parameterLock)); pthread_mutex_lock(&(parameterCtrl->parameterLock));
ListAddTail(&parameterCtrl->parameterList, &config->paramNode); OH_ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
pthread_mutex_unlock(&(parameterCtrl->parameterLock)); pthread_mutex_unlock(&(parameterCtrl->parameterLock));
parameterCtrl->empty = 1; parameterCtrl->empty = 1;
} }
...@@ -105,7 +105,7 @@ static void AddParameter(DeviceParameterCtrl *parameterCtrl, struct DeviceUdevCo ...@@ -105,7 +105,7 @@ static void AddParameter(DeviceParameterCtrl *parameterCtrl, struct DeviceUdevCo
{ {
pthread_mutex_lock(&(parameterCtrl->parameterLock)); pthread_mutex_lock(&(parameterCtrl->parameterLock));
if (ListEmpty(config->paramNode)) { if (ListEmpty(config->paramNode)) {
ListAddTail(&parameterCtrl->parameterList, &config->paramNode); OH_ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
} }
pthread_mutex_unlock(&(parameterCtrl->parameterLock)); pthread_mutex_unlock(&(parameterCtrl->parameterLock));
if (parameterCtrl->threadId == 0) { if (parameterCtrl->threadId == 0) {
......
...@@ -108,8 +108,8 @@ static int ParseDeviceConfig(char *p) ...@@ -108,8 +108,8 @@ static int ParseDeviceConfig(char *p)
} else { } else {
config->parameter = NULL; config->parameter = NULL;
} }
ListInit(&config->paramNode); OH_ListInit(&config->paramNode);
ListAddTail(&g_devices, &config->list); OH_ListAddTail(&g_devices, &config->list);
FreeStringVector(items, count); FreeStringVector(items, count);
return 0; return 0;
} }
...@@ -143,7 +143,7 @@ static int ParseSysfsConfig(char *p) ...@@ -143,7 +143,7 @@ static int ParseSysfsConfig(char *p)
"Invalid mode in config file for sys path %s. use default mode", config->sysPath); "Invalid mode in config file for sys path %s. use default mode", config->sysPath);
config->uid = (uid_t)DecodeUid(items[SYS_CONFIG_UID_NUM]); config->uid = (uid_t)DecodeUid(items[SYS_CONFIG_UID_NUM]);
config->gid = (gid_t)DecodeGid(items[SYS_CONFIG_GID_NUM]); config->gid = (gid_t)DecodeGid(items[SYS_CONFIG_GID_NUM]);
ListAddTail(&g_sysDevices, &config->list); OH_ListAddTail(&g_sysDevices, &config->list);
FreeStringVector(items, count); FreeStringVector(items, count);
return 0; return 0;
} }
...@@ -161,7 +161,7 @@ static int ParseFirmwareConfig(char *p) ...@@ -161,7 +161,7 @@ static int ParseFirmwareConfig(char *p)
INIT_CHECK(config != NULL, errno = ENOMEM; INIT_CHECK(config != NULL, errno = ENOMEM;
return -1); return -1);
config->fmPath = strdup(p); config->fmPath = strdup(p);
ListAddTail(&g_firmwares, &config->list); OH_ListAddTail(&g_firmwares, &config->list);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册