diff --git a/interfaces/innerkits/fs_manager/fstab.c b/interfaces/innerkits/fs_manager/fstab.c index c776f0c53c4ac8abf25df17f7cf2535591ba5e87..af9a6180f5b759db6533137e1831f217f5ace544 100644 --- a/interfaces/innerkits/fs_manager/fstab.c +++ b/interfaces/innerkits/fs_manager/fstab.c @@ -45,7 +45,7 @@ struct MountFlags { unsigned long flags; }; -unsigned int ConvertFlags(char *flagBuffer) +static unsigned int ConvertFlags(char *flagBuffer) { static struct FsManagerFlags fsFlags[] = { {"check", FS_MANAGER_CHECK}, diff --git a/interfaces/innerkits/fs_manager/fstab_mount.c b/interfaces/innerkits/fs_manager/fstab_mount.c index a7117ae369712543bcd3dffaaceb2cd4434de56b..cc284994b703f68864c72870d3691c98dab89f1b 100644 --- a/interfaces/innerkits/fs_manager/fstab_mount.c +++ b/interfaces/innerkits/fs_manager/fstab_mount.c @@ -333,7 +333,7 @@ int MountOneItem(FstabItem *item) return rc; } -int CheckRequiredAndMount(FstabItem *item, bool required) +static int CheckRequiredAndMount(FstabItem *item, bool required) { int rc = 0; if (item == NULL) { diff --git a/interfaces/innerkits/hookmgr/hookmgr.c b/interfaces/innerkits/hookmgr/hookmgr.c index 9233ab4e419a64d2db13cf0e2253df6cd8ae8751..42a89768d6d0986f09b6700415475294b09e8b44 100644 --- a/interfaces/innerkits/hookmgr/hookmgr.c +++ b/interfaces/innerkits/hookmgr/hookmgr.c @@ -85,7 +85,7 @@ static void hookStageDestroy(ListNode *node) BEGET_CHECK(node != NULL, return); stage = (HOOK_STAGE *)node; - ListRemoveAll(&(stage->hooks), NULL); + OH_ListRemoveAll(&(stage->hooks), NULL); free((void *)stage); } @@ -94,7 +94,7 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou { 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(createIfNotFound, return NULL); @@ -103,8 +103,8 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou stageItem = (HOOK_STAGE *)malloc(sizeof(HOOK_STAGE)); BEGET_CHECK(stageItem != NULL, return NULL); stageItem->stage = stage; - ListInit(&(stageItem->hooks)); - ListAddTail(&(hookMgr->stages), (ListNode *)stageItem); + OH_ListInit(&(stageItem->hooks)); + OH_ListAddTail(&(hookMgr->stages), (ListNode *)stageItem); return stageItem; } @@ -143,7 +143,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void * // Check if exists compareVal.prio = prio; 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); // Create new item @@ -156,7 +156,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void * hookItem->stage = hookStage; // Insert with order - ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare); + OH_ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare); return 0; } @@ -196,7 +196,7 @@ static int hookTraversalDelProc(ListNode *node, void *cookie) BEGET_CHECK((void *)hookItem->info.hook == cookie, return 0); // Remove from the list - ListRemove(node); + OH_ListRemove(node); // Destroy myself free((void *)node); @@ -220,12 +220,12 @@ void HookMgrDel(HOOK_MGR *hookMgr, int stage, OhosHook hook) BEGET_CHECK(stageItem != NULL, return); if (hook != NULL) { - ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0); + OH_ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0); return; } // Remove from list - ListRemove((ListNode *)stageItem); + OH_ListRemove((ListNode *)stageItem); // Destroy stage item hookStageDestroy((ListNode *)stageItem); @@ -279,8 +279,7 @@ int HookMgrExecute(HOOK_MGR *hookMgr, int stage, void *executionContext, const H args.options = options; // Traversal all hooks in the specified stage - return ListTraversal(&(stageItem->hooks), (void *)(&args), - hookExecutionProc, flags); + return OH_ListTraversal(&(stageItem->hooks), (void *)(&args), hookExecutionProc, flags); } HOOK_MGR *HookMgrCreate(const char *name) @@ -296,7 +295,7 @@ HOOK_MGR *HookMgrCreate(const char *name) free((void *)ret); return NULL; } - ListInit(&(ret->stages)); + OH_ListInit(&(ret->stages)); return ret; } @@ -305,7 +304,7 @@ void HookMgrDestroy(HOOK_MGR *hookMgr) hookMgr = getHookMgr(hookMgr, 0); BEGET_CHECK(hookMgr != NULL, return); - ListRemoveAll(&(hookMgr->stages), hookStageDestroy); + OH_ListRemoveAll(&(hookMgr->stages), hookStageDestroy); if (hookMgr == defaultHookMgr) { defaultHookMgr = NULL; @@ -336,7 +335,7 @@ static int hookItemTraversal(ListNode *node, void *data) static int hookStageTraversal(ListNode *node, void *data) { HOOK_STAGE *stageItem = (HOOK_STAGE *)node; - ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0); + OH_ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0); return 0; } @@ -355,7 +354,7 @@ void HookMgrTraversal(HOOK_MGR *hookMgr, void *traversalCookie, OhosHookTraversa // Prepare common args stageArgs.traversalCookie = traversalCookie; 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) stageItem = getHookStage(hookMgr, stage, false); BEGET_CHECK(stageItem != NULL, return 0); - return ListGetCnt(&(stageItem->hooks)); + return OH_ListGetCnt(&(stageItem->hooks)); } /* @@ -383,5 +382,5 @@ int HookMgrGetStagesCnt(HOOK_MGR *hookMgr) hookMgr = getHookMgr(hookMgr, 0); BEGET_CHECK(hookMgr != NULL, return 0); - return ListGetCnt(&(hookMgr->stages)); + return OH_ListGetCnt(&(hookMgr->stages)); } diff --git a/interfaces/innerkits/modulemgr/modulemgr.c b/interfaces/innerkits/modulemgr/modulemgr.c index b07c33001abf2ace9aae082cdef2d434c4dddd92..ec1a4e903ce1d5b5cd5c92c9e6da5a8a67664fe4 100644 --- a/interfaces/innerkits/modulemgr/modulemgr.c +++ b/interfaces/innerkits/modulemgr/modulemgr.c @@ -48,7 +48,7 @@ MODULE_MGR *ModuleMgrCreate(const char *name) moduleMgr = (MODULE_MGR *)malloc(sizeof(MODULE_MGR)); BEGET_CHECK(moduleMgr != NULL, return NULL); - ListInit(&(moduleMgr->modules)); + OH_ListInit(&(moduleMgr->modules)); moduleMgr->name = strdup(name); if (moduleMgr->name == NULL) { free((void *)moduleMgr); @@ -154,7 +154,7 @@ int ModuleMgrInstall(MODULE_MGR *moduleMgr, const char *moduleName, } // Add to list - ListAddTail(&(moduleMgr->modules), (ListNode *)module); + OH_ListAddTail(&(moduleMgr->modules), (ListNode *)module); return 0; } @@ -252,16 +252,16 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name) BEGET_CHECK(moduleMgr != NULL, return); // Uninstall all modules if no name specified if (name == NULL) { - ListRemoveAll(&(moduleMgr->modules), moduleDestroy); + OH_ListRemoveAll(&(moduleMgr->modules), moduleDestroy); return; } BEGET_LOGV("ModuleMgrUninstall moduleName %s", 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); // Remove from the list - ListRemove((ListNode *)module); + OH_ListRemove((ListNode *)module); // Destroy the module moduleDestroy((ListNode *)module); } @@ -269,7 +269,7 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name) int ModuleMgrGetCnt(const MODULE_MGR *moduleMgr) { BEGET_CHECK(moduleMgr != NULL, return 0); - return ListGetCnt(&(moduleMgr->modules)); + return OH_ListGetCnt(&(moduleMgr->modules)); } typedef struct tagMODULE_TRAVERSAL_ARGS { @@ -312,5 +312,5 @@ void ModuleMgrTraversal(const MODULE_MGR *moduleMgr, void *cookie, OhosModuleTra args.cookie = cookie; args.traversal = traversal; - ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0); + OH_ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0); } diff --git a/interfaces/innerkits/reboot/init_reboot_innerkits.c b/interfaces/innerkits/reboot/init_reboot_innerkits.c index bc396230053c8f5b742c3a844fcea25ec71da578..38e136a39febeed48cf9a1104a418e23d043c587 100644 --- a/interfaces/innerkits/reboot/init_reboot_innerkits.c +++ b/interfaces/innerkits/reboot/init_reboot_innerkits.c @@ -31,7 +31,7 @@ #define DOREBOOT_PARAM "reboot.ut" #endif -int DoReboot_(const char *option) +static int DoReboot_(const char *option) { char value[MAX_REBOOT_OPTION_SIZE]; int ret = 0; diff --git a/services/include/init_hashmap.h b/services/include/init_hashmap.h index 0fb8c935caeb1a6c8a53ec7e8e9de4c5c7fdecff..cca866b80055ab2713f35b13e07e2b2eb0ae8fea 100644 --- a/services/include/init_hashmap.h +++ b/services/include/init_hashmap.h @@ -51,15 +51,15 @@ typedef struct { typedef void *HashMapHandle; -int HashMapIsEmpty(HashMapHandle handle); -int32_t HashMapCreate(HashMapHandle *handle, const HashInfo *info); -void HashMapDestory(HashMapHandle handle); -int32_t HashMapAdd(HashMapHandle handle, HashNode *hashNode); -void HashMapRemove(HashMapHandle handle, const void *key); -HashNode *HashMapGet(HashMapHandle handle, const void *key); -HashNode *HashMapFind(HashMapHandle handle, +int OH_HashMapIsEmpty(HashMapHandle handle); +int32_t OH_HashMapCreate(HashMapHandle *handle, const HashInfo *info); +void OH_HashMapDestory(HashMapHandle handle); +int32_t OH_HashMapAdd(HashMapHandle handle, HashNode *hashNode); +void OH_HashMapRemove(HashMapHandle handle, const void *key); +HashNode *OH_HashMapGet(HashMapHandle handle, const void *key); +HashNode *OH_HashMapFind(HashMapHandle handle, 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); #ifdef __cplusplus #if __cplusplus diff --git a/services/include/list.h b/services/include/list.h index a92ac82f33f1f67c2220220d00434f800c3efc09..38e423dfb750f295007bd0821a1a21fa7c756a4d 100755 --- a/services/include/list.h +++ b/services/include/list.h @@ -43,7 +43,7 @@ extern "C" { * int value; * } TEST_LIST_ITEM; * - * 2. Define a list and init list by ListAddTail + * 2. Define a list and init list by OH_ListAddTail * ListNode testList; * c(&testList); * @@ -52,7 +52,7 @@ extern "C" { * item.value = 0; * * 4. Add list item to list - * ListAddTail(&testList, (ListNode *)(&item)); + * OH_ListAddTail(&testList, (ListNode *)(&item)); * * 5. Advanced usage: add with order * // Ordering compare function @@ -62,7 +62,7 @@ extern "C" { * TEST_LIST_ITEM *right = (TEST_LIST_ITEM *)newNode; * return left->value - right->value; * } - * ListAddWithOrder(&testList, (ListNode *)(&item)) + * OH_ListAddWithOrder(&testList, (ListNode *)(&item)) */ /** @@ -85,7 +85,7 @@ typedef struct ListNode { * @param head list head, make sure head is valid pointer * @return None */ -void ListInit(struct ListNode *list); +void OH_ListInit(struct ListNode *list); /** * @brief Add a node to the end of the list @@ -94,7 +94,7 @@ void ListInit(struct ListNode *list); * @param item new node to be added * @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 @@ -103,7 +103,7 @@ void ListAddTail(struct ListNode *list, struct ListNode *item); * This function does not free any memory within item. * @return None */ -void ListRemove(struct ListNode *item); +void OH_ListRemove(struct ListNode *item); /** * @brief ListNode comparison function prototype @@ -128,7 +128,7 @@ typedef int (*ListCompareProc)(ListNode *node, ListNode *newNode); * respectively less than, equal to, or greater than the second. * @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 @@ -136,7 +136,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP * @param node ListNode to be compared. * @param data value for traversing * @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); @@ -148,7 +148,7 @@ typedef int (*ListTraversalProc)(ListNode *node, void *data); * @param compareProc comparing function, return 0 if matched. * @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 */ #define TRAVERSE_REVERSE_ORDER 0x1 @@ -169,7 +169,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr * @return return -1 for invalid input arguments. * 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 @@ -186,7 +186,7 @@ typedef void (*ListDestroyProc)(ListNode *node); * @param destroyProc destroy function; if NULL, it will free each node by default. * @return None */ -void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc); +void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc); /** * @brief Get list count @@ -194,7 +194,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc); * @param head list head, make sure head is valid pointer. * @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 #if __cplusplus diff --git a/services/init/init_group_manager.c b/services/init/init_group_manager.c index 129055ff37ec07641dd0619739e99d89b2715d31..a96673b3ece434110f45db8684bbea06a96a029e 100644 --- a/services/init/init_group_manager.c +++ b/services/init/init_group_manager.c @@ -99,7 +99,7 @@ static int InitFreeGroupNodes_(InitGroupNode *groupRoot) while (groupNode != NULL) { groupRoot = groupNode->next; 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); groupNode = groupRoot; @@ -173,7 +173,7 @@ void InitServiceSpace(void) GROUP_HASHMAP_BUCKET }; 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) { INIT_LOGE("%s", "Failed to create hash map"); } @@ -242,7 +242,7 @@ InitGroupNode *AddGroupNode(int type, const char *name) g_initWorkspace.groupNodes[type] = groupNode; if (type < NODE_TYPE_GROUPS) { // add hashmap - HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode); + OH_HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode); } return groupNode; } @@ -253,7 +253,7 @@ InitGroupNode *GetGroupNode(int type, const char *name) return NULL; } 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) { return NULL; } @@ -275,7 +275,7 @@ void DelGroupNode(int type, const char *name) return; } 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 *preNode = groupNode; while (groupNode != NULL) { @@ -299,7 +299,7 @@ int CheckNodeValid(int type, const char *name) if (type >= NODE_TYPE_GROUPS) { return -1; } - HashNode *node = HashMapGet(g_initWorkspace.hashMap[type], name); + HashNode *node = OH_HashMapGet(g_initWorkspace.hashMap[type], name); if (node != NULL) { INIT_LOGI("Found %s in %s group", name, type == NODE_TYPE_JOBS ? "job" : "service"); return 0; diff --git a/services/init/standard/init_cmdexecutor.c b/services/init/standard/init_cmdexecutor.c index a2baa83b222d05e2c2e44b4c8d489a1cec587580..3eb02744d9cfda43ecba02a0e5a64336ae680a60 100644 --- a/services/init/standard/init_cmdexecutor.c +++ b/services/init/standard/init_cmdexecutor.c @@ -43,17 +43,17 @@ int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd) groupNode->data.cmd = cmd; cmd->cmdId = g_cmdId++; cmd->name = groupNode->name; - ListInit(&cmd->cmdExecutor); + OH_ListInit(&cmd->cmdExecutor); } if (execCmd == NULL) { return 0; } PluginCmdExecutor *cmdExec = (PluginCmdExecutor *)calloc(1, sizeof(PluginCmdExecutor)); INIT_ERROR_CHECK(cmdExec != NULL, return -1, "Failed to create cmd listener"); - ListInit(&cmdExec->node); + OH_ListInit(&cmdExec->node); cmdExec->id = ++g_cmdExecutorId; cmdExec->execCmd = execCmd; - ListAddTail(&cmd->cmdExecutor, &cmdExec->node); + OH_ListAddTail(&cmd->cmdExecutor, &cmdExec->node); return cmdExec->id; } @@ -69,7 +69,7 @@ void RemoveCmdExecutor(const char *cmdName, int id) while (node != &cmd->cmdExecutor) { PluginCmdExecutor *cmdExec = ListEntry(node, PluginCmdExecutor, node); if (cmdExec->id == id) { - ListRemove(&cmdExec->node); + OH_ListRemove(&cmdExec->node); free(cmdExec); break; } @@ -148,7 +148,7 @@ void PluginExecCmdByCmdIndex(int index, const char *cmdContent) { int hashCode = ((index >> 16) & 0x0000ffff) - 1; // 16 left shift int cmdId = (index & 0x0000ffff); - HashNode *node = HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS), + HashNode *node = OH_HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS), hashCode, (const void *)&cmdId, CompareCmdId); if (node == NULL) { return; diff --git a/services/loopevent/loop/le_loop.c b/services/loopevent/loop/le_loop.c index 6796ffc8d82c31f142be3fc3677f7375df416c30..401cc96958796888d13516ba8e8a1cd19ff8984b 100644 --- a/services/loopevent/loop/le_loop.c +++ b/services/loopevent/loop/le_loop.c @@ -68,7 +68,7 @@ static LE_STATUS CreateLoop_(EventLoop **loop, uint32_t maxevents, uint32_t time TaskNodeFree, 128 }; - return HashMapCreate(&(*loop)->taskMap, &info); + return OH_HashMapCreate(&(*loop)->taskMap, &info); } LE_STATUS CloseLoop(EventLoop *loop) @@ -76,7 +76,7 @@ LE_STATUS CloseLoop(EventLoop *loop) if (!loop->stop) { return LE_SUCCESS; } - HashMapDestory(loop->taskMap); + OH_HashMapDestory(loop->taskMap); if (loop->close) { loop->close(loop); } @@ -100,7 +100,7 @@ LE_STATUS ProcessEvent(const EventLoop *loop, int fd, uint32_t oper) LE_STATUS AddTask(EventLoop *loop, BaseTask *task) { LoopMutexLock(&loop->mutex); - HashMapAdd(loop->taskMap, &task->hashNode); + OH_HashMapAdd(loop->taskMap, &task->hashNode); LoopMutexUnlock(&loop->mutex); return LE_SUCCESS; } @@ -110,7 +110,7 @@ BaseTask *GetTaskByFd(EventLoop *loop, int fd) BaseTask *task = NULL; LoopMutexLock(&loop->mutex); TaskId id = {0, {fd}}; - HashNode *node = HashMapGet(loop->taskMap, &id); + HashNode *node = OH_HashMapGet(loop->taskMap, &id); if (node != NULL) { task = HASHMAP_ENTRY(node, BaseTask, hashNode); } @@ -123,7 +123,7 @@ void DelTask(EventLoop *loop, BaseTask *task) loop->delEvent(loop, task->taskId.fd, Event_Read | Event_Write | Event_Error | Event_Free | Event_Timeout | Event_Signal); LoopMutexLock(&loop->mutex); - HashMapRemove(loop->taskMap, (TaskId *)task); + OH_HashMapRemove(loop->taskMap, (TaskId *)task); LoopMutexUnlock(&loop->mutex); return; } diff --git a/services/loopevent/socket/le_socket.c b/services/loopevent/socket/le_socket.c index dba31777536100f4fb431665575b7f2c8fd0793c..a01e92482eb165ae45db1ea7bb0db06f20d298e3 100644 --- a/services/loopevent/socket/le_socket.c +++ b/services/loopevent/socket/le_socket.c @@ -80,7 +80,7 @@ static int CreatePipeSocket_(const char *server) 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)); LE_CHECK(ret == 0, return ret, "Failed to memory set. error: %s", strerror(errno)); diff --git a/services/loopevent/task/le_asynctask.c b/services/loopevent/task/le_asynctask.c index 094728d8e7225587469d631bc0d49a49e273edbf..8510a32aacdba27e05b100e18d325b9488b5bee9 100644 --- a/services/loopevent/task/le_asynctask.c +++ b/services/loopevent/task/le_asynctask.c @@ -84,7 +84,7 @@ LE_STATUS LE_CreateAsyncTask(const LoopHandle loopHandle, task->stream.base.handleEvent = HandleAsyncEvent_; task->stream.base.innerClose = HandleAsyncTaskClose_; - ListInit(&task->stream.buffHead); + OH_ListInit(&task->stream.buffHead); LoopMutexInit(&task->stream.mutex); task->processAsyncEvent = processAsyncEvent; EventLoop *loop = (EventLoop *)loopHandle; diff --git a/services/loopevent/task/le_streamtask.c b/services/loopevent/task/le_streamtask.c index d89b44272b44997d5bf419429a96763978409bef..73f9304bdda22a715370ea01e1389f9b609d5d91 100644 --- a/services/loopevent/task/le_streamtask.c +++ b/services/loopevent/task/le_streamtask.c @@ -195,7 +195,7 @@ LE_STATUS LE_CreateStreamClient(const LoopHandle loopHandle, return LE_NO_MEMORY, "Failed to create task"); task->stream.base.handleEvent = HandleClientEvent_; task->stream.base.innerClose = HandleStreamTaskClose_; - ListInit(&task->stream.buffHead); + OH_ListInit(&task->stream.buffHead); LoopMutexInit(&task->stream.mutex); task->connectComplete = info->connectComplete; @@ -229,7 +229,7 @@ LE_STATUS LE_AcceptStreamClient(const LoopHandle loopHandle, const TaskHandle se task->sendMessageComplete = info->sendMessageComplete; task->recvMessage = info->recvMessage; task->serverTask = (StreamServerTask *)server; - ListInit(&task->stream.buffHead); + OH_ListInit(&task->stream.buffHead); LoopMutexInit(&task->stream.mutex); if ((info->baseInfo.flags & TASK_TEST) != TASK_TEST) { EventLoop *loop = (EventLoop *)loopHandle; diff --git a/services/loopevent/task/le_task.c b/services/loopevent/task/le_task.c index 6b9224a53b3bb8cbb39746b1afc4198b099cb277..f4b4fe349fb5470e57b32c2392657a3fa1e5bb74 100644 --- a/services/loopevent/task/le_task.c +++ b/services/loopevent/task/le_task.c @@ -81,7 +81,7 @@ LE_Buffer *CreateBuffer(uint32_t bufferSize) LE_Buffer *buffer = NULL; LE_CHECK((buffer = (LE_Buffer *)malloc(sizeof(LE_Buffer) + bufferSize)) != NULL, return NULL, "Failed to alloc memory for buffer"); - ListInit(&buffer->node); + OH_ListInit(&buffer->node); buffer->buffSize = bufferSize; buffer->dataSize = 0; return buffer; @@ -110,7 +110,7 @@ LE_Buffer *GetFirstBuffer(StreamTask *task) void AddBuffer(StreamTask *task, LE_Buffer *buffer) { LoopMutexLock(&task->mutex); - ListAddTail(&task->buffHead, &buffer->node); + OH_ListAddTail(&task->buffHead, &buffer->node); LoopMutexUnlock(&task->mutex); } @@ -141,7 +141,7 @@ void FreeBuffer(const LoopHandle loop, StreamTask *task, LE_Buffer *buffer) if (CheckTaskFlags((BaseTask *)task, TASK_STREAM | TASK_CONNECT) || CheckTaskFlags((BaseTask *)task, TASK_EVENT | TASK_ASYNC_EVENT)) { LoopMutexLock(&task->mutex); - ListRemove(&buffer->node); + OH_ListRemove(&buffer->node); LoopMutexUnlock(&task->mutex); } free(buffer); diff --git a/services/modules/bootevent/bootevent.c b/services/modules/bootevent/bootevent.c index 2c9eff7a29d63ee234fcec6ea5be27a8724dbb39..f8f4627b2f0d4a9d0b9809ccc36a7bd93f99c6b4 100755 --- a/services/modules/bootevent/bootevent.c +++ b/services/modules/bootevent/bootevent.c @@ -41,7 +41,7 @@ static ListNode *getBootEventParaList(bool autoCreate) if (bootEventList == NULL) { return NULL; } - ListInit(bootEventList); + OH_ListInit(bootEventList); return bootEventList; } @@ -77,7 +77,7 @@ static void BootEventParaAdd(const char *paramName) } // Add to list - ListAddTail(list, (ListNode *)item); + OH_ListAddTail(list, (ListNode *)item); } static int BootEventParaListCompareProc(ListNode *node, void *data) @@ -109,15 +109,15 @@ static void BootEventParaFireByName(const char *paramName) return; } - found = ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc); + found = OH_ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc); if (found != NULL) { // Remove from list - ListRemove(found); + OH_ListRemove(found); BootEventParaItemDestroy((BOOT_EVENT_PARAM_ITEM *)found); } // Check if all boot event params are fired - if (ListGetCnt(getBootEventParaList(false)) > 0) { + if (OH_ListGetCnt(getBootEventParaList(false)) > 0) { return; } diff --git a/services/param/base/param_base.c b/services/param/base/param_base.c index d7b7454267380b9ae3c28abfddb21a089fa687e5..fa3ac0843d101df318069c7d94b243cc4f748bb6 100644 --- a/services/param/base/param_base.c +++ b/services/param/base/param_base.c @@ -130,10 +130,10 @@ INIT_PUBLIC_API int InitParamWorkSpace(int onlyRead) WorkSpaceFree, 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"); WORKSPACE_INIT_LOCK(g_paramWorkSpace); - ListInit(&g_paramWorkSpace.workSpaceList); + OH_ListInit(&g_paramWorkSpace.workSpaceList); PARAM_SET_FLAG(g_paramWorkSpace.flags, WORKSPACE_FLAGS_INIT); ret = RegisterSecurityOps(onlyRead); @@ -173,7 +173,7 @@ INIT_INNER_API void CloseParamWorkSpace(void) } WORKSPACE_RW_LOCK(g_paramWorkSpace); if (g_paramWorkSpace.workSpaceHashHandle != NULL) { - HashMapDestory(g_paramWorkSpace.workSpaceHashHandle); + OH_HashMapDestory(g_paramWorkSpace.workSpaceHashHandle); g_paramWorkSpace.workSpaceHashHandle = NULL; } WORKSPACE_RW_UNLOCK(g_paramWorkSpace); @@ -198,7 +198,7 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi const char *realName = WORKSPACE_NAME_NORMAL; #endif 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) { WORKSPACE_RW_UNLOCK(g_paramWorkSpace); return 0; @@ -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); workSpace->flags = 0; workSpace->area = NULL; - ListInit(&workSpace->node); + OH_ListInit(&workSpace->node); ret = ParamStrCpy(workSpace->fileName, size, realName); PARAM_CHECK(ret == 0, break, "Failed to copy file name %s", realName); HASHMAPInitNode(&workSpace->hashNode); ret = InitWorkSpace(workSpace, onlyRead, spaceSize); 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); workSpace = NULL; break, "Failed to add hash node"); - ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node); + OH_ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node); ret = 0; workSpace = NULL; } while (0); diff --git a/services/param/base/param_comm.c b/services/param/base/param_comm.c index 3311bf3bd8b37301d7f3736bd07d5186d3d965d5..283f02556a17b6b9c6a0aacabe2dca76741a2bcc 100644 --- a/services/param/base/param_comm.c +++ b/services/param/base/param_comm.c @@ -34,7 +34,7 @@ INIT_LOCAL_API WorkSpace *GetWorkSpace(const char *name) #endif WorkSpace *space = NULL; WORKSPACE_RD_LOCK(*paramSpace); - HashNode *node = HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName); + HashNode *node = OH_HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName); if (node != NULL) { space = HASHMAP_ENTRY(node, WorkSpace, hashNode); } @@ -63,7 +63,7 @@ INIT_LOCAL_API ParamTrieNode *GetTrieNodeByHandle(ParamHandle handle) int hashCode = ((handle >> 24) & 0x000000ff); // 24 left shift uint32_t index = handle & 0x00ffffff; 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) { WORKSPACE_RW_UNLOCK(*paramSpace); PARAM_LOGV("Failed to get workspace for 0x%x index %d hashCode %d", handle, index, hashCode); diff --git a/services/param/base/param_trie.c b/services/param/base/param_trie.c index 4efdf33beeaf6ed1fc1f94991209c9208ac5109e..8a9364800de23daeb6122cee8d4308423f16e1f0 100644 --- a/services/param/base/param_trie.c +++ b/services/param/base/param_trie.c @@ -124,7 +124,7 @@ INIT_LOCAL_API void CloseWorkSpace(WorkSpace *workSpace) free(workSpace); return; } - ListRemove(&workSpace->node); + OH_ListRemove(&workSpace->node); PARAM_CHECK(workSpace->area != NULL, return, "The workspace area is null"); #ifdef WORKSPACE_AREA_NEED_MUTEX ParamRWMutexDelete(&workSpace->rwlock); diff --git a/services/param/linux/param_service.c b/services/param/linux/param_service.c index 1ea3afbd26d8cb802e0425b3cbcc118c5ba17ecd..79943b7c0286641963667dc82c0624202df30842 100755 --- a/services/param/linux/param_service.c +++ b/services/param/linux/param_service.c @@ -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"); if (extInfo->type == TRIGGER_PARAM_WAIT) { WaitNode *node = (WaitNode *)trigger; - ListInit(&node->item); + OH_ListInit(&node->item); node->timeout = extInfo->info.waitInfo.timeout; node->stream = extInfo->stream; node->waitId = extInfo->info.waitInfo.waitId; - ListAddTail(&watcher->triggerHead, &node->item); + OH_ListAddTail(&watcher->triggerHead, &node->item); } else { WatchNode *node = (WatchNode *)trigger; - ListInit(&node->item); + OH_ListInit(&node->item); node->watchId = extInfo->info.watchInfo.watchId; - ListAddTail(&watcher->triggerHead, &node->item); + OH_ListAddTail(&watcher->triggerHead, &node->item); } return 0; } @@ -401,7 +401,7 @@ PARAM_STATIC int OnIncomingConnect(LoopHandle loop, TaskHandle server) ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); PARAM_CHECK(watcher != NULL, return -1, "Failed to get watcher"); - ListInit(&watcher->triggerHead); + OH_ListInit(&watcher->triggerHead); watcher->stream = client; #ifdef STARTUP_INIT_TEST g_paramService.watcherTask = client; diff --git a/services/param/trigger/trigger_manager.c b/services/param/trigger/trigger_manager.c index 9919a1175dec9f9de79a655f239cfbcf989c0b64..1eedfbb3df91eb1c179103c3542ea3ad496c3a23 100644 --- a/services/param/trigger/trigger_manager.c +++ b/services/param/trigger/trigger_manager.c @@ -93,8 +93,8 @@ static TriggerNode *AddTriggerNode_(TriggerHeader *triggerHead, return NULL, "Failed to copy conditition"); node->type = type; node->flags = 0; - ListInit(&node->node); - ListAddTail(&triggerHead->triggerList, &node->node); + OH_ListInit(&node->node); + OH_ListAddTail(&triggerHead->triggerList, &node->node); triggerHead->triggerCount++; return node; } @@ -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"); node->firstCmd = 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"); return 0; } @@ -153,9 +153,9 @@ static void DelJobTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *trigg } jobNode->lastCmd = NULL; jobNode->firstCmd = NULL; - ListRemove(&trigger->node); + OH_ListRemove(&trigger->node); triggerHead->triggerCount--; - HashMapRemove(workSpace->hashMap, jobNode->name); + OH_HashMapRemove(workSpace->hashMap, jobNode->name); if (!TRIGGER_IN_QUEUE(trigger)) { free(jobNode); @@ -203,13 +203,13 @@ static void DelWatchTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *tri PARAM_CHECK(workSpace != NULL, return, "Param is null"); TriggerHeader *triggerHead = GetTriggerHeader(workSpace, 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) { WaitNode *node = (WaitNode *)trigger; - ListRemove(&node->item); + OH_ListRemove(&node->item); } else if (trigger->type == TRIGGER_PARAM_WATCH) { WatchNode *node = (WatchNode *)trigger; - ListRemove(&node->item); + OH_ListRemove(&node->item); } PARAM_LOGV("DelWatchTrigger_ %s count %d", GetTriggerName(trigger), triggerHead->triggerCount); triggerHead->triggerCount--; @@ -285,7 +285,7 @@ JobNode *UpdateJobTrigger(const TriggerWorkSpace *workSpace, JobNode *GetTriggerByName(const TriggerWorkSpace *workSpace, const char *triggerName) { 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) { return NULL; } @@ -313,7 +313,7 @@ void ClearTrigger(const TriggerWorkSpace *workSpace, int8_t type) FreeTrigger(workSpace, trigger); trigger = next; } - ListInit(&head->triggerList); + OH_ListInit(&head->triggerList); } int ExecuteQueuePush(TriggerWorkSpace *workSpace, const TriggerNode *trigger) @@ -565,7 +565,7 @@ static int32_t CompareData_(const struct tagTriggerNode_ *trigger, const void *d static void TriggerHeadSetDefault(TriggerHeader *head) { - ListInit(&head->triggerList); + OH_ListInit(&head->triggerList); head->triggerCount = 0; head->cmdNodeCount = 0; head->addTrigger = AddJobTrigger_; @@ -633,7 +633,7 @@ void InitTriggerHead(const TriggerWorkSpace *workSpace) 64 }; 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"); TriggerHeader *head = (TriggerHeader *)&workSpace->triggerHead[TRIGGER_BOOT]; diff --git a/services/param/watcher/proxy/watcher_manager.cpp b/services/param/watcher/proxy/watcher_manager.cpp index af4c5419e08241a7c48ee4bd80e405394453536e..ff39252706492a7af38bbd56776c90c1cbee3421 100644 --- a/services/param/watcher/proxy/watcher_manager.cpp +++ b/services/param/watcher/proxy/watcher_manager.cpp @@ -173,7 +173,7 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP std::lock_guard lock(watcherMutex_); groupMap_[keyPrefix] = groupId; watchers_[watcher->GetWatcherId()] = watcher; - ListAddTail(group->GetWatchers(), watcher->GetGroupNode()); + OH_ListAddTail(group->GetWatchers(), watcher->GetGroupNode()); if (watcherGroups_.find(groupId) != watcherGroups_.end()) { return; @@ -184,8 +184,8 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP void WatcherManager::DelParamWatcher(ParamWatcherPtr watcher) { std::lock_guard lock(watcherMutex_); - ListRemove(watcher->GetGroupNode()); - ListInit(watcher->GetGroupNode()); + OH_ListRemove(watcher->GetGroupNode()); + OH_ListInit(watcher->GetGroupNode()); watchers_.erase(watcher->GetWatcherId()); WATCHER_LOGV("DelParamWatcher watcherId %u", watcher->GetWatcherId()); } diff --git a/services/param/watcher/proxy/watcher_manager.h b/services/param/watcher/proxy/watcher_manager.h index 8659af14480d37b1904e628c6f50e6fcc1934ad9..9aae0153e9313ac367afa5fd93349153f0ad2b12 100644 --- a/services/param/watcher/proxy/watcher_manager.h +++ b/services/param/watcher/proxy/watcher_manager.h @@ -67,7 +67,7 @@ public: ParamWatcher(uint32_t watcherId, const sptr &watcher, const WatcherGroupPtr &group) : watcherId_(watcherId), watcher_(watcher), group_(group) { - ListInit(&groupNode_); + OH_ListInit(&groupNode_); } ~ParamWatcher() = default; @@ -104,7 +104,7 @@ public: public: WatcherGroup(uint32_t groupId, const std::string &key) : groupId_(groupId), keyPrefix_(key) { - ListInit(&watchers_); + OH_ListInit(&watchers_); } ~WatcherGroup() = default; void AddWatcher(const ParamWatcherPtr &watcher); diff --git a/services/utils/init_hashmap.c b/services/utils/init_hashmap.c index 052b6e98bfdbcd48a665f3547e1425c1b9afce0c..c8293a08595a50ab0f68f5d84fe830eac8235661 100644 --- a/services/utils/init_hashmap.c +++ b/services/utils/init_hashmap.c @@ -27,7 +27,7 @@ typedef struct { } HashTab; 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(info->keyHash != NULL && info->nodeHash != NULL, return -1, "Invalid param"); @@ -71,7 +71,7 @@ static HashNode *GetHashNodeByKey(const HashTab *tab, const HashNode *root, cons 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(node != NULL && node->next == NULL, return -1, "Invalid param"); @@ -89,11 +89,11 @@ int32_t HashMapAdd(HashMapHandle handle, HashNode *node) } node->next = tab->buckets[hashCode]; 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; } -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"); HashTab *tab = (HashTab *)handle; @@ -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); HashTab *tab = (HashTab *)handle; @@ -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"); HashTab *tab = (HashTab *)handle; @@ -156,7 +156,7 @@ void HashMapDestory(HashMapHandle handle) free(tab); } -HashNode *HashMapFind(HashMapHandle handle, +HashNode *OH_HashMapFind(HashMapHandle handle, int hashCode, const void *key, HashKeyCompare keyCompare) { INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param"); @@ -167,7 +167,7 @@ HashNode *HashMapFind(HashMapHandle handle, 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) { INIT_ERROR_CHECK(handle != NULL && hashNodeTraverse != NULL, return, "Invalid param"); @@ -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"); HashTab *tab = (HashTab *)handle; diff --git a/services/utils/list.c b/services/utils/list.c index 2a9c85f57a0d816d979febdbb66020a8b48f7e1b..227f88c451d98e854706bc633a135fe11a4c9520 100644 --- a/services/utils/list.c +++ b/services/utils/list.c @@ -27,7 +27,7 @@ * @param head list head, make sure head is valid pointer * @return None */ -void ListInit(struct ListNode *node) +void OH_ListInit(struct ListNode *node) { if (node == NULL) { return; @@ -43,7 +43,7 @@ void ListInit(struct ListNode *node) * @param item new node to be added * @return None */ -void ListAddTail(struct ListNode *head, struct ListNode *item) +void OH_ListAddTail(struct ListNode *head, struct ListNode *item) { if (head == NULL || item == NULL) { return; @@ -61,7 +61,7 @@ void ListAddTail(struct ListNode *head, struct ListNode *item) * This function does not free any memory within item. * @return None */ -void ListRemove(struct ListNode *item) +void OH_ListRemove(struct ListNode *item) { if (item == NULL) { return; @@ -81,7 +81,7 @@ void ListRemove(struct ListNode *item) * respectively less than, equal to, or greater than the second. * @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; int ret; @@ -117,7 +117,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP * @param compareProc comparing function, return 0 if matched. * @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; if ((head == NULL) || (compareProc == NULL)) { @@ -152,7 +152,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr * @return return -1 for invalid input arguments. * 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; ListNode *match; @@ -203,14 +203,14 @@ static int listDestroyTraversal(ListNode *node, void *data) * @param destroyProc destroy function; if NULL, it will free each node by default. * @return None */ -void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc) +void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc) { if (head == NULL) { return; } - ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0); - ListInit(head); + OH_ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0); + OH_ListInit(head); } /** @@ -219,7 +219,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc) * @param head list head, make sure head is valid pointer. * @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; ListNode *node; diff --git a/test/unittest/init/group_unittest.cpp b/test/unittest/init/group_unittest.cpp index 498e84a7b0e031f942d37b6ef19e9940ca1773c6..42339564648bc87b73c4228cdd29a98d8f0ebef6 100644 --- a/test/unittest/init/group_unittest.cpp +++ b/test/unittest/init/group_unittest.cpp @@ -108,54 +108,54 @@ HashInfo g_info = { HWTEST_F(InitGroupManagerUnitTest, TestHashMap, TestSize.Level1) { HashMapHandle handle; - HashMapCreate(&handle, &g_info); + OH_HashMapCreate(&handle, &g_info); const char *str1 = "Test hash map node 1"; const char *str2 = "Test hash map node 2"; const char *str3 = "Test hash map node 3"; TestHashNode *node1 = TestCreateHashNode(str1); TestHashNode *node2 = TestCreateHashNode(str2); - HashMapAdd(handle, &node1->node); - HashMapAdd(handle, &node2->node); - HashNode *node = HashMapGet(handle, (const void *)str1); + OH_HashMapAdd(handle, &node1->node); + OH_HashMapAdd(handle, &node2->node); + HashNode *node = OH_HashMapGet(handle, (const void *)str1); EXPECT_NE(node != nullptr, 0); if (node) { TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); 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); if (node) { TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); EXPECT_EQ(strcmp(tmp->name, str2), 0); } TestHashNode *node3 = TestCreateHashNode(str3); - HashMapAdd(handle, &node3->node); + OH_HashMapAdd(handle, &node3->node); node3 = TestCreateHashNode("Test hash map node 4"); - HashMapAdd(handle, &node3->node); + OH_HashMapAdd(handle, &node3->node); node3 = TestCreateHashNode("Test hash map node 5"); - HashMapAdd(handle, &node3->node); - node = HashMapGet(handle, (const void *)str3); + OH_HashMapAdd(handle, &node3->node); + node = OH_HashMapGet(handle, (const void *)str3); EXPECT_NE(node != nullptr, 0); if (node) { TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); EXPECT_EQ(strcmp(tmp->name, str3), 0); } TestHashNode *node4 = TestCreateHashNode("pre-init"); - HashMapAdd(handle, &node4->node); + OH_HashMapAdd(handle, &node4->node); const char *act = "load_persist_props_action"; TestHashNode *node5 = TestCreateHashNode(act); - HashMapAdd(handle, &node5->node); - HashMapRemove(handle, "pre-init"); - node = HashMapGet(handle, (const void *)act); + OH_HashMapAdd(handle, &node5->node); + OH_HashMapRemove(handle, "pre-init"); + node = OH_HashMapGet(handle, (const void *)act); EXPECT_NE(node != nullptr, 0); if (node) { TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node); EXPECT_EQ(strcmp(tmp->name, act), 0); } - HashMapIsEmpty(handle); - HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr); - HashMapDestory(handle); + OH_HashMapIsEmpty(handle); + OH_HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr); + OH_HashMapDestory(handle); } HWTEST_F(InitGroupManagerUnitTest, TestInitGroupMgrInit, TestSize.Level1) diff --git a/test/unittest/init/loopevent_unittest.cpp b/test/unittest/init/loopevent_unittest.cpp index 1e256ade9bd65694e57308c6ae35b2ffab3be7ad..0a2dbfb3db947ce3a77d055f9f03211773bc1eb6 100644 --- a/test/unittest/init/loopevent_unittest.cpp +++ b/test/unittest/init/loopevent_unittest.cpp @@ -194,7 +194,7 @@ public: EXPECT_EQ(GetNextBuffer((StreamTask *)client, next), nullptr); ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); PARAM_CHECK(watcher != nullptr, return, "Failed to get watcher"); - ListInit(&watcher->triggerHead); + OH_ListInit(&watcher->triggerHead); OnClose(client); LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)client, nullptr); return; diff --git a/test/unittest/init/service_unittest.cpp b/test/unittest/init/service_unittest.cpp index df70193c8a27702f1e40d5d545f92fae125f2d82..edd30a99de3ba3839b1bd1c67f8c88ec5f0c9647 100644 --- a/test/unittest/init/service_unittest.cpp +++ b/test/unittest/init/service_unittest.cpp @@ -48,7 +48,7 @@ public: }; HWTEST_F(ServiceUnitTest, TestDestoryHashMap, TestSize.Level1) { - HashMapDestory(GetInitWorkspace()->hashMap[0]); + OH_HashMapDestory(GetInitWorkspace()->hashMap[0]); } HWTEST_F(ServiceUnitTest, case01, TestSize.Level1) { diff --git a/test/unittest/param/paramservice_unittest.cpp b/test/unittest/param/paramservice_unittest.cpp index 7fd0b87f95286dc938496985d6d5fca73a69ed86..509191a253a768775b90c5d94501157e422d017c 100644 --- a/test/unittest/param/paramservice_unittest.cpp +++ b/test/unittest/param/paramservice_unittest.cpp @@ -313,7 +313,7 @@ public: ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client); PARAM_CHECK(watcher != NULL, return NULL, "Failed to get watcher"); - ListInit(&watcher->triggerHead); + OH_ListInit(&watcher->triggerHead); watcher->stream = client; GetParamService()->watcherTask = client; return GetParamService()->watcherTask; diff --git a/test/unittest/param/trigger_unittest.cpp b/test/unittest/param/trigger_unittest.cpp index 8e98e46fce2dcacf9a6d00676def725af504c550..a121b57713e3e87786d4d89ce6a5025711c8bf51 100644 --- a/test/unittest/param/trigger_unittest.cpp +++ b/test/unittest/param/trigger_unittest.cpp @@ -470,7 +470,7 @@ public: { RegisterBootStateChange(BootStateChange); (void)AddCompleteJob("param:ohos.servicectrl.display", "ohos.servicectrl.display=*", "display system"); - HashMapDestory(GetTriggerWorkSpace()->hashMap); + OH_HashMapDestory(GetTriggerWorkSpace()->hashMap); return 0; } }; diff --git a/ueventd/standard/ueventd_parameter.c b/ueventd/standard/ueventd_parameter.c index f296936b857d56ad02300f5f39f41795a26837f5..acb3477b8d088ba2994c1f809b63a36a451e2222 100644 --- a/ueventd/standard/ueventd_parameter.c +++ b/ueventd/standard/ueventd_parameter.c @@ -54,8 +54,8 @@ static struct DeviceUdevConf *GetFristParameter(DeviceParameterCtrl *parameterCt pthread_mutex_lock(&(parameterCtrl->parameterLock)); if (!ListEmpty(parameterCtrl->parameterList)) { conf = ListEntry(parameterCtrl->parameterList.next, struct DeviceUdevConf, paramNode); - ListRemove(&conf->paramNode); - ListInit(&conf->paramNode); + OH_ListRemove(&conf->paramNode); + OH_ListInit(&conf->paramNode); } pthread_mutex_unlock(&(parameterCtrl->parameterLock)); return conf; @@ -93,7 +93,7 @@ static void *ThreadRun(void *data) if (SystemSetParameter(config->parameter, paramValue) != 0) { INIT_LOGE("[uevent] SystemSetParameter %s failed", config->parameter); pthread_mutex_lock(&(parameterCtrl->parameterLock)); - ListAddTail(¶meterCtrl->parameterList, &config->paramNode); + OH_ListAddTail(¶meterCtrl->parameterList, &config->paramNode); pthread_mutex_unlock(&(parameterCtrl->parameterLock)); parameterCtrl->empty = 1; } @@ -105,7 +105,7 @@ static void AddParameter(DeviceParameterCtrl *parameterCtrl, struct DeviceUdevCo { pthread_mutex_lock(&(parameterCtrl->parameterLock)); if (ListEmpty(config->paramNode)) { - ListAddTail(¶meterCtrl->parameterList, &config->paramNode); + OH_ListAddTail(¶meterCtrl->parameterList, &config->paramNode); } pthread_mutex_unlock(&(parameterCtrl->parameterLock)); if (parameterCtrl->threadId == 0) { diff --git a/ueventd/ueventd_read_cfg.c b/ueventd/ueventd_read_cfg.c index 9c035411dc02b4fe61ffa568e2fb39ea434a8b32..31d5e104b37d7c66c902af01dd0994c576529112 100644 --- a/ueventd/ueventd_read_cfg.c +++ b/ueventd/ueventd_read_cfg.c @@ -108,8 +108,8 @@ static int ParseDeviceConfig(char *p) } else { config->parameter = NULL; } - ListInit(&config->paramNode); - ListAddTail(&g_devices, &config->list); + OH_ListInit(&config->paramNode); + OH_ListAddTail(&g_devices, &config->list); FreeStringVector(items, count); return 0; } @@ -143,7 +143,7 @@ static int ParseSysfsConfig(char *p) "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->gid = (gid_t)DecodeGid(items[SYS_CONFIG_GID_NUM]); - ListAddTail(&g_sysDevices, &config->list); + OH_ListAddTail(&g_sysDevices, &config->list); FreeStringVector(items, count); return 0; } @@ -161,7 +161,7 @@ static int ParseFirmwareConfig(char *p) INIT_CHECK(config != NULL, errno = ENOMEM; return -1); config->fmPath = strdup(p); - ListAddTail(&g_firmwares, &config->list); + OH_ListAddTail(&g_firmwares, &config->list); return 0; }