diff options
author | 2018-06-26 11:19:13 +0530 | |
---|---|---|
committer | 2018-06-26 11:19:13 +0530 | |
commit | 82b5e45ebf316afd7daa97d9f9b7b75636fb4e64 (patch) | |
tree | fabed7d2c0cc187206b2f2e768a4afaafa046bd8 /src | |
parent | 24cbcfaa6fa1121dec1a029a1df114f065341156 (diff) |
Spell correction
Change-Id: Icc062e358398ecf0fc46b7a55ce1c37a71aee650
Signed-off-by: Rahul Gupta <rahul.g.chimera@gmail.com>
Diffstat (limited to 'src')
63 files changed, 411 insertions, 411 deletions
diff --git a/src/adapt/nstack_dmm_adpt.c b/src/adapt/nstack_dmm_adpt.c index eea2bf1..8a79b03 100644 --- a/src/adapt/nstack_dmm_adpt.c +++ b/src/adapt/nstack_dmm_adpt.c @@ -195,7 +195,7 @@ nstack_adpt_init (nstack_dmm_para * para) } /** - * the share memory for epoll is created and usedy be app, don't clear + * the share memory for epoll is created and used by app, don't clear * it in fault case. */ if (0 != nsep_adpt_attach_memory ()) diff --git a/src/adapt/nstack_dmm_adpt.h b/src/adapt/nstack_dmm_adpt.h index e71dce3..25ac61f 100644 --- a/src/adapt/nstack_dmm_adpt.h +++ b/src/adapt/nstack_dmm_adpt.h @@ -29,7 +29,7 @@ typedef enum NSTACK_MODEL_TYPE2 = 2, /*nSocket and stack belong to different processes, *and nStack don't take care the communication between stack and stack adpt */ - NSTACK_MODEL_TYPE3 = 3, /*nSocket and stack belong to different processes, and sbr was spplied to communicate whit stack */ + NSTACK_MODEL_TYPE3 = 3, /*nSocket and stack belong to different processes, and sbr was supplied to communicate whit stack */ NSTACK_MODEL_INVALID, } nstack_model_deploy_type; diff --git a/src/adapt/nstack_epoll_comm.c b/src/adapt/nstack_epoll_comm.c index 0eb0b82..219803c 100644 --- a/src/adapt/nstack_epoll_comm.c +++ b/src/adapt/nstack_epoll_comm.c @@ -208,7 +208,7 @@ nsep_free_epinfo (nsep_epollInfo_t * info) if (nsfw_mem_ring_enqueue (pool->ring, (void *) info) != 1) { - NSSOC_LOGERR ("Errot to free epinfo"); + NSSOC_LOGERR ("Error to free epinfo"); } return 0; @@ -323,7 +323,7 @@ nsep_free_eventpoll (struct eventpoll *ep) if (nsfw_mem_ring_enqueue (pool->ring, epEntry) != 1) { - NSSOC_LOGERR ("Errot to free eventpoll"); + NSSOC_LOGERR ("Error to free eventpoll"); } return 0; @@ -436,14 +436,14 @@ nsep_alloc_epitem (struct epitem **data) typedef int (*nsep_shem_initFn_t) (void *, size_t); NSTACK_STATIC int -nsep_epPoolInit (void *addr, size_t lenth) +nsep_epPoolInit (void *addr, size_t length) { u32_t pos; int ret; NSSOC_LOGDBG ("Start to init eventpoll pool"); - ret = MEMSET_S (addr, lenth, 0, lenth); + ret = MEMSET_S (addr, length, 0, length); if (EOK != ret) { NSSOC_LOGERR ("MEMSET_S failed]ret=%d", ret); @@ -467,14 +467,14 @@ nsep_epPoolInit (void *addr, size_t lenth) } NSTACK_STATIC int -nsep_epitemPoolInit (void *addr, size_t lenth) +nsep_epitemPoolInit (void *addr, size_t length) { u32_t pos; int ret; NSSOC_LOGDBG ("Start to init epitem pool"); - ret = MEMSET_S (addr, lenth, 0, lenth); + ret = MEMSET_S (addr, length, 0, length); if (EOK != ret) { NSSOC_LOGERR ("MEMSET_S failed]ret=%d", ret); @@ -498,14 +498,14 @@ nsep_epitemPoolInit (void *addr, size_t lenth) } NSTACK_STATIC int -nsep_epInfoPoolInit (void *addr, size_t lenth) +nsep_epInfoPoolInit (void *addr, size_t length) { u32_t pos; int ret; NSSOC_LOGDBG ("shmem info init start"); - ret = MEMSET_S (addr, lenth, 0, lenth); + ret = MEMSET_S (addr, length, 0, length); if (EOK != ret) { NSSOC_LOGERR ("MEMSET_S failed]ret=%d", ret); @@ -544,7 +544,7 @@ nsep_create_shmem (size_t length, char *name, nsep_shem_initFn_t initFn) pmeminfo.ireserv = 0; pmeminfo.isocket_id = NSFW_SOCKET_ANY; - pmeminfo.lenth = length; + pmeminfo.length = length; ret = STRCPY_S (pmeminfo.stname.aname, sizeof (pmeminfo.stname.aname), name); if (EOK != ret) @@ -580,7 +580,7 @@ nsep_create_epInfoMem () pringinfo.usnum = NSTACK_MAX_EPOLL_INFO_NUM; if (-1 == - SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPINFO_RING_NAME)) { NSSOC_LOGERR ("Error to create ring]name=%s", pringinfo.stname.aname); @@ -611,7 +611,7 @@ nsep_adpt_attach_epInfoMem () name.enowner = NSFW_PROC_MAIN; if (-1 == - SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPINFO_RING_NAME)) { NSSOC_LOGERR ("Error to attach ring]name=%s", name.aname); @@ -629,7 +629,7 @@ nsep_adpt_attach_epInfoMem () manager->infoPool.ring = ring_handle; if (-1 == - SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPOLL_INFO_NAME)) { NSSOC_LOGERR ("SPRINTF_S failed]"); @@ -655,7 +655,7 @@ nsep_create_epItemMem () pringinfo.usnum = NSTACK_MAX_EPITEM_NUM; if (-1 == - SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPITEM_RING_NAME)) { NSSOC_LOGERR ("Error to create ring]name=%s", pringinfo.stname.aname); @@ -685,7 +685,7 @@ nsep_adpt_attach_epItemMem () name.enowner = NSFW_PROC_MAIN; if (-1 == - SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPITEM_RING_NAME)) { NSSOC_LOGERR ("Error to attach epItemMem]name=%s", name.aname); @@ -704,7 +704,7 @@ nsep_adpt_attach_epItemMem () manager->epitemPool.ring = ring_handle; if (-1 == - SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EPITEM_POOL)) { NSSOC_LOGERR ("SPRINTF_S failed]"); @@ -729,7 +729,7 @@ nsep_create_eventpollMem () pringinfo.usnum = NSTACK_MAX_EPOLL_NUM; if (-1 == - SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EVENTPOOL_RING_NAME)) { NSSOC_LOGERR ("Error to create ring]name=%s", pringinfo.stname.aname); @@ -759,7 +759,7 @@ nsep_adpt_attach_eventpollMem () name.enowner = NSFW_PROC_MAIN; if (-1 == - SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EVENTPOOL_RING_NAME)) { NSSOC_LOGERR ("Error to attach ring]name=%s", name.aname); @@ -777,11 +777,11 @@ nsep_adpt_attach_eventpollMem () nsep_epollManager_t *manager = nsep_getManager (); manager->epollPool.ring = ring_handle; - int retVal = SPRINTF_S (name.aname, NSFW_MEM_NAME_LENTH, "%s", + int retVal = SPRINTF_S (name.aname, NSFW_MEM_NAME_LENGTH, "%s", MP_NSTACK_EVENTPOLL_POOL); if (-1 == retVal) { - NSSOC_LOGERR ("SPRINTF_S faild]ret=%d", retVal); + NSSOC_LOGERR ("SPRINTF_S failed]ret=%d", retVal); return -1; } manager->epollPool.pool = nsfw_mem_zone_lookup (&name); @@ -965,7 +965,7 @@ nsep_recycle_epfd (void *epinfo, u32 pid) } int -nsep_recyle_ep (u32 pid) +nsep_recycle_ep (u32 pid) { nsep_epollManager_t *manager = nsep_getManager (); nsep_epollInfo_t *pool = manager->infoPool.pool; @@ -979,7 +979,7 @@ nsep_recyle_ep (u32 pid) } NSTACK_STATIC int -nsep_recyle_epItem (u32 pid) +nsep_recycle_epItem (u32 pid) { nsep_epollManager_t *manager = nsep_getManager (); struct epitem *pool = manager->epitemPool.pool; @@ -998,7 +998,7 @@ nsep_recyle_epItem (u32 pid) } NSTACK_STATIC int -nsep_recyle_eventpoll (u32 pid) +nsep_recycle_eventpoll (u32 pid) { nsep_epollManager_t *manager = nsep_getManager (); struct eventpoll *pool = manager->epollPool.pool; @@ -1021,13 +1021,13 @@ NSTACK_STATIC u16 rec_type) { NSSOC_LOGINF ("pid:%u recycle", exit_pid); - (void) nsep_recyle_epItem (exit_pid); - (void) nsep_recyle_eventpoll (exit_pid); + (void) nsep_recycle_epItem (exit_pid); + (void) nsep_recycle_eventpoll (exit_pid); return NSFW_RCC_CONTINUE; } NSTACK_STATIC - nsfw_rcc_stat nsep_recyle_lock (u32 pid, void *pdata, u16 rec_type) + nsfw_rcc_stat nsep_recycle_lock (u32 pid, void *pdata, u16 rec_type) { nsep_epollManager_t *manager = nsep_getManager (); nsep_epollInfo_t *pool = manager->infoPool.pool; @@ -1073,4 +1073,4 @@ NSTACK_STATIC REGIST_RECYCLE_OBJ_FUN (NSFW_REC_NSOCKET_EPOLL, nsep_recycle_resource) -REGIST_RECYCLE_LOCK_REL (nsep_recyle_lock, NULL, NSFW_PROC_NULL) +REGIST_RECYCLE_LOCK_REL (nsep_recycle_lock, NULL, NSFW_PROC_NULL) diff --git a/src/adapt/nstack_rd_mng.c b/src/adapt/nstack_rd_mng.c index 64c54a8..cb6a9b1 100644 --- a/src/adapt/nstack_rd_mng.c +++ b/src/adapt/nstack_rd_mng.c @@ -41,7 +41,7 @@ rd_route_table *g_rd_table_handle = NULL; /***************************************************************************** * Prototype : nstack_rd_mng_int -* Description : rd mng moudule init, create a block memory +* Description : rd mng module init, create a block memory * Input : int flag * Output : None * Return Value : int @@ -206,7 +206,7 @@ nstack_rd_ip_node_insert (char *name, rd_ip_data * data) * Return Value : int * Calls : * Called By : nStackMain -* just set delete flag, becuase +* just set delete flag, because *****************************************************************************/ int nstack_rd_ip_node_delete (rd_ip_data * data) diff --git a/src/adapt/nstack_share_res.c b/src/adapt/nstack_share_res.c index 421b5ed..9466145 100644 --- a/src/adapt/nstack_share_res.c +++ b/src/adapt/nstack_share_res.c @@ -43,11 +43,11 @@ nstack_create_share_fork_lock () int ret; param.isocket_id = -1; - param.lenth = sizeof (common_mem_spinlock_t); + param.length = sizeof (common_mem_spinlock_t); param.stname.entype = NSFW_SHMEM; ret = - STRCPY_S (param.stname.aname, NSFW_MEM_NAME_LENTH, + STRCPY_S (param.stname.aname, NSFW_MEM_NAME_LENGTH, NSTACK_SHARE_FORK_LOCK); if (EOK != ret) { @@ -79,7 +79,7 @@ nstack_lookup_share_fork_lock () param.entype = NSFW_SHMEM; param.enowner = NSFW_PROC_MAIN; - if (STRCPY_S (param.aname, NSFW_MEM_NAME_LENTH, NSTACK_SHARE_FORK_LOCK) != + if (STRCPY_S (param.aname, NSFW_MEM_NAME_LENGTH, NSTACK_SHARE_FORK_LOCK) != 0) { NSSOC_LOGERR ("STRCPY_S failed]name=%s", NSTACK_SHARE_FORK_LOCK); @@ -107,7 +107,7 @@ nstack_lookup_share_global_tick () int ret; nsfw_mem_name name = {.entype = NSFW_SHMEM,.enowner = NSFW_PROC_MAIN }; - ret = STRCPY_S (name.aname, NSFW_MEM_NAME_LENTH, NSTACK_GLOBAL_TICK_SHM); + ret = STRCPY_S (name.aname, NSFW_MEM_NAME_LENGTH, NSTACK_GLOBAL_TICK_SHM); if (EOK != ret) { NSSOC_LOGERR ("STRCPY_S failed]name=%s,ret=%d", NSTACK_GLOBAL_TICK_SHM, diff --git a/src/adapt/nstack_share_res.h b/src/adapt/nstack_share_res.h index 5025482..2737730 100644 --- a/src/adapt/nstack_share_res.h +++ b/src/adapt/nstack_share_res.h @@ -48,7 +48,7 @@ typedef struct nstack_tick_info { uint64_t *tick_ptr; // tick from shared memory uint64_t interval; // tick interval, only used in stack process - /* tick refference, updated periodically and read in tcpip_thread only */ + /* tick reference, updated periodically and read in tcpip_thread only */ struct timeval ref_time; // ref tick time uint64_t ref_tick; // ref tick } nstack_tick_info_t; diff --git a/src/framework/common/base/include/common/common_mem_buf.h b/src/framework/common/base/include/common/common_mem_buf.h index d0d3588..441da6a 100644 --- a/src/framework/common/base/include/common/common_mem_buf.h +++ b/src/framework/common/base/include/common/common_mem_buf.h @@ -26,7 +26,7 @@ typedef enum __DMM_PROC_TYPE { DMM_PROC_T_AUTO = 0, /*auto detect */ DMM_PROC_T_PRIMARY = 1, /* set to primary */ - DMM_PROC_T_SECONDARY = 2, /* set to seconday */ + DMM_PROC_T_SECONDARY = 2, /* set to secondary */ DMM_PROC_T_INVALID } DMM_PROC_TYPE; diff --git a/src/framework/common/base/include/common_pal_bitwide_adjust.h b/src/framework/common/base/include/common_pal_bitwide_adjust.h index 96ae54e..0e68533 100644 --- a/src/framework/common/base/include/common_pal_bitwide_adjust.h +++ b/src/framework/common/base/include/common_pal_bitwide_adjust.h @@ -34,11 +34,11 @@ extern void **g_LMegAddrArry; /*get Local Seg addr by segIdx*/ #define HMEM_SEG_LVADDR(segid) (g_LMegAddrArry[segid]) -/*get SegIDX by PrimSegAddr, just get the arry Idx of g_PMemSegArry*/ +/*get SegIDX by PrimSegAddr, just get the array Idx of g_PMemSegArry*/ #define HMEM_SEGID(segaddr) ((struct common_mem_memseg*)segaddr - &(g_PMemSegArry[0])) /***************************************************************** -Parameters : LMegAddrArry[] Loacol common_mem_memseg addr Arry +Parameters : LMegAddrArry[] Local common_mem_memseg addr Array SegNum common_mem_memseg Num. Return : Description : init g_PrimAddr2LocalMap g_LocalAddr2PrimMap while the process start diff --git a/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c b/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c index de98877..4e59d68 100644 --- a/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c +++ b/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c @@ -50,7 +50,7 @@ typedef struct __base_linux_api #include "base_linux_api_declare.h" } base_linux_api; -nsfw_base_state g_nsfw_mudule_state = BASE_STATE_INIT; +nsfw_base_state g_nsfw_module_state = BASE_STATE_INIT; pthread_mutex_t g_nsfw_init_mutex = PTHREAD_MUTEX_INITIALIZER; base_linux_api g_nsfw_posix_api = { 0 }; @@ -84,30 +84,30 @@ nsfw_posix_api_init () int iret = NSFW_BASE_OK; /*if init already, just return success, if init fail before, just return err */ - if (BASE_STATE_INIT != g_nsfw_mudule_state) + if (BASE_STATE_INIT != g_nsfw_module_state) { return (BASE_STATE_SUCCESS == - g_nsfw_mudule_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); + g_nsfw_module_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); } (void) pthread_mutex_lock (&g_nsfw_init_mutex); /*if init already, just return success, if init fail before, just return err */ - if (BASE_STATE_INIT != g_nsfw_mudule_state) + if (BASE_STATE_INIT != g_nsfw_module_state) { (void) pthread_mutex_unlock (&g_nsfw_init_mutex); return (BASE_STATE_SUCCESS == - g_nsfw_mudule_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); + g_nsfw_module_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); } iret = nsfw_posix_symbol_load (); if (NSFW_BASE_OK == iret) { - g_nsfw_mudule_state = BASE_STATE_SUCCESS; + g_nsfw_module_state = BASE_STATE_SUCCESS; } else { - g_nsfw_mudule_state = BASE_STATE_FAIL; + g_nsfw_module_state = BASE_STATE_FAIL; } (void) pthread_mutex_unlock (&g_nsfw_init_mutex); diff --git a/src/framework/common/data_struct/eprb_tree.c b/src/framework/common/data_struct/eprb_tree.c index c8af17c..c8e616d 100644 --- a/src/framework/common/data_struct/eprb_tree.c +++ b/src/framework/common/data_struct/eprb_tree.c @@ -55,7 +55,7 @@ __ep_rb_rotate_left (struct ep_rb_node *X, struct ep_rb_root *root) **************************/ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (X->rb_right); - /* estblish X->Right link */ + /* establish X->Right link */ X->rb_right = Y->rb_left; if (Y->rb_left != NULL) @@ -64,7 +64,7 @@ __ep_rb_rotate_left (struct ep_rb_node *X, struct ep_rb_root *root) (struct ep_rb_node *) ADDR_LTOSH_EXT (X); } - /* estblish Y->Parent link */ + /* establish Y->Parent link */ Y->rb_parent = X->rb_parent; if (X->rb_parent) @@ -101,7 +101,7 @@ __ep_rb_rotate_right (struct ep_rb_node *X, struct ep_rb_root *root) ****************************/ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (X->rb_left); - /* estblish X->Left link */ + /* establish X->Left link */ X->rb_left = Y->rb_right; if (Y->rb_right != NULL) @@ -110,7 +110,7 @@ __ep_rb_rotate_right (struct ep_rb_node *X, struct ep_rb_root *root) (struct ep_rb_node *) ADDR_LTOSH_EXT (X); } - /* estblish Y->Parent link */ + /* establish Y->Parent link */ Y->rb_parent = X->rb_parent; if (X->rb_parent) @@ -190,7 +190,7 @@ ep_rb_insert_color (struct ep_rb_node *X, struct ep_rb_root *root) } else { - /* miror image of above code */ + /* mirror image of above code */ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (EP_RBTREE_GRANDF (X)->rb_left); diff --git a/src/framework/common/data_struct/sha256.c b/src/framework/common/data_struct/sha256.c index 213eb4e..f0773cf 100644 --- a/src/framework/common/data_struct/sha256.c +++ b/src/framework/common/data_struct/sha256.c @@ -270,7 +270,7 @@ SHA_fin1 (u8 hval[], SHA256_CTX ctx[1], const unsigned int hlen) { u32 i = (u32) (ctx->count[0] & SHA256_MASK); - /* Not unusal shift operation. Checked with purify. */ + /* Not unusual shift operation. Checked with purify. */ /*put bytes in the buffer in an order in which references to */ /*32-bit words will put bytes with lower addresses into the */ diff --git a/src/framework/common/mem_mgr/include/nsfw_mem_desc.h b/src/framework/common/mem_mgr/include/nsfw_mem_desc.h index 1e959d9..9a14c8d 100644 --- a/src/framework/common/mem_mgr/include/nsfw_mem_desc.h +++ b/src/framework/common/mem_mgr/include/nsfw_mem_desc.h @@ -30,10 +30,10 @@ #define NSFW_NAME_LENCHECK_RET(name, desc) \ { \ i32 inamelen = strlen(name); \ - if (inamelen >= NSFW_MEM_APPNAME_LENTH) \ + if (inamelen >= NSFW_MEM_APPNAME_LENGTH) \ { \ NSCOMM_LOGERR("name length check fail] desc=%s, name len=%d, expected max=%d", \ - #desc, inamelen, NSFW_MEM_APPNAME_LENTH); \ + #desc, inamelen, NSFW_MEM_APPNAME_LENGTH); \ return NSFW_MEM_ERR; \ } \ } @@ -41,10 +41,10 @@ #define NSFW_NAME_LENCHECK_RET_NULL(name, desc) \ { \ i32 inamelen = strlen(name); \ - if (inamelen >= NSFW_MEM_APPNAME_LENTH) \ + if (inamelen >= NSFW_MEM_APPNAME_LENGTH) \ { \ NSCOMM_LOGERR("name length check fail] desc=%s, name len=%d, expected max=%d", \ - #desc, inamelen, NSFW_MEM_APPNAME_LENTH); \ + #desc, inamelen, NSFW_MEM_APPNAME_LENGTH); \ return NULL; \ } \ } @@ -123,7 +123,7 @@ typedef struct { i32 (*mem_ops_init) (nsfw_mem_para * para); void (*mem_ops_destroy) (void); - mzone_handle (*mem_ops_zone_creae) (nsfw_mem_zone * pinfo); + mzone_handle (*mem_ops_zone_create) (nsfw_mem_zone * pinfo); i32 (*mem_ops_zone_createv) (nsfw_mem_zone * pmeminfo, i32 inum, mzone_handle * paddr_array, i32 iarray_num); mzone_handle (*mem_ops_zone_lookup) (nsfw_mem_name * pname); diff --git a/src/framework/common/mem_mgr/include/nsfw_ring_data.h b/src/framework/common/mem_mgr/include/nsfw_ring_data.h index 99ec0ed..e6007ab 100644 --- a/src/framework/common/mem_mgr/include/nsfw_ring_data.h +++ b/src/framework/common/mem_mgr/include/nsfw_ring_data.h @@ -65,7 +65,7 @@ struct nsfw_mem_ring u8 ringflag; //scmp, scsp, mcsp,mcmp u16 reserv; //reserv data u32 size; //size of the Ring, must 2^n - u32 eltsize; //for sppool, it is the size of per buf, if is ring, eltsize is zero. + u32 eltsize; //for s-pool, it is the size of per buf, if is ring, eltsize is zero. u32 mask; //mask of the Ring, used mask mod Head/Tail to get real pos, must 2^n-1 void *Addrbase; /*Cause the Addr we support just 40b(1024G), we using a basAddr+offset to get the real addr; ring[x].data_s.val just store offset; * not used when no shared mode @@ -78,13 +78,13 @@ struct nsfw_mem_ring struct { - volatile u32 head; //Head of the Ring, used to indicat pos where to pull a val + volatile u32 head; //Head of the Ring, used to indicate pos where to pull a val volatile u32 tail; //for nshmem, shmem not used. } prod; struct { volatile u32 head; //for nshmem, shmem not used. - volatile u32 tail; //Tail of the Ring, used to indicat pos where to push a val + volatile u32 tail; //Tail of the Ring, used to indicate pos where to push a val } cons; u32 uireserv[4]; //reserved for update union RingData_U ring[0]; //Value of Ring diff --git a/src/framework/common/mem_mgr/include/nsfw_ring_fun.h b/src/framework/common/mem_mgr/include/nsfw_ring_fun.h index 57a7bf3..d74cc4b 100644 --- a/src/framework/common/mem_mgr/include/nsfw_ring_fun.h +++ b/src/framework/common/mem_mgr/include/nsfw_ring_fun.h @@ -71,7 +71,7 @@ nsfw_mem_ring_init (struct nsfw_mem_ring *ring, unsigned int size, /* another way to init Pool while no continuous space -1. init a empt rte_perf_ring +1. init a empty rte_perf_ring 2. add element to PerRing. */ static inline void diff --git a/src/framework/common/mem_mgr/nsfw_mem_api.c b/src/framework/common/mem_mgr/nsfw_mem_api.c index b795921..c89ada1 100644 --- a/src/framework/common/mem_mgr/nsfw_mem_api.c +++ b/src/framework/common/mem_mgr/nsfw_mem_api.c @@ -34,7 +34,7 @@ /***************************************************************************** * Prototype : nsfw_mem_init * Description : memory mgr module init -* Input : point to nstak_fwmem_para +* Input : point to nstack_fwmem_para * Output : None * Return Value : i32 * Calls : @@ -88,7 +88,7 @@ nsfw_mem_init (void *para) } } - /*if some module init fail, destory the moudles that success */ + /*if some module init fail, destory the modules that success */ if (icount < g_mem_type_num) { for (iindex = 0; iindex < icount; iindex++) @@ -111,7 +111,7 @@ nsfw_mem_init (void *para) * Description : create a block memory with name * nsfw_mem_zone::stname * nsfw_mem_zone::isize -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_zone* pinfo * Output : None * Return Value : mzone_handle @@ -130,16 +130,16 @@ nsfw_mem_zone_create (nsfw_mem_zone * pinfo) return NULL; } - MEM_OP_CALL_OK_RET (pinfo->stname.entype, mem_ops_zone_creae, (pinfo)); + MEM_OP_CALL_OK_RET (pinfo->stname.entype, mem_ops_zone_create, (pinfo)); NSCOMM_LOGINF ("mem create fail] memtype=%d, name=%s, size=%zu", - pinfo->stname.entype, pinfo->stname.aname, pinfo->lenth); + pinfo->stname.entype, pinfo->stname.aname, pinfo->length); return NULL; } /***************************************************************************** * Prototype : nsfw_mem_zone_createv * Description : create some memory blocks -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_zone* pmeminfo * i32 inum * mzone_handle* paddr_array @@ -174,7 +174,7 @@ nsfw_mem_zone_createv (nsfw_mem_zone * pmeminfo, i32 inum, /***************************************************************************** * Prototype : nsfw_mem_zone_lookup * Description : look up a memory -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -252,7 +252,7 @@ nsfw_mem_mbfmp_create (nsfw_mem_mbfpool * pbufinfo) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_createv * Description : create some mbuf pools -* 1. the name of lenth must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the name of length must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_mbfpool* pmbfname * i32 inum * mpool_handle* phandle_array @@ -328,7 +328,7 @@ nsfw_mem_mbf_free (mbuf_handle mhandle, nsfw_mem_type entype) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_lookup * Description : look up mbuf mpool -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -358,7 +358,7 @@ nsfw_mem_mbfmp_lookup (nsfw_mem_name * pmbfname) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_release * Description : release mbuf pool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -379,7 +379,7 @@ nsfw_mem_mbfmp_release (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_sp_create * Description : create a simple pool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_sppool* pmpinfo * Output : None * Return Value : mring_handle @@ -407,7 +407,7 @@ nsfw_mem_sp_create (nsfw_mem_sppool * pmpinfo) /***************************************************************************** * Prototype : nsfw_mem_sp_createv * Description : create some simple pools one time -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_sppool* pmpinfo * i32 inum * mring_handle* pringhandle_array @@ -433,7 +433,7 @@ nsfw_mem_sp_createv (nsfw_mem_sppool * pmpinfo, i32 inum, /***************************************************************************** * Prototype : nsfw_mem_sp_ring_create * Description : create a simple pool with many rings -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_mring* pringinfo * mring_handle* pringhandle_array * i32 iringnum @@ -459,7 +459,7 @@ nsfw_mem_sp_ring_create (nsfw_mem_mring * pringinfo, /***************************************************************************** * Prototype : nsfw_mem_sp_release * Description : release a simple mempool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -479,7 +479,7 @@ nsfw_mem_sp_release (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_sp_lookup * Description : look up a simpile ring -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -510,8 +510,8 @@ nsfw_mem_sp_lookup (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_ring_create * Description : create a ring -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. -* 2. shared memory ring (NSFW_SHMEM) just can put a pointor into the queue, the queue also point to a shared block memory. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. +* 2. shared memory ring (NSFW_SHMEM) just can put a pointer into the queue, the queue also point to a shared block memory. * no shared memory ring(NSFW_NSHMEM) is other wise. * Input : nsfw_mem_mring* pringinfo * Output : None @@ -541,7 +541,7 @@ nsfw_mem_ring_create (nsfw_mem_mring * pringinfo) /***************************************************************************** * Prototype : nsfw_mem_ring_lookup * Description : look up a ring by name -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -730,7 +730,7 @@ nsfw_mem_mbfpool_free_count (mpool_handle mhandle) /***************************************************************************** * Prototype : nsfw_mem_ring_release * Description : release a ring memory -* notes : the lenth of name must be less than NSFW_MEM_APPNAME_LENTH +* notes : the length of name must be less than NSFW_MEM_APPNAME_LENGTH * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -752,7 +752,7 @@ nsfw_mem_ring_release (nsfw_mem_name * pname) * Prototype : nsfw_mem_get_len * Description : statics mbufpool, sppool, ring mem size. * return: <=0, err happen, >0 mem size -* NSFW_MEM_MZONE: not surport because you already know the lenth when create +* NSFW_MEM_MZONE: not surport because you already know the length when create * Input : void * handle * nsfw_mem_struct_type type * Output : None @@ -853,25 +853,25 @@ nsfw_mem_mbuf_iterator (mpool_handle handle, u32 start, u32 end, * Description : print ring info * Input : mring_handle mhandle * Output : None -* Return Value : if no err happen, return the lenth of string print, 0 or -1 maybe err happen +* Return Value : if no err happen, return the length of string print, 0 or -1 maybe err happen * Calls : * Called By : *****************************************************************************/ i32 -nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int lenth) +nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int length) { struct nsfw_mem_ring *temp = (struct nsfw_mem_ring *) mhandle; u32 head = 0; u32 tail = 0; int ret = 0; - if ((!temp) || (!pbuf) || (lenth <= 0)) + if ((!temp) || (!pbuf) || (length <= 0)) { return 0; } head = temp->prod.head; tail = temp->cons.tail; ret = - SPRINTF_S (pbuf, lenth, + SPRINTF_S (pbuf, length, "[.Head=%u,\n .Tail=%u,\n .(|Tail-Head|)=%u,\n .size=%u,\n .mask=%u]\n", head, tail, (tail >= head) ? (tail - head) : (head - tail), temp->size, temp->mask); diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c index c78c27e..fdb2079 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c @@ -40,7 +40,7 @@ nsfw_mem_ops g_nshmem_ops = { nsfw_nshmem_ringcreate, NULL, nsfw_nshmem_ringrelease, - nsfw_nshmem_stactic, + nsfw_nshmem_static, NULL, NULL, /*mem_ops_sp_iterator */ NULL, /*mem_ops_mbuf_iterator */ diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c index d5661fd..49e3769 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c @@ -181,7 +181,7 @@ nsfw_nshmem_destory (void) * Prototype : nsfw_nshmem_reserv_safe * Description : malloc a memory and save to memzone * Input : const char* name -* size_t lenth +* size_t length * Output : None * Return Value : mzone_handle * Calls : @@ -189,20 +189,20 @@ nsfw_nshmem_destory (void) * *****************************************************************************/ mzone_handle -nsfw_nshmem_reserv_safe (const char *name, size_t lenth) +nsfw_nshmem_reserv_safe (const char *name, size_t length) { void *addr = NULL; i32 iret = NSFW_MEM_OK; nsfw_nshmem_mzone *pmemzone = NULL; - if (lenth <= 0) + if (length <= 0) { return NULL; } nsfw_write_lock (nsfw_get_glb_lock ()); - addr = malloc (lenth); + addr = malloc (length); if (!addr) { NSCOMM_LOGERR ("nshmem malloc addr fail] addr=%p", addr); @@ -210,7 +210,7 @@ nsfw_nshmem_reserv_safe (const char *name, size_t lenth) return NULL; } - iret = MEMSET_S (addr, lenth, 0, lenth); + iret = MEMSET_S (addr, length, 0, length); if (EOK != iret) { NSCOMM_LOGERR ("nshmem malloc addr MEMSET_S fail] addr=%p", addr); @@ -230,8 +230,8 @@ nsfw_nshmem_reserv_safe (const char *name, size_t lenth) } pmemzone->addr = addr; - pmemzone->lenth = lenth; - /*name must be less than NSFW_MEM_APPNAME_LENTH */ + pmemzone->length = length; + /*name must be less than NSFW_MEM_APPNAME_LENGTH */ if (EOK != STRCPY_S ((char *) pmemzone->aname, sizeof (pmemzone->aname), name)) { @@ -256,7 +256,7 @@ nsfw_nshmem_create (nsfw_mem_zone * pinfo) NSFW_NAME_LENCHECK_RET_NULL (pinfo->stname.aname, "nshmem create"); NSFW_NSHMEM_INIT_CHK_RET_NULL (); - return nsfw_nshmem_reserv_safe (pinfo->stname.aname, pinfo->lenth); + return nsfw_nshmem_reserv_safe (pinfo->stname.aname, pinfo->length); } /***************************************************************************** @@ -284,7 +284,7 @@ nsfw_nshmem_lookup (nsfw_mem_name * pname) mz = &g_nshmem_internal_cfg->amemzone[icnt]; if (mz->addr != NULL - && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENTH)) + && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENGTH)) { nsfw_read_unlock (nsfw_get_glb_lock ()); return mz->addr; @@ -320,7 +320,7 @@ nsfw_nshmem_release (nsfw_mem_name * pname) mz = &g_nshmem_internal_cfg->amemzone[icnt]; if (mz->addr != NULL - && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENTH)) + && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENGTH)) { nsfw_nshmem_free_zone (mz); nsfw_read_unlock (nsfw_get_glb_lock ()); @@ -380,7 +380,7 @@ nsfw_nshmem_spcreate (nsfw_mem_sppool * pmpinfo) ringflag].ring_ops_enqueue (pringhead, (void *) pmz)) { - NSCOMM_LOGERR ("nsfw_nshmem_ringenqueue enque fail] uscnt=%u", + NSCOMM_LOGERR ("nsfw_nshmem_ringenqueue enqueue fail] uscnt=%u", uscnt); } @@ -516,7 +516,7 @@ nsfw_nshmem_ring_statics (mring_handle handle) } /***************************************************************************** -* Prototype : nsfw_nshmem_stactic +* Prototype : nsfw_nshmem_static * Description : static the memory size according to mem type * Input : void* handle * nsfw_mem_struct_type type @@ -527,7 +527,7 @@ nsfw_nshmem_ring_statics (mring_handle handle) * *****************************************************************************/ ssize_t -nsfw_nshmem_stactic (void *handle, nsfw_mem_struct_type type) +nsfw_nshmem_static (void *handle, nsfw_mem_struct_type type) { switch (type) { diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h index 3f5b1b9..06ab562 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h @@ -25,9 +25,9 @@ typedef struct { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; void *addr; - int lenth; + int length; } nsfw_nshmem_mzone; typedef struct @@ -42,7 +42,7 @@ typedef struct i32 nsfw_nshmem_init (nsfw_mem_para * para); /* - * no share memory moudle destory + * no share memory module destory */ void nsfw_nshmem_destory (void); @@ -65,6 +65,6 @@ mring_handle nsfw_nshmem_ringcreate (nsfw_mem_mring * pringinfo); i32 nsfw_nshmem_ringrelease (nsfw_mem_name * pname); -ssize_t nsfw_nshmem_stactic (void *handle, nsfw_mem_struct_type type); +ssize_t nsfw_nshmem_static (void *handle, nsfw_mem_struct_type type); #endif diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c index 780596c..7e56f3c 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c @@ -186,7 +186,7 @@ nsfw_nshmem_ring_mp_enqueue (struct nsfw_mem_ring *mem_ring, void *obj_table) common_mem_pause (); /* Set COMMON_RING_PAUSE_REP_COUNT to avoid spin too long waiting - * for other thread finish. It gives pre-empted thread a chance + * for other thread finish. It gives pre-emptied thread a chance * to proceed and finish with ring dequeue operation. */ /* check the queue can be operate */ if (++rep == 5) @@ -311,7 +311,7 @@ nsfw_nshmem_ring_mc_dequeuev (struct nsfw_mem_ring *r, void **obj_table, common_mem_pause (); /* Set COMMON_RING_PAUSE_REP_COUNT to avoid spin too long waiting - * for other thread finish. It gives pre-empted thread a chance + * for other thread finish. It gives pre-emptied thread a chance * to proceed and finish with ring dequeue operation. */ /* check the queue can be operate */ if (++rep == 5) @@ -327,7 +327,7 @@ nsfw_nshmem_ring_mc_dequeuev (struct nsfw_mem_ring *r, void **obj_table, } /*this is a multi thread/process dequeue function, please pay attention to the bellow point -1. while dequeue corrupt, the tail no one added, may multy the try times. +1. while dequeue corrupt, the tail no one added, may multi the try times. */ int nsfw_nshmem_ring_mc_dequeue (struct nsfw_mem_ring *ring, void **box) @@ -422,7 +422,7 @@ nsfw_nshmem_ring_singlethread_dequeuev (struct nsfw_mem_ring *ring, { tail = ring->cons.tail; - /* if all entries are dequed return 0 */ + /* if all entries are dequeued return 0 */ if (unlikely (ring->prod.head == ring->cons.tail)) { return num; diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c index dc3400d..c29b108 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c @@ -53,16 +53,16 @@ } /*init the msg head*/ -#define NSFW_SHMEM_MSG_HEAD_INIT(pmsg, type, lenth) { \ +#define NSFW_SHMEM_MSG_HEAD_INIT(pmsg, type, length) { \ (pmsg)->usmsg_type = (type); \ - (pmsg)->uslenth = (lenth); \ + (pmsg)->uslength = (length); \ } /*rsp msg head check, and if err goto*/ -#define NSFW_SHMEM_MSGHEAD_CHK_GOTO(pmsg, type, lenth, gotoflag) { \ - if (((type) != pmsg->usmsg_type) && ((lenth) != pmsg->uslenth)) \ +#define NSFW_SHMEM_MSGHEAD_CHK_GOTO(pmsg, type, length, gotoflag) { \ + if (((type) != pmsg->usmsg_type) && ((length) != pmsg->uslength)) \ { \ - NSCOMM_LOGERR("check fail] msgtype=%d, type_para=%d, len=%d", (pmsg->usmsg_type), (type), (lenth)); \ + NSCOMM_LOGERR("check fail] msgtype=%d, type_para=%d, len=%d", (pmsg->usmsg_type), (type), (length)); \ goto gotoflag; \ } \ } @@ -77,9 +77,9 @@ } /*mzone msg init*/ -#define NSFW_SHMEM_MZONE_DATA_INIT(pdata, slenth, seg, socketid) { \ +#define NSFW_SHMEM_MZONE_DATA_INIT(pdata, slength, seg, socketid) { \ (pdata)->isocket_id = (socketid); \ - (pdata)->lenth = (slenth); \ + (pdata)->length = (slength); \ (pdata)->usseq = (seg); \ (pdata)->ireserv = 0; \ } @@ -201,7 +201,7 @@ release: } /* - *create some memorys by send a msg + *create some memories by send a msg */ i32 nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo, @@ -255,9 +255,9 @@ nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo, pmeminfo[itindex].stname.aname, pid); if (-1 == retVal) { - NSCOMM_LOGERR ("SPRINTF_S faild]ret=%d", retVal); + NSCOMM_LOGERR ("SPRINTF_S failed]ret=%d", retVal); } - NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].lenth, + NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].length, (u16) itindex, pmeminfo[itindex].isocket_id); @@ -302,9 +302,9 @@ nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo, pmeminfo[itindex].stname.aname, pid); if (-1 == retVal) { - NSCOMM_LOGERR ("SPRINTF_S faild]ret=%d", retVal); + NSCOMM_LOGERR ("SPRINTF_S failed]ret=%d", retVal); } - NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].lenth, + NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].length, (u16) itindex, pmeminfo[itindex].isocket_id); ptempdata++; @@ -526,7 +526,7 @@ nsfw_remote_shmem_mbf_createv (nsfw_mem_mbfpool * pmbfname, goto lerr; } - /*interrup msg head */ + /*interrupt msg head */ pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg); NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_MBUF_ACK_MSG, ieltnum * sizeof (nsfw_shmem_ack), @@ -737,7 +737,7 @@ nsfw_remote_shmem_mpcreatev (nsfw_mem_sppool * pmpinfo, goto mperr; } - /*interrup mgs head */ + /*interrupt mgs head */ pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg); NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_SPPOOL_ACK_MSG, ieltnum * sizeof (nsfw_shmem_ack), @@ -851,7 +851,7 @@ nsfw_remote_shmem_ringcreate (const char *name, unsigned int n, i32 socket_id, goto release; } - /*interrup mgs head */ + /*interrupt mgs head */ pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg); NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_RING_ACK_MSG, sizeof (nsfw_shmem_ack), release); @@ -871,8 +871,8 @@ release: /* *create a mem pool that the members are rings by send a msg *ieltnum:the num of ring member - *iringnum:the num of ring in simple mem pook - *entype:the defualt the of ring + *iringnum:the num of ring in simple mem pool + *entype:the default the of ring */ i32 nsfw_remote_shmem_ringcreatev (const char *name, i32 ieltnum, @@ -951,7 +951,7 @@ nsfw_remote_shmem_lookup (const i8 * name, nsfw_mem_struct_type entype) pdata = NSFW_SHMEM_GET_DATA (pdata_head, nsfw_shmem_lookup_req); if (EOK != STRCPY_S (pdata->aname, sizeof (pdata->aname), name)) { - NSCOMM_LOGERR ("STRCPY_S faild]name=%s", name); + NSCOMM_LOGERR ("STRCPY_S failed]name=%s", name); } pdata->usseq = 0; pdata->ustype = entype; @@ -965,7 +965,7 @@ nsfw_remote_shmem_lookup (const i8 * name, nsfw_mem_struct_type entype) goto release; } - /*interrup mgs head */ + /*interrupt mgs head */ pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg); NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_MEM_LOOKUP_ACK_MSG, sizeof (nsfw_shmem_ack), perr); diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c index e7a11ad..2e9c969 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c @@ -40,7 +40,7 @@ nsfw_mem_ops g_shmem_ops = { nsfw_shmem_ringcreate, nsfw_shmem_ring_lookup, nsfw_shmem_ringrelease, - nsfw_shmem_stactic, + nsfw_shmem_static, nsfw_shmem_mbuf_recycle, nsfw_shmem_sp_iterator, nsfw_shmem_mbuf_iterator diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c index f85e70d..270e0f8 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c @@ -155,23 +155,23 @@ nsfw_shmem_create (nsfw_mem_zone * pinfo) NSFW_INIT_CHK_RET_NULL ()if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG) { return common_memzone_data_reserve_name (pinfo->stname.aname, - pinfo->lenth, + pinfo->length, pinfo->isocket_id); } else { - /*app must less than NSFW_MEM_APPNAME_LENTH */ + /*app must less than NSFW_MEM_APPNAME_LENGTH */ NSFW_NAME_LENCHECK_RET_NULL (pinfo->stname.aname, "shmem create") if (-1 == SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pinfo->stname.aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); return NULL; } } - return nsfw_memzone_remote_reserv ((char *) &aname[0], pinfo->lenth, + return nsfw_memzone_remote_reserv ((char *) &aname[0], pinfo->length, SOCKET_ID_ANY); } @@ -220,20 +220,20 @@ nsfw_shmem_lookup (nsfw_mem_name * pname) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s", pname->aname); if (-1 == retVal) { - NSCOMM_LOGERR ("SPRINTF_S faild"); + NSCOMM_LOGERR ("SPRINTF_S failed"); return NULL; } } else { - /*app must less than NSFW_MEM_APPNAME_LENTH */ + /*app must less than NSFW_MEM_APPNAME_LENGTH */ NSFW_NAME_LENCHECK_RET_NULL (pname->aname, "shmem lookup") int retVal = SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pname->aname, NSFW_SHMEM_PID); if (-1 == retVal) { - NSCOMM_LOGERR ("SPRINTF_S faild"); + NSCOMM_LOGERR ("SPRINTF_S failed"); return NULL; } } @@ -265,7 +265,7 @@ nsfw_shmem_release (nsfw_mem_name * pname) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pname->aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild"); + NSCOMM_LOGERR ("SPRINTF_S failed"); return NSFW_MEM_ERR; } } @@ -291,13 +291,13 @@ nsfw_shmem_mbfmpcreate (nsfw_mem_mbfpool * pbufinfo) } else { - /*app must less than NSFW_MEM_APPNAME_LENTH */ + /*app must less than NSFW_MEM_APPNAME_LENGTH */ NSFW_NAME_LENCHECK_RET_NULL (pbufinfo->stname.aname, "mbufpool create") if (-1 == SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pbufinfo->stname.aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -374,18 +374,18 @@ nsfw_shmem_mbfmplookup (nsfw_mem_name * pmbfname) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s", pmbfname->aname)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } else { - /*app must less than NSFW_MEM_APPNAME_LENTH */ + /*app must less than NSFW_MEM_APPNAME_LENGTH */ NSFW_NAME_LENCHECK_RET_NULL (pmbfname->aname, "shmem lookup") if (-1 == SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pmbfname->aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -412,7 +412,7 @@ nsfw_shmem_spcreate (nsfw_mem_sppool * pmpinfo) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pmpinfo->stname.aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -512,7 +512,7 @@ nswf_shmem_sp_ringcreate (nsfw_mem_mring * prpoolinfo, prpoolinfo->stname.aname, NSFW_SHMEM_PID); if (-1 == retVal) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -549,7 +549,7 @@ nsfw_shmem_sprelease (nsfw_mem_name * pname) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pname->aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -584,18 +584,18 @@ nsfw_shmem_sp_lookup (nsfw_mem_name * pname) if (-1 == SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s", pname->aname)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S fails]"); } } else { - /*app's name can not over NSFW_MEM_APPNAME_LENTH */ + /*app's name can not over NSFW_MEM_APPNAME_LENGTH */ NSFW_NAME_LENCHECK_RET_NULL (pname->aname, "shmem lookup") if (-1 == SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pname->aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -622,7 +622,7 @@ nsfw_shmem_ringcreate (nsfw_mem_mring * pringinfo) SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pringinfo->stname.aname, NSFW_SHMEM_PID)) { - NSCOMM_LOGERR ("SPRINTF_S faild]"); + NSCOMM_LOGERR ("SPRINTF_S failed]"); } } @@ -680,7 +680,7 @@ nsfw_shmem_ring_statics (mring_handle handle) } ssize_t -nsfw_shmem_stactic (void *handle, nsfw_mem_struct_type type) +nsfw_shmem_static (void *handle, nsfw_mem_struct_type type) { switch (type) { @@ -737,7 +737,7 @@ nsfw_shmem_mbuf_recycle (mpool_handle handle) 1.if proc.head != proc.tail set proc.head to proc.tail [may lost some buf,but the queue still can use] App May not putIn Data , just done head++, we can't set proc.tail to proc.head. 2.if cons.head != cons.tail set cons.tail to cons.head [may lost some buf,but the queue still can use] - App May alread finish deque,just not tail++, we can't set cons.head to cons.tail. + App May already finish deque,just not tail++, we can't set cons.head to cons.tail. */ if ((rteRing->prod.head != rteRing->prod.tail) || (rteRing->cons.head != rteRing->cons.tail)) diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h index f81b34a..d489525 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h @@ -19,7 +19,7 @@ /* * mem mgr module init - * para:point to nstak_fwmem_para + * para:point to nstack_fwmem_para */ i32 nsfw_shmem_init (nsfw_mem_para * para); @@ -37,7 +37,7 @@ void nsfw_shmem_destroy (void); mzone_handle nsfw_shmem_create (nsfw_mem_zone * pinfo); /* - *create some blocks memeory + *create some blocks memory */ i32 nsfw_shmem_createv (nsfw_mem_zone * pmeminfo, i32 inum, mzone_handle * paddr_array, i32 iarray_num); @@ -72,7 +72,7 @@ mbuf_handle nsfw_shmem_mbfalloc (mpool_handle mhandle); i32 nsfw_shmem_mbffree (mbuf_handle mhandle); /* - *put mbuf backto mbuf pool + *put mbuf back to mbuf pool */ i32 nsfw_shmem_mbfmprelease (nsfw_mem_name * pname); @@ -121,7 +121,7 @@ mring_handle nsfw_shmem_ring_lookup (nsfw_mem_name * pname); */ i32 nsfw_shmem_ringrelease (nsfw_mem_name * pname); -ssize_t nsfw_shmem_stactic (void *handle, nsfw_mem_struct_type type); +ssize_t nsfw_shmem_static (void *handle, nsfw_mem_struct_type type); i32 nsfw_shmem_mbuf_recycle (mpool_handle handle); diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c index af46e18..c42c840 100644 --- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c +++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c @@ -119,7 +119,7 @@ nsfw_shmem_pool_create (const char *name, unsigned int n, unsigned int num = common_mem_align32pow2 (n + 1); struct nsfw_shmem_ring_head *pcur = NULL; - /*calculat the empty rte_perf_ring Size */ + /*calculate the empty rte_perf_ring Size */ size_t len = sizeof (struct nsfw_shmem_ring_head) + sizeof (struct nsfw_mem_ring) + (size_t) num * sizeof (union RingData_U) + (size_t) num * elt_size; @@ -258,7 +258,7 @@ nsfw_shmem_pool_create (const char *name, unsigned int n, break; } - // second time allocate should not containd all ring head + // second time allocate should not contained all ring head alloc_len = (size_t) (num - alloc_index) * elt_size + sizeof (struct nsfw_shmem_ring_head); @@ -341,7 +341,7 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box) if (tmpTail + size - CurHead == 0) { /* - here we give enque a chance to recorrect the Tail, if tail not has Data let tail++ + here we give enqueue a chance to recorrect the Tail, if tail not has Data let tail++ */ if (ring->ring[tmpTail & mask].data_s.val == 0) { @@ -374,10 +374,10 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box) { /* enqueue success, add Head Value now - here we using CAS set instead __sync_fetch_and_add(&ring->Head, 1) to assume that, if one process enque sucess && been killed before + here we using CAS set instead __sync_fetch_and_add(&ring->Head, 1) to assume that, if one process enqueue success && been killed before add Head, other process can recorrect the Head Value; one more thing the direction of Tail must been add-direction, so we using the condition (ring->Head - CurHead >0x80000000); - while many thread do enque at same time, Head may not correct,exp: + while many thread do enqueue at same time, Head may not correct,exp: thread A get old head 10, thread A want set head to 11 thread B get old head 10, thread B want set head to 12 thread A do CAS && thread B do CAS at same time, thread A do CAS success; @@ -385,7 +385,7 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box) then thread C get old head 11, thread C will set head to 13[cause pos 12 already has value, thread C will skill 12], the head will be recorrect by thread C. - if no thread C, thread A& B are the last enque thread; the head must recorrect by the deque function. + if no thread C, thread A& B are the last enqueue thread; the head must recorrect by the deque function. */ tmpHead = ring->prod.head; @@ -441,7 +441,7 @@ nsfw_shmem_ring_sp_enqueue (struct nsfw_mem_ring *ring, void *box) if (tmpTail + uisize - CurHead == 0) { /* - *here we give enque a chance to recorrect the Tail, if tail not has Data let tail++ + *here we give enqueue a chance to recorrect the Tail, if tail not has Data let tail++ */ if (ring->ring[tmpTail & mask].data_s.val == 0) { @@ -523,7 +523,7 @@ nsfw_shmem_ring_mc_dequeue (struct nsfw_mem_ring *ring, void **box) /* enqueue success, add Tail Value now - here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue sucess && been killed before + here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue success && been killed before add Tail, other process can recorrect the Tail Value; one more thing the direction of Tail must been add-direction, so we using the condition (rlTail - CurTail >0x80000000); while multi CAS done the result value of CurTail may not correct, but we don't care, it will be recorrect while next deque done. @@ -611,7 +611,7 @@ nsfw_shmem_ring_mc_dequeuev (struct nsfw_mem_ring *ring, void **box, /* enqueue success, add Tail Value now - here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue sucess && been killed before + here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue success && been killed before add Tail, other process can recorrect the Tail Value; one more thing the direction of Tail must been add-direction, so we using the condition (rlTail - CurTail >0x80000000); @@ -790,7 +790,7 @@ nsfw_shmem_ring_singlethread_dequeue (struct nsfw_mem_ring *ring, void **box) { u32 tail = 0; - /* if all entries are dequed return 0 */ + /* if all entries are dequeued return 0 */ if (unlikely (ring->prod.head == ring->cons.tail)) { return 0; @@ -818,7 +818,7 @@ nsfw_shmem_ring_singlethread_dequeuev (struct nsfw_mem_ring *ring, void **box, { tail = ring->cons.tail; - /* if all entries are dequed return 0 */ + /* if all entries are dequeued return 0 */ if (unlikely (ring->prod.head == ring->cons.tail)) { return num; diff --git a/src/framework/include/nsfw_init.h b/src/framework/include/nsfw_init.h index def97b2..0237060 100644 --- a/src/framework/include/nsfw_init.h +++ b/src/framework/include/nsfw_init.h @@ -33,7 +33,7 @@ extern "C"{ #define NSFW_SET_INSTANCE_VALUE(_attr, _inst, _value) \ nsfw_module_set_instance_##_attr(_inst, _value) -#define NSFW_INIT_CRAETE_LOCAL_INSTANCE() \ +#define NSFW_INIT_CREATE_LOCAL_INSTANCE() \ if (!nsfwLocalInitInst) {\ nsfwLocalInitInst = nsfw_module_create_instance(); \ nsfw_module_add_instance(nsfwLocalInitInst);\ @@ -41,7 +41,7 @@ extern "C"{ #define _NSFW_MODULE_ATTRIBUTE_DEFINE_SURFIX(_attr, _value, _priority, _surfix) \ static __attribute__((__constructor__(_priority))) void nsfw_module_attribute_##_attr##_surfix(void){\ - NSFW_INIT_CRAETE_LOCAL_INSTANCE(); \ + NSFW_INIT_CREATE_LOCAL_INSTANCE(); \ NSFW_SET_INSTANCE_VALUE(_attr, nsfwLocalInitInst, _value);\ } \ @@ -123,8 +123,8 @@ extern void nsfw_module_set_instance_depends (nsfw_module_instance_t * inst, /** * @Function nstack_framework_init - * @Description This function will do framework initial work, it will involk all initial functions - * registed using macro NSFW_MODULE_INIT before + * @Description This function will do framework initial work, it will invoke all initial functions + * registered using macro NSFW_MODULE_INIT before * @param none * @return 0 on success, -1 on error */ diff --git a/src/framework/include/nsfw_maintain_api.h b/src/framework/include/nsfw_maintain_api.h index 74cedf6..bf0d45e 100644 --- a/src/framework/include/nsfw_maintain_api.h +++ b/src/framework/include/nsfw_maintain_api.h @@ -72,8 +72,8 @@ typedef int (*nsfw_res_free_fun) (void *pdata); typedef struct _nsfw_res_scn_cfg { u8 type; /*nsfw_res_scan_type */ - u8 force_free_percent; /*if the resource free percent below this vlaue, begin to force free the element */ - u16 force_free_chk_num; /*if the check count beyone this vlaue, call free fun release this element */ + u8 force_free_percent; /*if the resource free percent below this value, begin to force free the element */ + u16 force_free_chk_num; /*if the check count beyone this value, call free fun release this element */ u16 alloc_speed_factor; /*alloc fast with higher value */ u32 num_per_cyc; /*define the element number in one scan cycle process and increase chk_count of every element */ @@ -174,7 +174,7 @@ typedef struct _nsfw_set_log_msg #define SPL_DFX_RES_CONN "conn" #define SPL_DFX_RES_L2TO4 "l2to4" #define SPL_DFX_RES_UNMATCH "version" -#define SPL_DFX_RES_SOCKT_CB "socketcb" +#define SPL_DFX_RES_SOCKET_CB "socketcb" #define SPL_DFX_RES_COMM_MEMPOOL "mbufpool" #define SPL_DFX_RES_PCBLIST "pcblist" #define SPL_DFX_RES_ARPLIST "arplist" diff --git a/src/framework/include/nsfw_mem_api.h b/src/framework/include/nsfw_mem_api.h index ec78692..68adbe1 100644 --- a/src/framework/include/nsfw_mem_api.h +++ b/src/framework/include/nsfw_mem_api.h @@ -28,8 +28,8 @@ /* *the max len of memory name is 32bytes, but app just can use max 22bytes, left 10bytes to memory manager module */ -#define NSFW_MEM_NAME_LENTH (32) -#define NSFW_MEM_APPNAME_LENTH (22) +#define NSFW_MEM_NAME_LENGTH (32) +#define NSFW_MEM_APPNAME_LENGTH (22) #define NSFW_SOCKET_ANY (-1) #define NSFW_MEM_OK (0) @@ -50,9 +50,9 @@ typedef enum /*type of ring operation*/ typedef enum { - NSFW_MRING_SPSC, /*sigle producer sigle consumer ring */ - NSFW_MRING_MPSC, /*multi producer sigle consumer ring */ - NSFW_MRING_SPMC, /*sigle producer multi consumer ring */ + NSFW_MRING_SPSC, /*single producer single consumer ring */ + NSFW_MRING_MPSC, /*multi producer single consumer ring */ + NSFW_MRING_SPMC, /*single producer multi consumer ring */ NSFW_MRING_MPMC, /*multi producer multi consumer ring */ NSFW_MRING_SPSC_ST, /*single producer single consumer and belong to one thread ring */ NSFW_MPOOL_TYPEMAX, @@ -83,13 +83,13 @@ typedef struct * must add '_0' at the end of name, if the memory was created by app and the role of process is NSFW_PROC_MASTER, must add * _(pid) at the end of name, nstack_123. */ - i8 aname[NSFW_MEM_NAME_LENTH]; /*the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. */ + i8 aname[NSFW_MEM_NAME_LENGTH]; /*the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ } nsfw_mem_name; typedef struct { nsfw_mem_name stname; - size_t lenth; + size_t length; i32 isocket_id; i32 ireserv; } nsfw_mem_zone; @@ -156,7 +156,7 @@ typedef enum typedef struct __nsfw_shmem_msg_head { unsigned usmsg_type; - unsigned uslenth; + unsigned uslength; i32 aidata[0]; } nsfw_shmem_msg_head; @@ -171,17 +171,17 @@ typedef struct __nsfw_shmem_ack typedef struct __nsfw_shmem_reserv_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 usreserv; i32 isocket_id; - size_t lenth; + size_t length; i32 ireserv; } nsfw_shmem_reserv_req; typedef struct __nsfw_shmem_mbuf_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 enmptype; unsigned usnum; @@ -194,7 +194,7 @@ typedef struct __nsfw_shmem_mbuf_req typedef struct __nsfw_shmem_sppool_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 enmptype; u32 usnum; @@ -205,7 +205,7 @@ typedef struct __nsfw_shmem_sppool_req typedef struct __nsfw_shmem_ring_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 enmptype; u32 usnum; @@ -215,7 +215,7 @@ typedef struct __nsfw_shmem_ring_req typedef struct __nsfw_shmem_free_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 ustype; /*structure of memory(memzone,mbuf,mpool,ring) */ i32 ireserv; @@ -223,7 +223,7 @@ typedef struct __nsfw_shmem_free_req typedef struct __nsfw_shmem_lookup_req { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; u16 usseq; u16 ustype; /*structure of memory(memzone,mbuf,mpool,ring) */ i32 ireserv; @@ -243,7 +243,7 @@ typedef struct /* * memory module init - * para:point to nstak_fwmem_para + * para:point to nstack_fwmem_para */ i32 nsfw_mem_init (void *para); @@ -251,20 +251,20 @@ i32 nsfw_mem_init (void *para); * create a block memory with name * nsfw_mem_zone::stname * nsfw_mem_zone::isize - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ mzone_handle nsfw_mem_zone_create (nsfw_mem_zone * pinfo); /* *create some memory blocks - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_zone_createv (nsfw_mem_zone * pmeminfo, i32 inum, mzone_handle * paddr_array, i32 iarray_num); /* *look up a memory - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory, * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -288,7 +288,7 @@ mpool_handle nsfw_mem_mbfmp_create (nsfw_mem_mbfpool * pbufinfo); /* *create some mbuf pools - * note: 1. the name of lenth must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the name of length must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_mbfmp_createv (nsfw_mem_mbfpool * pmbfname, i32 inum, mpool_handle * phandle_array, i32 iarray_num); @@ -305,7 +305,7 @@ i32 nsfw_mem_mbf_free (mbuf_handle mhandle, nsfw_mem_type entype); /* *look up mbuf mpool - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -321,39 +321,39 @@ mpool_handle nsfw_mem_mbfmp_lookup (nsfw_mem_name * pmbfname); /* *release mbuf pool - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_mbfmp_release (nsfw_mem_name * pname); /* *create a simple pool - *note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + *note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ mring_handle nsfw_mem_sp_create (nsfw_mem_sppool * pmpinfo); /* *create some simple pools one time - *note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + *note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_sp_createv (nsfw_mem_sppool * pmpinfo, i32 inum, mring_handle * pringhandle_array, i32 iarray_num); /* *create a simple pool with many rings - *note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + *note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_sp_ring_create (nsfw_mem_mring * prpoolinfo, mring_handle * pringhandle_array, i32 iringnum); /* *release a simple mempool - *note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + *note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_sp_release (nsfw_mem_name * pname); /* *look up a simpile ring - * note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory, * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -369,15 +369,15 @@ mring_handle nsfw_mem_sp_lookup (nsfw_mem_name * pname); /* *create a ring - *note: 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. - * 2. shared memory ring (NSFW_SHMEM) just can put a pointor into the queue, the queue also point to a shared block memory. + *note: 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. + * 2. shared memory ring (NSFW_SHMEM) just can put a pointer into the queue, the queue also point to a shared block memory. * no shared memory ring(NSFW_NSHMEM) is other wise. */ mring_handle nsfw_mem_ring_create (nsfw_mem_mring * pringinfo); /* *look up a ring by name - * note:1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + * note:1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory, * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -402,7 +402,7 @@ extern nsfw_ring_ops g_ring_ops_arry[NSFW_MEM_TYPEMAX][NSFW_MPOOL_TYPEMAX]; /***************************************************************************** * Prototype : nsfw_mem_ring_dequeue * Description : get a member from a ring -* note : if NSFW_SHMEM ring, pdata returned alread a local address +* note : if NSFW_SHMEM ring, pdata returned already a local address * Input : mring_handle mhandle * void** pdata * Output : None @@ -429,7 +429,7 @@ nsfw_mem_ring_dequeue (mring_handle mhandle, void **pdata) /***************************************************************************** * Prototype : nsfw_mem_ring_dequeuev * Description : get some members from a ring -* note : if NSFW_SHMEM ring, pdata returned alread a local address +* note : if NSFW_SHMEM ring, pdata returned already a local address * Input : mring_handle mhandle * void** pdata * unsigned inum @@ -501,14 +501,14 @@ u32 nsfw_mem_ring_size (mring_handle mhandle); /* *release a ring memory - *note: the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. + *note: the length of name must be less than NSFW_MEM_APPNAME_LENGTH. */ i32 nsfw_mem_ring_release (nsfw_mem_name * pname); /* *statics mbufpool, sppool, ring mem size *return: <=0, err happen, >0 mem size - * NSFW_MEM_MZONE: not surport because you already know the lenth when create + * NSFW_MEM_MZONE: not surport because you already know the length when create */ ssize_t nsfw_mem_get_len (void *handle, nsfw_mem_struct_type type); @@ -530,14 +530,14 @@ i32 nsfw_mem_mbuf_iterator (mpool_handle handle, u32 start, u32 end, * Description : print ring info * Input : mring_handle mhandle * char *pbuf -* int lenth +* int length * Output : None * Return Value : i32 * Calls : * Called By : * *****************************************************************************/ -i32 nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int lenth); +i32 nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int length); #ifdef SYS_MEM_RES_STAT u32 nsfw_mem_mbfpool_free_count (mpool_handle mhandle); diff --git a/src/framework/include/nsfw_mgr_com_api.h b/src/framework/include/nsfw_mgr_com_api.h index 099cdbc..094043e 100644 --- a/src/framework/include/nsfw_mgr_com_api.h +++ b/src/framework/include/nsfw_mgr_com_api.h @@ -46,7 +46,7 @@ typedef enum _mgr_msg_type MGR_MSG_MEM_ALLOC_REQ = 64, /* memory msg type */ /*############################################# */ - MGR_MSG_DFX_QRY_REQ = 96, /* nStackCtrl maitain msg */ + MGR_MSG_DFX_QRY_REQ = 96, /* nStackCtrl maintain msg */ MGR_MSG_SET_LOG_REQ, /*############################################# */ @@ -59,7 +59,7 @@ typedef enum _mgr_msg_type /*###query message with large rsp message begin## */ MGR_MSG_LARGE_QRY_REQ_BEGIN = 384, MGR_MSG_LARGE_STA_QRY_REQ = MGR_MSG_LARGE_QRY_REQ_BEGIN, - MGR_MSG_LARGE_MT_QRY_REQ, /* nStackCtrl maitain msg */ + MGR_MSG_LARGE_MT_QRY_REQ, /* nStackCtrl maintain msg */ /*############################################# */ MGR_MSG_LARGE_ALARM_REQ = 500, /* alarm msg type */ @@ -112,7 +112,7 @@ typedef enum _fw_poc_type typedef enum _nsfw_mgr_msg_rsp_code { - NSFW_MGR_SUCESS, + NSFW_MGR_SUCCESS, NSFW_MGR_MSG_TYPE_ERROR, } mgr_msg_rsp_code; diff --git a/src/framework/include/nsfw_recycle_api.h b/src/framework/include/nsfw_recycle_api.h index fd2bd8f..9d7f3bb 100644 --- a/src/framework/include/nsfw_recycle_api.h +++ b/src/framework/include/nsfw_recycle_api.h @@ -41,7 +41,7 @@ typedef enum _nsfw_recycle_priority { NSFW_REC_PRO_HIGHTEST = 0, NSFW_REC_PRO_NORMAL = 1, - NSFW_REC_PRO_DEFALUT = 2, + NSFW_REC_PRO_DEFAULT = 2, NSFW_REC_PRO_LOWEST = 3, NSFW_REC_PRO_MAX = 4 } nsfw_recycle_priority; diff --git a/src/framework/include/nsfw_snapshot.h b/src/framework/include/nsfw_snapshot.h index 8958c64..5ce64aa 100644 --- a/src/framework/include/nsfw_snapshot.h +++ b/src/framework/include/nsfw_snapshot.h @@ -63,7 +63,7 @@ typedef struct _nsfw_ss_objDesc u16 objType; /* Type number of object */ u8 memNum; /* Nubmer of object members */ u32 objSize; - nsfw_ss_objMemDesc_t *memDesc; /* Member descripe */ + nsfw_ss_objMemDesc_t *memDesc; /* Member descript */ } nsfw_ss_objDesc_t; #define NSFW_SS_MAX_OBJDESC_NUM 256 @@ -81,8 +81,8 @@ extern nsfw_ss_objDescManager_t g_nsfw_ss_objDescManager; #define nsfw_ss_getObjDescManagerInst() (&g_nsfw_ss_objDescManager) /** - * @Function nsfw_ss_registe_ObjDesc - * @Description Registe object description to snapshot + * @Function nsfw_ss_register_ObjDesc + * @Description Register object description to snapshot * @param objDesc - description of object * @return void */ @@ -92,7 +92,7 @@ extern void nsfw_ss_register_ObjDesc (nsfw_ss_objDesc_t * objDesc); * @Function nsfw_ss_store * @Description store object to memory * @param (in) objType - type of object - * @param (in) obj - adderss of object memory + * @param (in) obj - address of object memory * @param (in) storeMem - address of memory to store object data * @param (in) storeMemLen - maximal length of storage memory * @return positive integer means length of memory cost on success. return -1 if error @@ -130,7 +130,7 @@ extern int nsfw_ss_getObjStoreMemLen (int objType); NSFW_SNAPSHOT_OBJDESC_REGISTER_SURFIX(_value, __LINE__) /** - * Using this marcro to register object description + * Using this macro to register object description */ #define NSFW_SS_REGSITER_OBJDESC(_value) \ NSFW_SNAPSHOT_OBJDESC_REGISTER_UNIQUE(_value) diff --git a/src/framework/include/nsfw_upgrade.h b/src/framework/include/nsfw_upgrade.h index a4e809c..d5cb5aa 100644 --- a/src/framework/include/nsfw_upgrade.h +++ b/src/framework/include/nsfw_upgrade.h @@ -32,9 +32,9 @@ extern "C" { #define USE_MEM_BIT(mem_bit, struct, mem) (mem_bit |= ((i64)1 << struct ## _ ## mem)) -#define UPGRADE_MEM_VAL(mem_bit, struct, mem, obj, defalut) { \ +#define UPGRADE_MEM_VAL(mem_bit, struct, mem, obj, default) { \ if (!GET_MEM_BIT(mem_bit, struct, mem)){ \ - obj->mem = defalut; \ + obj->mem = default; \ } \ } diff --git a/src/framework/init/fw_init.c b/src/framework/init/fw_init.c index 6337b67..2764479 100644 --- a/src/framework/init/fw_init.c +++ b/src/framework/init/fw_init.c @@ -247,8 +247,8 @@ nstack_framework_printInitialResult () /** * @Function nstack_framework_init - * @Description This function will do framework initial work, it will involk all initial functions - * registed using macro NSFW_MODULE_INIT before + * @Description This function will do framework initial work, it will invoke all initial functions + * registered using macro NSFW_MODULE_INIT before * @param none * @return 0 on success, -1 on error */ diff --git a/src/framework/init/fw_module.c b/src/framework/init/fw_module.c index 65bbb0a..1f22ecb 100644 --- a/src/framework/init/fw_module.c +++ b/src/framework/init/fw_module.c @@ -27,8 +27,8 @@ extern "C"{ /* *INDENT-ON* */ #endif /* __cplusplus */ -COMPAT_PROTECT (NSFW_MOUDLE_INSTANCE_POOL_SIZE, 64); -COMPAT_PROTECT (NSFW_MOUDLE_DEPENDS_POOL_SIZE, 128); +COMPAT_PROTECT (NSFW_MODULE_INSTANCE_POOL_SIZE, 64); +COMPAT_PROTECT (NSFW_MODULE_DEPENDS_POOL_SIZE, 128); nsfw_module_instance_pool_t g_nsfw_module_inst_pool; nsfw_module_depends_pool_t g_nsfw_module_deps_pool; @@ -40,7 +40,7 @@ nsfw_module_depends_pool_t g_nsfw_module_deps_pool; NSTACK_STATIC nsfw_module_instance_t * nsfw_module_malloc_instance () { - if (g_nsfw_module_inst_pool.last_idx >= NSFW_MOUDLE_INSTANCE_POOL_SIZE) + if (g_nsfw_module_inst_pool.last_idx >= NSFW_MODULE_INSTANCE_POOL_SIZE) { return NULL; } @@ -56,7 +56,7 @@ nsfw_module_malloc_instance () NSTACK_STATIC nsfw_module_depends_t * nsfw_module_malloc_depends () { - if (g_nsfw_module_deps_pool.last_idx >= NSFW_MOUDLE_DEPENDS_POOL_SIZE) + if (g_nsfw_module_deps_pool.last_idx >= NSFW_MODULE_DEPENDS_POOL_SIZE) { return NULL; } diff --git a/src/framework/init/fw_module.h b/src/framework/init/fw_module.h index 1cfc95f..0818aed 100644 --- a/src/framework/init/fw_module.h +++ b/src/framework/init/fw_module.h @@ -60,20 +60,20 @@ extern int nsfw_module_addDoneNode (nsfw_module_instance_t * inst); extern nsfw_module_manager_t g_nsfw_module_manager; #define nsfw_module_getManager() (&g_nsfw_module_manager) -#define NSFW_MOUDLE_INSTANCE_POOL_SIZE 64 -#define NSFW_MOUDLE_DEPENDS_POOL_SIZE 128 +#define NSFW_MODULE_INSTANCE_POOL_SIZE 64 +#define NSFW_MODULE_DEPENDS_POOL_SIZE 128 typedef struct _nsfw_module_instance_pool { int last_idx; nsfw_module_instance_t - module_instance_pool[NSFW_MOUDLE_INSTANCE_POOL_SIZE]; + module_instance_pool[NSFW_MODULE_INSTANCE_POOL_SIZE]; } nsfw_module_instance_pool_t; typedef struct _nsfw_module_depends_pool { int last_idx; - nsfw_module_depends_t module_depends_pool[NSFW_MOUDLE_DEPENDS_POOL_SIZE]; + nsfw_module_depends_t module_depends_pool[NSFW_MODULE_DEPENDS_POOL_SIZE]; } nsfw_module_depends_pool_t; #ifdef __cplusplus diff --git a/src/framework/ipc/mgr_com/mgr_com.c b/src/framework/ipc/mgr_com/mgr_com.c index 5cdb044..2b35e2c 100644 --- a/src/framework/ipc/mgr_com/mgr_com.c +++ b/src/framework/ipc/mgr_com/mgr_com.c @@ -50,7 +50,7 @@ extern "C"{ /* *INDENT-OFF* */ nsfw_mgr_msg_fun g_mgr_fun[MGR_MSG_MAX][NSFW_MGRCOM_MAX_PROC_FUN]; nsfw_mgr_init_cfg g_mgr_com_cfg; -nsfw_mgr_sock_map g_mgr_sockt_map = {{0}, NULL}; +nsfw_mgr_sock_map g_mgr_socket_map = {{0}, NULL}; nsfw_mgrcom_stat g_mgr_stat; nsfw_mgrcom_proc g_ep_proc = { 0 }; /* *INDENT-ON* */ @@ -87,7 +87,7 @@ nsfw_get_proc_name (u8 proc_type) /***************************************************************************** * Prototype : nsfw_mgr_reg_msg_fun -* Description : reg the callback funciton when receive new message +* Description : reg the callback function when receive new message * Input : u16 msg_type * nsfw_mgr_msg_fun fun * Output : None @@ -519,13 +519,13 @@ NSTACK_STATIC inline u8 nsfw_mgr_new_socket (i32 fd, u8 proc_type, u32 host_pid) { nsfw_mgr_sock_info *sock_info = NULL; - if (((i32) NSFW_MGR_FD_MAX <= fd) || (fd < 0) || (!g_mgr_sockt_map.sock)) + if (((i32) NSFW_MGR_FD_MAX <= fd) || (fd < 0) || (!g_mgr_socket_map.sock)) { - NSFW_LOGERR ("fd err]mgr_fd=%d, sock=%p", fd, g_mgr_sockt_map.sock); + NSFW_LOGERR ("fd err]mgr_fd=%d, sock=%p", fd, g_mgr_socket_map.sock); return FALSE; } - sock_info = &g_mgr_sockt_map.sock[fd]; + sock_info = &g_mgr_socket_map.sock[fd]; if (host_pid != sock_info->host_pid) { NSFW_LOGDBG @@ -538,7 +538,7 @@ nsfw_mgr_new_socket (i32 fd, u8 proc_type, u32 host_pid) if (proc_type < NSFW_PROC_MAX) { - g_mgr_sockt_map.proc_cache[proc_type] = fd; + g_mgr_socket_map.proc_cache[proc_type] = fd; } return TRUE; @@ -557,18 +557,18 @@ NSTACK_STATIC inline u8 nsfw_mgr_del_socket (u32 fd) { nsfw_mgr_sock_info *sock_info = NULL; - if ((NSFW_MGR_FD_MAX <= fd) || (!g_mgr_sockt_map.sock)) + if ((NSFW_MGR_FD_MAX <= fd) || (!g_mgr_socket_map.sock)) { - NSFW_LOGERR ("fd err]mgr_fd=%u, sock=%p", fd, g_mgr_sockt_map.sock); + NSFW_LOGERR ("fd err]mgr_fd=%u, sock=%p", fd, g_mgr_socket_map.sock); return FALSE; } - sock_info = &g_mgr_sockt_map.sock[fd]; + sock_info = &g_mgr_socket_map.sock[fd]; if (sock_info->proc_type < NSFW_PROC_MAX - && fd == g_mgr_sockt_map.proc_cache[sock_info->proc_type]) + && fd == g_mgr_socket_map.proc_cache[sock_info->proc_type]) { - g_mgr_sockt_map.proc_cache[sock_info->proc_type] = 0; + g_mgr_socket_map.proc_cache[sock_info->proc_type] = 0; } NSFW_LOGDBG ("del sock]mgr_fd=%u,type=%u,pid=%u", fd, @@ -597,17 +597,17 @@ nsfw_mgr_get_dst_socket (u8 proc_type, u32 dst_pid) if (proc_type < NSFW_PROC_MAX) { - fd = g_mgr_sockt_map.proc_cache[proc_type]; + fd = g_mgr_socket_map.proc_cache[proc_type]; } - if (!g_mgr_sockt_map.sock) + if (!g_mgr_socket_map.sock) { return -1; } if (fd > 0 && fd < (i32) NSFW_MGR_FD_MAX) { - sock_info = &g_mgr_sockt_map.sock[fd]; + sock_info = &g_mgr_socket_map.sock[fd]; if (sock_info->host_pid != 0) { if (0 == dst_pid || dst_pid == sock_info->host_pid) @@ -624,7 +624,7 @@ nsfw_mgr_get_dst_socket (u8 proc_type, u32 dst_pid) i32 i; for (i = 0; i < (i32) NSFW_MGR_FD_MAX; i++) { - sock_info = &g_mgr_sockt_map.sock[i]; + sock_info = &g_mgr_socket_map.sock[i]; if (sock_info->host_pid != 0 && proc_type == sock_info->proc_type) { if (0 == dst_pid || dst_pid == sock_info->host_pid) @@ -673,14 +673,14 @@ u8 nsfw_mgr_clr_fd_lock () { i32 i; - if (!g_mgr_sockt_map.sock) + if (!g_mgr_socket_map.sock) { NSFW_LOGERR ("clr fd lock fail, sock is null"); return FALSE; } for (i = 0; i < (i32) NSFW_MGR_FD_MAX; i++) { - common_mem_spinlock_init (&(g_mgr_sockt_map.sock[i].opr_lock)); + common_mem_spinlock_init (&(g_mgr_socket_map.sock[i].opr_lock)); } return TRUE; } @@ -1063,7 +1063,7 @@ nsfw_mgr_msg_in (i32 fd) } NSFW_LOGERR ("drop msg]" MSGINFO, PRTMSG (msg)); - /* fix "Out-of-bounds write" type codedex issue */ + /* fix "Out-of-bounds write" type codex issue */ if (msg->msg_type < MGR_MSG_MAX) { g_mgr_stat.recv_drop[msg->msg_type]++; @@ -1075,7 +1075,7 @@ nsfw_mgr_msg_in (i32 fd) /***************************************************************************** * Prototype : nsfw_mgr_new_msg -* Description : when new mgr message recive from socket, this funciton +* Description : when new mgr message receive from socket, this function will call back * Input : i32 epfd * i32 fd @@ -1142,7 +1142,7 @@ nsfw_mgr_com_socket_error (i32 fd, nsfw_mgr_sock_fun fun, i32 timer) /***************************************************************************** * Prototype : nsfw_mgr_new_connection -* Description : when new mgr connection in, this funciton will call back +* Description : when new mgr connection in, this function will call back * Input : i32 epfd * i32 fd * u32 events @@ -1164,7 +1164,7 @@ nsfw_mgr_new_connection (i32 epfd, i32 fd, u32 events) if (listen_fd < 0) { NSFW_LOGERR - ("get listen_fd faied!]epfd=%d,listen_fd=%d,event=0x%x", epfd, + ("get listen_fd failed!]epfd=%d,listen_fd=%d,event=0x%x", epfd, fd, events); return FALSE; } @@ -1225,7 +1225,7 @@ nsfw_mgr_new_connection (i32 epfd, i32 fd, u32 events) /***************************************************************************** * Prototype : nsfw_set_sock_block -* Description : set fd blok or not for epoll thread +* Description : set fd block or not for epoll thread * Input : i32 sock * u8 flag * Output : None @@ -1507,15 +1507,15 @@ nsfw_sock_add_to_ep (i32 epfd) u8 nsfw_mgr_com_start () { - i32 listern_fd = nsfw_mgr_get_listen_socket (); - if (listern_fd < 0) + i32 listen_fd = nsfw_mgr_get_listen_socket (); + if (listen_fd < 0) { - NSFW_LOGERR ("get listern_fd failed!"); + NSFW_LOGERR ("get listen_fd failed!"); return FALSE; } - NSFW_LOGINF ("start mgr_com module!] listern_fd=%d", listern_fd); - (void) nsfw_mgr_reg_sock_fun (listern_fd, nsfw_mgr_new_connection); + NSFW_LOGINF ("start mgr_com module!] listen_fd=%d", listen_fd); + (void) nsfw_mgr_reg_sock_fun (listen_fd, nsfw_mgr_new_connection); return TRUE; } @@ -1714,7 +1714,7 @@ nsfw_mgr_com_chk_hbt (int v_add) /***************************************************************************** * Prototype : nsfw_mgr_comm_fd_destroy -* Description : free the memeory +* Description : free the memory * Input : * Output : None * Return Value : int @@ -1729,10 +1729,10 @@ nsfw_mgr_comm_fd_destroy () free (g_ep_proc.ep_fun); g_ep_proc.ep_fun = NULL; } - if (g_mgr_sockt_map.sock) + if (g_mgr_socket_map.sock) { - free (g_mgr_sockt_map.sock); - g_mgr_sockt_map.sock = NULL; + free (g_mgr_socket_map.sock); + g_mgr_socket_map.sock = NULL; } return; } @@ -1750,7 +1750,7 @@ int nsfw_mgr_comm_fd_init (u32 proc_type) { /*only app need to do this */ - if ((g_mgr_sockt_map.sock) && (g_ep_proc.ep_fun)) + if ((g_mgr_socket_map.sock) && (g_ep_proc.ep_fun)) { return 0; } @@ -1773,18 +1773,18 @@ nsfw_mgr_comm_fd_init (u32 proc_type) } } NSFW_LOGINF ("] final max fd=%d", NSFW_MGR_FD_MAX); - if (!g_mgr_sockt_map.sock) + if (!g_mgr_socket_map.sock) { - g_mgr_sockt_map.sock = + g_mgr_socket_map.sock = (nsfw_mgr_sock_info *) malloc (sizeof (nsfw_mgr_sock_info) * NSFW_MGR_FD_MAX); - if (NULL == g_mgr_sockt_map.sock) + if (NULL == g_mgr_socket_map.sock) { NSFW_LOGERR ("malloc fail] length=%d", sizeof (nsfw_mgr_sock_info) * NSFW_MGR_FD_MAX); return -1; } - (void) MEMSET_S (g_mgr_sockt_map.sock, + (void) MEMSET_S (g_mgr_socket_map.sock, sizeof (nsfw_mgr_sock_info) * NSFW_MGR_FD_MAX, 0, sizeof (nsfw_mgr_sock_info) * NSFW_MGR_FD_MAX); } diff --git a/src/framework/ipc/mgr_com/mgr_com.h b/src/framework/ipc/mgr_com/mgr_com.h index c4333a1..a5cdfcf 100644 --- a/src/framework/ipc/mgr_com/mgr_com.h +++ b/src/framework/ipc/mgr_com/mgr_com.h @@ -123,14 +123,14 @@ u8 nsfw_mgr_stop (); #define LOCK_MGR_FD(_fd){\ if ((i32)NSFW_MGR_FD_MAX > _fd)\ {\ - common_mem_spinlock_lock(&g_mgr_sockt_map.sock[_fd].opr_lock);\ + common_mem_spinlock_lock(&g_mgr_socket_map.sock[_fd].opr_lock);\ }\ } #define UNLOCK_MGR_FD(_fd){\ if ((i32)NSFW_MGR_FD_MAX > _fd)\ {\ - common_mem_spinlock_unlock(&g_mgr_sockt_map.sock[_fd].opr_lock);\ + common_mem_spinlock_unlock(&g_mgr_socket_map.sock[_fd].opr_lock);\ }\ } diff --git a/src/framework/ipc/ps/nsfw_fd_timer.c b/src/framework/ipc/ps/nsfw_fd_timer.c index 57535a3..8c73ec0 100644 --- a/src/framework/ipc/ps/nsfw_fd_timer.c +++ b/src/framework/ipc/ps/nsfw_fd_timer.c @@ -243,7 +243,7 @@ nsfw_timer_notify_fun (i32 epfd, i32 fd, u32 events) i32 timer_fd = nsfw_get_timer_socket (); if (timer_fd < 0) { - NSFW_LOGERR ("get timer_fd faied!]epfd=%d,timer_fd=%d,event=0x%x", + NSFW_LOGERR ("get timer_fd failed!]epfd=%d,timer_fd=%d,event=0x%x", epfd, fd, events); return FALSE; } @@ -340,7 +340,7 @@ nsfw_timer_module_init (void *param) pmpinfo.isocket_id = NSFW_SOCKET_ANY; pmpinfo.stname.entype = NSFW_NSHMEM; if (-1 == - SPRINTF_S (pmpinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pmpinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", "MS_TM_INFOPOOL")) { NSFW_LOGERR ("SPRINTF_S failed"); diff --git a/src/framework/ipc/ps/nsfw_ps_mem_module.c b/src/framework/ipc/ps/nsfw_ps_mem_module.c index 9cda6b3..55af158 100644 --- a/src/framework/ipc/ps/nsfw_ps_mem_module.c +++ b/src/framework/ipc/ps/nsfw_ps_mem_module.c @@ -132,7 +132,7 @@ mem_alloc_ps_info (u32 pid, u8 proc_type) pps_info = nsfw_ps_info_alloc (pid, proc_type); if (NULL == pps_info) { - NSFW_LOGERR ("alloc ps_info falied!]pid=%u,proc_type=%u", pid, + NSFW_LOGERR ("alloc ps_info failed!]pid=%u,proc_type=%u", pid, proc_type); return FALSE; } @@ -240,7 +240,7 @@ mem_item_get_cfg_from_msg (u16 msg_type) /***************************************************************************** * Prototype : mem_item_get_callargv -* Description : change the message value to structur value +* Description : change the message value to structure value * Input : u16 msg_type * char* msg_body * char *memstr_buf @@ -257,7 +257,7 @@ mem_item_get_callargv (u16 msg_type, char *msg_body, char *memstr_buf, switch (msg_type) { case NSFW_RESERV_REQ_MSG: - MEM_GET_CALLARGV (lenth, lenth, nsfw_mem_zone, nsfw_shmem_reserv_req, + MEM_GET_CALLARGV (length, length, nsfw_mem_zone, nsfw_shmem_reserv_req, memstr_buf, msg_body); MEM_GET_CALLARGV (isocket_id, isocket_id, nsfw_mem_zone, nsfw_shmem_reserv_req, memstr_buf, msg_body); @@ -308,7 +308,7 @@ mem_item_get_callargv (u16 msg_type, char *msg_body, char *memstr_buf, } if (EOK != STRCPY_S (((nsfw_mem_zone *) memstr_buf)->stname.aname, - NSFW_MEM_NAME_LENTH, + NSFW_MEM_NAME_LENGTH, ((nsfw_shmem_reserv_req *) msg_body)->aname)) { NSFW_LOGERR ("STRCPY_S failed]msg_type=%u", msg_type); @@ -467,10 +467,10 @@ mem_init_rsp_msg (nsfw_shmem_msg_head * msg, nsfw_shmem_msg_head * rsp) } int idx; - int mem_count = msg->uslenth / item_cfg->item_size; + int mem_count = msg->uslength / item_cfg->item_size; rsp->usmsg_type = msg->usmsg_type + 1; - rsp->uslenth = mem_count * sizeof (nsfw_shmem_ack); + rsp->uslength = mem_count * sizeof (nsfw_shmem_ack); nsfw_shmem_ack *pack = (nsfw_shmem_ack *) & (rsp->aidata[0]); char *pdata = NULL; for (idx = 0; idx < mem_count; idx++) @@ -511,7 +511,7 @@ mem_rel_mem_by_msg (nsfw_shmem_msg_head * req_msg, return FALSE; } - unsigned int mem_count = req_msg->uslenth / item_cfg->item_size; + unsigned int mem_count = req_msg->uslength / item_cfg->item_size; char *pdata = NULL; nsfw_shmem_ack *pack = (nsfw_shmem_ack *) & (rsp->aidata[0]); for (i = 0; i < mem_count; i++) @@ -552,7 +552,7 @@ mem_lookup_mem_by_msg (nsfw_shmem_msg_head * mgr_msg, return FALSE; } - int mem_count = mgr_msg->uslenth / item_cfg->item_size; + int mem_count = mgr_msg->uslength / item_cfg->item_size; char *pdata = NULL; void *paddr = NULL; nsfw_shmem_ack *pack = (nsfw_shmem_ack *) & (rsp->aidata[0]); @@ -600,7 +600,7 @@ mem_alloc_mem_by_msg (nsfw_shmem_msg_head * mem_msg, char *pdata = NULL; void *p_addr = NULL; - int mem_count = mem_msg->uslenth / item_cfg->item_size; + int mem_count = mem_msg->uslength / item_cfg->item_size; nsfw_shmem_ack *pack = (nsfw_shmem_ack *) & (rsp->aidata[0]); for (i = 0; i < mem_count; i++) { @@ -630,7 +630,7 @@ fail_free_mem: { pdata = (char *) mem_msg->aidata + j * item_cfg->item_size; if (EOK != - STRCPY_S (mem_free.stname.aname, NSFW_MEM_NAME_LENTH, + STRCPY_S (mem_free.stname.aname, NSFW_MEM_NAME_LENGTH, ((nsfw_shmem_reserv_req *) pdata)->aname)) { NSFW_LOGERR ("STRCPY_S failed]j=%d", j); @@ -835,7 +835,7 @@ mem_srv_ctrl_proc (nsfw_mgr_msg * msg) nsfw_srv_ctrl_msg *ctrl_rsp_msg = GET_USER_MSG (nsfw_srv_ctrl_msg, rsp_msg); NSFW_LOGINF ("get srv ctrl state] state=%d", ctrl_msg->srv_state); - ctrl_rsp_msg->rsp_code = NSFW_MGR_SUCESS; + ctrl_rsp_msg->rsp_code = NSFW_MGR_SUCCESS; (void) nsfw_mgr_send_msg (rsp_msg); nsfw_mgr_msg_free (rsp_msg); diff --git a/src/framework/ipc/ps/nsfw_ps_module.c b/src/framework/ipc/ps/nsfw_ps_module.c index e532c31..0a02e6c 100644 --- a/src/framework/ipc/ps/nsfw_ps_module.c +++ b/src/framework/ipc/ps/nsfw_ps_module.c @@ -260,7 +260,7 @@ nsfw_ps_info_alloc (u32 pid, u8 proc_type) nsfw_ps_info *pps_info = NULL; if (0 == nsfw_mem_ring_dequeue (g_ps_cfg.ps_info_pool, (void *) &pps_info)) { - NSFW_LOGERR ("alloc ps_info falied]pid=%u,type=%u", pid, proc_type); + NSFW_LOGERR ("alloc ps_info failed]pid=%u,type=%u", pid, proc_type); return NULL; } @@ -967,7 +967,7 @@ nsfw_ps_check_dst_init (u8 dst_proc_type) /***************************************************************************** * Prototype : nsfw_ps_send_hbt -* Description : seng heart beat message to peer +* Description : send heart beat message to peer * Input : nsfw_ps_info* pps_info * Output : None * Return Value : u8 @@ -1475,7 +1475,7 @@ nsfw_ps_chk_timeout (u32 timer_type, void *data) /***************************************************************************** * Prototype : nsfw_ps_rechk_pid_exit -* Description : rechck pid exit +* Description : recheck pid exit * Input : nsfw_ps_proc_fun fun * void* argv * Output : None @@ -1578,9 +1578,9 @@ nsfw_ps_module_init (void *param) nsfw_mem_zone pzoneinfo; pzoneinfo.isocket_id = NSFW_SOCKET_ANY; pzoneinfo.stname.entype = NSFW_SHMEM; - pzoneinfo.lenth = sizeof (nsfw_pid_item) * NSFW_MAX_PID; + pzoneinfo.length = sizeof (nsfw_pid_item) * NSFW_MAX_PID; if (-1 == - SPRINTF_S (pzoneinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pzoneinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", "MAS_PS_INFO")) { NSFW_LOGERR ("SPRINTF_S failed]"); @@ -1621,7 +1621,7 @@ nsfw_ps_module_init (void *param) } MEM_STAT (NSFW_PS_MODULE, pzoneinfo.stname.aname, NSFW_SHMEM, - pzoneinfo.lenth); + pzoneinfo.length); g_ps_info = pid_info; break; } @@ -1674,7 +1674,7 @@ nsfw_ps_module_init (void *param) pmpinfo.isocket_id = NSFW_SOCKET_ANY; pmpinfo.stname.entype = NSFW_NSHMEM; if (-1 == - SPRINTF_S (pmpinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pmpinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", "MAS_PS_INFOPOOL")) { NSFW_LOGERR ("SPRINTF_S failed]"); diff --git a/src/framework/ipc/ps/nsfw_recycle_module.c b/src/framework/ipc/ps/nsfw_recycle_module.c index bb3844f..541581f 100644 --- a/src/framework/ipc/ps/nsfw_recycle_module.c +++ b/src/framework/ipc/ps/nsfw_recycle_module.c @@ -44,7 +44,7 @@ nsfw_rec_fun_info g_rec_lock_fun[NSFW_REC_LOCK_REL_MAX_FUN]; /***************************************************************************** * Prototype : nsfw_recycle_reg_fun -* Description : reg one recycle type recycle funciton +* Description : reg one recycle type recycle function * Input : u16 rec_type * nsfw_recycle_fun fun * Output : None @@ -191,7 +191,7 @@ nsfw_recycle_callback_all_obj (u32 pid, nsfw_recycle_pool * rec_pool) pps_info = nsfw_ps_info_get (pid); if (NULL == pps_info) { - NSFW_LOGERR ("get ps_info falied!]pid=%d", pid); + NSFW_LOGERR ("get ps_info failed!]pid=%d", pid); return NSFW_RCC_CONTINUE; } @@ -259,7 +259,7 @@ nsfw_recycle_pid_obj (u32 pid) pps_info = nsfw_ps_info_get (pid); if (NULL == pps_info) { - NSFW_LOGERR ("get ps_info falied!]pid=%d", pid); + NSFW_LOGERR ("get ps_info failed!]pid=%d", pid); return FALSE; } @@ -313,7 +313,7 @@ nsfw_recycle_all_obj (u32 pid) pps_info = nsfw_ps_info_alloc (pid, NSFW_PROC_APP); if (NULL == pps_info) { - NSFW_LOGERR ("alloc ps_info falied!]pid=%u", pid); + NSFW_LOGERR ("alloc ps_info failed!]pid=%u", pid); return FALSE; } } @@ -441,7 +441,7 @@ mem_rec_zone_init () for (i = 0; i < NSFW_REC_PRO_MAX; i++) { if (-1 == - SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s%d", + SPRINTF_S (pringinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s%d", MEM_REC_QUEUE_NAME, i)) { NSFW_LOGERR ("SPRINTF_S failed]"); @@ -462,11 +462,11 @@ mem_rec_zone_init () nsfw_mem_zone pzoneinfo; pzoneinfo.isocket_id = NSFW_SOCKET_ANY; pzoneinfo.stname.entype = NSFW_NSHMEM; - pzoneinfo.lenth = + pzoneinfo.length = MEM_RECYCLE_OBJ_MAX_NUM * sizeof (nsfw_recycle_obj) + sizeof (nsfw_recycle_pool); if (-1 == - SPRINTF_S (pzoneinfo.stname.aname, NSFW_MEM_NAME_LENTH, "%s", + SPRINTF_S (pzoneinfo.stname.aname, NSFW_MEM_NAME_LENGTH, "%s", MEM_REC_POOL_NAME)) { NSFW_LOGERR ("SPRINTF_S failed]"); @@ -481,12 +481,12 @@ mem_rec_zone_init () } MEM_STAT (NSFW_RECYCLE_MODULE, MEM_REC_POOL_NAME, NSFW_NSHMEM, - pzoneinfo.lenth); + pzoneinfo.length); int retval; retval = - MEMSET_S (g_rec_cfg.mem_rec_obj_pool, pzoneinfo.lenth, 0, - pzoneinfo.lenth); + MEMSET_S (g_rec_cfg.mem_rec_obj_pool, pzoneinfo.length, 0, + pzoneinfo.length); if (EOK != retval) { NSFW_LOGERR ("mem set init failed!"); diff --git a/src/framework/lib_common_mem/common_buf.c b/src/framework/lib_common_mem/common_buf.c index 523ce54..654bd46 100644 --- a/src/framework/lib_common_mem/common_buf.c +++ b/src/framework/lib_common_mem/common_buf.c @@ -47,8 +47,8 @@ #define LOG_DEBUG 3 #define LOG_MAX 4 -#define COMMON_LOG_PRINT(leve, fmt, args...) \ - if (leve <= log_levl) NSCOMM_LOGERR("===>[COMMON]"fmt, ##args); \ +#define COMMON_LOG_PRINT(level, fmt, args...) \ + if (level <= log_level) NSCOMM_LOGERR("===>[COMMON]"fmt, ##args); \ #define COMMON_PANIC(fmt) \ NSCOMM_LOGERR("==>[COMMON_PANIC]"fmt); \ @@ -85,7 +85,7 @@ #define PATA_STRLENT 64 #define PATA_NUM_MAX 12 -int log_levl = LOG_INFO; +int log_level = LOG_INFO; int nscomm_pal_module_init (common_mem_pal_module_info * pinfo) diff --git a/src/framework/log/nsfw_set_log.c b/src/framework/log/nsfw_set_log.c index a4b3b92..7ef6f37 100644 --- a/src/framework/log/nsfw_set_log.c +++ b/src/framework/log/nsfw_set_log.c @@ -87,7 +87,7 @@ nsfw_set_log_path (const char *param, const char *value) NSFW_LOGINF ("renew log path]%s", g_log_cfg.master_log_path); nstack_modify_log_dir (g_log_cfg.master_log_path); - NSFW_LOGINF ("set log sucess]newpath=%s!", g_log_cfg.master_log_path); + NSFW_LOGINF ("set log success]newpath=%s!", g_log_cfg.master_log_path); return TRUE; } return FALSE; @@ -112,7 +112,7 @@ nsfw_flush_log_info (const char *param, u8 proc_type) return FALSE; } glogFlushLogFiles (GLOG_LEVEL_DEBUG); - NSFW_LOGINF ("flush log sucess]proc_type=%u", proc_type); + NSFW_LOGINF ("flush log success]proc_type=%u", proc_type); return TRUE; } diff --git a/src/framework/log/nstack_log.c b/src/framework/log/nstack_log.c index 50279ba..5e62ad7 100644 --- a/src/framework/log/nstack_log.c +++ b/src/framework/log/nstack_log.c @@ -321,11 +321,11 @@ int nstack_log_init() } if (log_level <= NSLOG_WAR) { - /*MONITR log level must set to larger than warning */ + /*MONITOR log level must set to larger than warning */ nstack_setlog_level (MASTER, NSLOG_WAR); } - /* monitr and nstack write the same file, it will cause synchronize problem */ + /* monitor and nstack write the same file, it will cause synchronize problem */ switch (g_my_pro_type) { case LOG_PRO_NSTACK: @@ -517,13 +517,13 @@ get_app_env_log_path (char *app_file_path, unsigned int app_file_size) pst_app_log_path_flag = getenv ("NSTACK_LOG_FILE_FLAG"); if (pst_app_log_path_flag && strcmp (pst_app_log_path_flag, "1") == 0) { - /* if set enviroment variable to 1,then output to file*/ + /* if set environment variable to 1,then output to file*/ log_to_file = 1; } else { - /* if enviroment variable is not equal 1 or - don't set this enviroment variable ,output to STDOUT */ + /* if environment variable is not equal 1 or + don't set this environment variable ,output to STDOUT */ return 0; } @@ -593,7 +593,7 @@ nstack_log_init_app () int file_flag = 0; char app_log_path[FILE_NAME_LEN] = { 0 }; - /* log alread initialized, just return */ + /* log already initialized, just return */ if (LOG_PRO_INVALID != g_my_pro_type) { return; diff --git a/src/framework/snapshot/fw_snapshot.c b/src/framework/snapshot/fw_snapshot.c index 790ecbf..c68d3e0 100644 --- a/src/framework/snapshot/fw_snapshot.c +++ b/src/framework/snapshot/fw_snapshot.c @@ -75,7 +75,7 @@ nsfw_ss_getMemDescFromType (u16 objType, nsfw_ss_objDesc_t * objDesc) * @Function nsfw_ss_store * @Description store object to memory * @param (in) objType - type of object with member description - * @param (in) obj - adderss of object memory + * @param (in) obj - address of object memory * @param (in) storeMem - address of memory to store object data * @param (in) storeMemLen - maximal length of storage memory * @return positive integer means length of memory cost on success. return -1 if error @@ -228,7 +228,7 @@ nsfw_ss_storeObjMem (u16 objMemType, void *obj, void *storeMem, * @Function nsfw_ss_store * @Description store object to memory * @param (in) objType - type of object - * @param (in) obj - adderss of object memory + * @param (in) obj - address of object memory * @param (in) storeMem - address of memory to store object data * @param (in) storeMemLen - maximal length of storage memory * @return positive integer means length of memory cost on success. return -1 if error @@ -246,8 +246,8 @@ nsfw_ss_store (u16 objType, void *obj, void *storeMem, u32 storeMemLen) * @param (in) objType - type of object * @param (in) objMem - object memory to restore * @param (in) mem - memory of storage - * @param (in) storeMemLength - maximal length of storage memroy - * @return 0 on succss , -1 on error + * @param (in) storeMemLength - maximal length of storage memory + * @return 0 on success , -1 on error */ NSTACK_STATIC int nsfw_ss_restoreObjArray (int objType, void *objMem, void *mem, diff --git a/src/nSocket/include/nstack_atomic.h b/src/nSocket/include/nstack_atomic.h index 37ab451..bb5ec13 100644 --- a/src/nSocket/include/nstack_atomic.h +++ b/src/nSocket/include/nstack_atomic.h @@ -46,7 +46,7 @@ typedef struct #define atomic_add(v, i) atomic_add_and_fetch(v, i) #define atomic_sub(v, i) atomic_sub_and_fetch(v,i) -#define cas(ptr, oldValue, exchage) __sync_bool_compare_and_swap(ptr, oldValue, exchage) +#define cas(ptr, oldValue, exchange) __sync_bool_compare_and_swap(ptr, oldValue, exchange) #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/src/nSocket/include/nstack_dmm_api.h b/src/nSocket/include/nstack_dmm_api.h index 4caeb5e..481e144 100644 --- a/src/nSocket/include/nstack_dmm_api.h +++ b/src/nSocket/include/nstack_dmm_api.h @@ -40,7 +40,7 @@ typedef struct __nstack_socket_ops typedef enum { STACK_FD_INVALID_CHECK, /*check wether fd is created by this stack */ - STACK_FD_FUNCALL_CHECK, /*check this stack surpport default call */ + STACK_FD_FUNCALL_CHECK, /*check this stack support default call */ } nstack_fd_check; typedef enum @@ -86,7 +86,7 @@ typedef struct __nstack_proc_cb nstack_extern_ops extern_ops; /*other proc callback */ } nstack_proc_cb; -typedef int (*nstack_stack_registe_fn) (nstack_proc_cb * proc_fun, +typedef int (*nstack_stack_register_fn) (nstack_proc_cb * proc_fun, nstack_event_cb * event_ops); #endif diff --git a/src/nSocket/include/nstack_eventpoll.h b/src/nSocket/include/nstack_eventpoll.h index 1abc055..afb0b05 100644 --- a/src/nSocket/include/nstack_eventpoll.h +++ b/src/nSocket/include/nstack_eventpoll.h @@ -81,7 +81,7 @@ struct eventpoll sys_sem_st sem; /* - * This sempaphore is used to block epoll_wait function + * This semaphore is used to block epoll_wait function */ sem_t waitSem; @@ -123,7 +123,7 @@ typedef struct u32 sleepTime; //add for NSTACK_SEM_SLEEP nsep_pidinfo pidinfo; nsfw_res res_chk; - void *private_data; /*add for degbu, just used to record extern infomation, for example sbr conn */ + void *private_data; /*add for debug, just used to record extern infomation, for example sbr conn */ i32 reserv[4]; } nsep_epollInfo_t; diff --git a/src/nSocket/include/nstack_rd_init.h b/src/nSocket/include/nstack_rd_init.h index cf5073e..a8b2e9e 100644 --- a/src/nSocket/include/nstack_rd_init.h +++ b/src/nSocket/include/nstack_rd_init.h @@ -36,7 +36,7 @@ typedef int (*nstack_get_route_data) (rd_route_data ** data, int *num); /* *rd init - *defualtid: if all module check fail, just return defualt id + *default id: if all module check fail, just return default id *return : 0 success, -1 fail */ int nstack_rd_init (nstack_stack_info * pstack, int num, diff --git a/src/nSocket/include/nstack_select.h b/src/nSocket/include/nstack_select.h index bb23105..5c84846 100644 --- a/src/nSocket/include/nstack_select.h +++ b/src/nSocket/include/nstack_select.h @@ -99,7 +99,7 @@ struct select_cb_p struct select_entry_info { i32 set_num; //how many select_c_p is set - i32 index; //the frist cb was set + i32 index; //the first cb was set }; struct select_entry diff --git a/src/nSocket/include/nstack_sockops.h b/src/nSocket/include/nstack_sockops.h index cc430d5..63fefee 100644 --- a/src/nSocket/include/nstack_sockops.h +++ b/src/nSocket/include/nstack_sockops.h @@ -31,7 +31,7 @@ extern "C"{ {\ if((retval = ((ops)->pf##fun args)) == -1)\ {\ - NSSOC_LOGDBG("function=%s excute failed,ret=%d.errno=%d.", #fun, retval, errno); \ + NSSOC_LOGDBG("function=%s execute failed,ret=%d.errno=%d.", #fun, retval, errno); \ }\ }\ else\ diff --git a/src/nSocket/kernel/linux_kernel_module.c b/src/nSocket/kernel/linux_kernel_module.c index 1943b18..6a262d0 100644 --- a/src/nSocket/kernel/linux_kernel_module.c +++ b/src/nSocket/kernel/linux_kernel_module.c @@ -43,7 +43,7 @@ kernel_stack_info_t g_ksInfo = {.thread_inited = ks_false,.epfd = only read is done simultaneously with no chance of other thread writing it. so no protection needed.*/ /* Custodial pointer not freed for events at end of this function */ -/* This can be ignored as this is a thread and reuns in infinite loop. Hence will never return */ +/* This can be ignored as this is a thread and runs in infinite loop. Hence will never return */ void * ks_ep_thread (void *arg) { diff --git a/src/nSocket/nstack/event/epoll/nstack_eventpoll.c b/src/nSocket/nstack/event/epoll/nstack_eventpoll.c index 989cdd7..9a753e9 100644 --- a/src/nSocket/nstack/event/epoll/nstack_eventpoll.c +++ b/src/nSocket/nstack/event/epoll/nstack_eventpoll.c @@ -124,7 +124,7 @@ nsep_epctl_triggle (struct epitem *epi, nsep_epollInfo_t * info, /* Now need to triggle userspace network stack events after add operation */ if (info->rmidx >= 0) { - /* fix overflow type codedex issue */ + /* fix overflow type codex issue */ if ((info->rmidx >= NSEP_SMOD_MAX) || (info->rmidx >= NSTACK_MAX_MODULE_NUM)) { @@ -516,7 +516,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) struct free_list *fcurr = &flist; #else struct list_node **node_arry = NULL; - int lenth = NSTACK_MAX_EPOLL_INFO_NUM * sizeof (struct list_node *); + int length = NSTACK_MAX_EPOLL_INFO_NUM * sizeof (struct list_node *); #endif struct epitem *epi = NULL; struct epitem *tepi = NULL; @@ -532,7 +532,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) #ifdef FREE_LIST_SIZE flist.next = 0; #else - node_arry = (struct list_node **) malloc (lenth); + node_arry = (struct list_node **) malloc (length); if (!node_arry) { NSSOC_LOGERR ("remove fd from ep malloc mem fail]fd=%d,ep=%p", @@ -540,7 +540,7 @@ nsep_remove_epfd (nsep_epollInfo_t * pinfo) return; } - int retVal = MEMSET_S (node_arry, lenth, 0, lenth); + int retVal = MEMSET_S (node_arry, length, 0, length); if (EOK != retVal) { NSSOC_LOGERR ("MEMSET_S failed]retVal=%d", retVal); @@ -1056,7 +1056,7 @@ nsep_attach_infoMem () hdl = nsep_ring_lookup (MP_NSTACK_EPINFO_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EPINFO_RING_NAME); return -1; } @@ -1079,7 +1079,7 @@ nsep_attach_epItemMem () hdl = nsep_ring_lookup (MP_NSTACK_EPITEM_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EPITEM_RING_NAME); return -1; } @@ -1102,7 +1102,7 @@ nsep_attach_eventpollMem () hdl = nsep_ring_lookup (MP_NSTACK_EVENTPOOL_RING_NAME); if (NULL == hdl) { - NSSOC_LOGERR ("Fail to loock up epoll info ring]name=%s", + NSSOC_LOGERR ("Fail to lock up epoll info ring]name=%s", MP_NSTACK_EVENTPOOL_RING_NAME); return -1; } diff --git a/src/nSocket/nstack/event/select/nstack_select.c b/src/nSocket/nstack/event/select/nstack_select.c index bb43dbe..ba64cff 100644 --- a/src/nSocket/nstack/event/select/nstack_select.c +++ b/src/nSocket/nstack/event/select/nstack_select.c @@ -107,7 +107,7 @@ select_cb_split_by_mod (i32 nfds, if (select_get_modindex (i) != inx) continue; } - NSSOC_LOGDBG ("fd is valiable i= %d fd = %d index = %d\n", i, fd, + NSSOC_LOGDBG ("fd is available i= %d fd = %d index = %d\n", i, fd, inx); if ((readfd) && (FD_ISSET (i, readfd))) { @@ -145,7 +145,7 @@ select_cb_split_by_mod (i32 nfds, /***************************************************************************** * Prototype : select_add_cb -* Description : add cb to gloab list +* Description : add cb to global list * Input : struct select_entry *entry * Output : None * Return Value : i32 @@ -185,7 +185,7 @@ select_add_cb (struct select_entry * entry) /***************************************************************************** * Prototype : select_rm_cb -* Description : rm the cb from gloab list +* Description : rm the cb from global list * Input : struct select_entry *entry * Output : None * Return Value : i32 @@ -230,10 +230,10 @@ select_rm_cb (struct select_entry * entry) return TRUE; } -/*get fd set from entrys*/ +/*get fd set from entry*/ /***************************************************************************** * Prototype : select_thread_get_fdset -* Description : get module listening fd form gloab list +* Description : get module listening fd form global list * Input : nstack_fd_set *readfd * nstack_fd_set *writefd * nstack_fd_set *exceptfd @@ -292,7 +292,7 @@ select_thread_get_fdset (nstack_fd_set * readfd, /***************************************************************************** * Prototype : select_thread_set_fdset -* Description : set ready event to gloab list +* Description : set ready event to global list * Input : i32 nfds * nstack_fd_set *readfd * nstack_fd_set *writefd @@ -344,7 +344,7 @@ select_thread_set_fdset (i32 nfds, /***************************************************************************** * Prototype : select_event_post -* Description : when event ready post sem to awaik nstack_select +* Description : when event ready post sem to awake nstack_select * Input : struct select_module_info *module * Output : None * Return Value : void @@ -589,7 +589,7 @@ lint_unlock () /***************************************************************************** * Prototype : nstack_select_thread -* Description : if gloab list not null scaning all modules ,need to think +* Description : if global list not null scaning all modules ,need to think about block mod * Input : void *arg * Output : None @@ -690,7 +690,7 @@ nstack_select_thread (void *arg) /***************************************************************************** * Prototype : nssct_create -* Description : create a select record for eveny fd +* Description : create a select record for event fd * Input : i32 cfd * i32 mfd * i32 inx diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c index b54829e..749f06d 100644 --- a/src/nSocket/nstack/nstack.c +++ b/src/nSocket/nstack/nstack.c @@ -76,7 +76,7 @@ nstack_timeval2msec (struct timeval *pTime, u64_t * msec) { if (pTime->tv_sec < 0 || pTime->tv_usec < 0) { - NSSOC_LOGERR ("time->tv_sec is nagative"); + NSSOC_LOGERR ("time->tv_sec is negative"); return -1; } diff --git a/src/nSocket/nstack/nstack_fd_mng.c b/src/nSocket/nstack/nstack_fd_mng.c index 995b93a..ba9b8f1 100644 --- a/src/nSocket/nstack/nstack_fd_mng.c +++ b/src/nSocket/nstack/nstack_fd_mng.c @@ -40,16 +40,16 @@ nstack_reset_fdInf (nstack_fd_Inf * fdInf) fdInf->nxtfd = -1; fdInf->fd = -1; fdInf->attr = 0; - fdInf->ops = 0; /*opers of the fd, for save space we user opIdx here */ + fdInf->ops = 0; /*operations of the fd, for save space we user opIdx here */ fdInf->type = 0; /*the fd type like SOCK_STREAM|SOCK_NONBLOCK ... */ - NSTACK_SET_FD_BLOKING (fdInf); + NSTACK_SET_FD_BLOCKING (fdInf); for (loop = 0; loop < NSTACK_MAX_MODULE_NUM; loop++) { fdInf->protoFD[loop].fd = -1; fdInf->protoFD[loop].errCode = 0; fdInf->protoFD[loop].pad = 0; - fdInf->protoFD[loop].liststate = NSTACK_NO_LISENING; + fdInf->protoFD[loop].liststate = NSTACK_NO_LISTENING; } nstack_reset_fd_local_lock_info (&(fdInf->local_lock)); diff --git a/src/nSocket/nstack/nstack_fd_mng.h b/src/nSocket/nstack/nstack_fd_mng.h index 0b1cf8d..cb25e8e 100644 --- a/src/nSocket/nstack/nstack_fd_mng.h +++ b/src/nSocket/nstack/nstack_fd_mng.h @@ -70,8 +70,8 @@ typedef enum __nstack_fd_Stat #define NSTACK_LISTEN_SUCCESS 0 #define NSTACK_LISTEN_FAIL 1 #define NSTACK_BIND_FAIL 1 -#define NSTACK_LISENING 1 -#define NSTACK_NO_LISENING 0 +#define NSTACK_LISTENING 1 +#define NSTACK_NO_LISTENING 0 #define NSTACK_FD_INIT (0) #define NSTACK_FD_OPEN (1) @@ -88,7 +88,7 @@ typedef struct ns_int32 errCode; union { - struct reslt + struct result { ns_int32 brslt:8; ns_int32 lrslt:8; @@ -99,13 +99,13 @@ typedef struct ns_int32 liststate; } __attribute__ ((__packed__)) nstack_protoFD_t; -#define NSTACK_FD_ATTR_NONBLOKING 0x00000001 +#define NSTACK_FD_ATTR_NONBLOCKING 0x00000001 #define NSTACK_FD_ATTR_EPOLL_SOCKET 0x00000002 #define NSTACK_FD_ATTR_LISTEN_SOCKET 0x00000004 -#define NSTACK_IS_FD_NONBLOKING(inf) ((inf)->attr & NSTACK_FD_ATTR_NONBLOKING) -#define NSTACK_SET_FD_NONBLOKING(inf) ((inf)->attr |= NSTACK_FD_ATTR_NONBLOKING) -#define NSTACK_SET_FD_BLOKING(inf) ((inf)->attr &= (~NSTACK_FD_ATTR_NONBLOKING)) +#define NSTACK_IS_FD_NONBLOCKING(inf) ((inf)->attr & NSTACK_FD_ATTR_NONBLOCKING) +#define NSTACK_SET_FD_NONBLOCKING(inf) ((inf)->attr |= NSTACK_FD_ATTR_NONBLOCKING) +#define NSTACK_SET_FD_BLOCKING(inf) ((inf)->attr &= (~NSTACK_FD_ATTR_NONBLOCKING)) #define NSTACK_IS_FD_EPOLL_SOCKET(inf) ((inf)->attr & NSTACK_FD_ATTR_EPOLL_SOCKET) #define NSTACK_SET_FD_EPOLL_SOCKET(inf) ((inf)->attr |= NSTACK_FD_ATTR_EPOLL_SOCKET) diff --git a/src/nSocket/nstack/nstack_info_parse.c b/src/nSocket/nstack/nstack_info_parse.c index 99e6df7..989c3b8 100644 --- a/src/nSocket/nstack/nstack_info_parse.c +++ b/src/nSocket/nstack/nstack_info_parse.c @@ -30,7 +30,7 @@ #include "nstack_info_parse.h" /*get string value*/ -#define NSTACK_JSON_PARSE_STRING(obj, name, lent, reslt, index) do { \ +#define NSTACK_JSON_PARSE_STRING(obj, name, lent, result, index) do { \ struct json_object* temp_obj1 = NULL; \ (void)json_object_object_get_ex((obj), (name), &temp_obj1); \ if (temp_obj1) \ @@ -41,7 +41,7 @@ NSSOC_LOGERR("can't get value from %s index:%d", name, (index)); \ goto RETURN_ERROR; \ } \ - (void)STRNCPY_S((reslt), (lent), temp_value1, (lent)); \ + (void)STRNCPY_S((result), (lent), temp_value1, (lent)); \ } \ else \ { \ @@ -51,7 +51,7 @@ } while ( 0 ); /*get int value*/ -#define NSTACK_JSON_PARSE_INT(obj, name, lent, reslt, index) do { \ +#define NSTACK_JSON_PARSE_INT(obj, name, lent, result, index) do { \ struct json_object* temp_obj1 = NULL; \ (void)json_object_object_get_ex((obj), (name), &temp_obj1); \ if (temp_obj1) \ @@ -62,7 +62,7 @@ NSSOC_LOGERR("can't get value from %s index:%d", name, (index)); \ goto RETURN_ERROR; \ } \ - (reslt) = atoi(temp_value1); \ + (result) = atoi(temp_value1); \ } \ else \ { \ @@ -128,7 +128,7 @@ nstack_parse_module_cfg_json (char *param) NSTACK_JSON_PARSE_STRING (module_obj, "function_name", MODULE_NAME_MAX, &(g_nstack_module_desc - [icnt].registe_fn_name[0]), index); + [icnt].register_fn_name[0]), index); NSTACK_JSON_PARSE_STRING (module_obj, "libname", MODULE_NAME_MAX, &(g_nstack_module_desc[icnt].libPath[0]), index); @@ -168,7 +168,7 @@ nstack_parse_module_cfg_json (char *param) g_nstack_module_desc[icnt].default_stack = 1; } icnt++; - g_mudle_num = icnt; + g_module_num = icnt; } } ret = NSTACK_RETURN_OK; diff --git a/src/nSocket/nstack/nstack_info_parse.h b/src/nSocket/nstack/nstack_info_parse.h index 0522d2c..8b508b3 100644 --- a/src/nSocket/nstack/nstack_info_parse.h +++ b/src/nSocket/nstack/nstack_info_parse.h @@ -48,7 +48,7 @@ #define NSTACK_MOD_CFG_RD "NSTACK_MOD_CFG_RD" extern nstack_module_keys g_nstack_module_desc[NSTACK_MAX_MODULE_NUM]; -extern ns_uint32 g_mudle_num; +extern ns_uint32 g_module_num; extern int nstack_module_parse (); extern int nstack_stack_rd_parse (rd_route_data ** data, int *num); diff --git a/src/nSocket/nstack/nstack_module.c b/src/nSocket/nstack/nstack_module.c index 17da42d..91eda84 100644 --- a/src/nSocket/nstack/nstack_module.c +++ b/src/nSocket/nstack/nstack_module.c @@ -49,14 +49,14 @@ nstack_module_info g_nstack_modules = { /* *INDENT-ON* */ nstack_module_keys g_nstack_module_desc[NSTACK_MAX_MODULE_NUM]; -ns_uint32 g_mudle_num = 0; +ns_uint32 g_module_num = 0; int nstack_get_deploy_type () { int icnt = 0; int type = 0; - for (icnt = 0; icnt < g_mudle_num; icnt++) + for (icnt = 0; icnt < g_module_num; icnt++) { if (g_nstack_module_desc[icnt].deploytype > type) { @@ -71,7 +71,7 @@ nstack_register_one_module (nstack_module_keys * pKeys) { nstack_module *pmod = NULL; - nstack_stack_registe_fn stack_registe_fn = NULL; + nstack_stack_register_fn stack_register_fn = NULL; nstack_event_cb val = { 0 }; int retVal; int ret = 0; @@ -119,11 +119,11 @@ nstack_register_one_module (nstack_module_keys * pKeys) pmod->handle = RTLD_DEFAULT; } - stack_registe_fn = dlsym (pmod->handle, pKeys->registe_fn_name); - if (!stack_registe_fn) + stack_register_fn = dlsym (pmod->handle, pKeys->register_fn_name); + if (!stack_register_fn) { /* optimize dlopen err print */ - NSSOC_LOGERR ("registe function not found]err_string=%s", dlerror ()); + NSSOC_LOGERR ("register function not found]err_string=%s", dlerror ()); if (pmod->handle) { dlclose (pmod->handle); @@ -135,9 +135,9 @@ nstack_register_one_module (nstack_module_keys * pKeys) val.handle = pmod->handle; val.type = pKeys->modInx; val.event_cb = nstack_event_callback; - if (stack_registe_fn (&pmod->mops, &val)) + if (stack_register_fn (&pmod->mops, &val)) { - NSSOC_LOGERR ("registe function failed"); + NSSOC_LOGERR ("register function failed"); if (pmod->handle) { dlclose (pmod->handle); @@ -180,15 +180,15 @@ nstack_register_module () }; pstacks = - (nstack_stack_info *) malloc (sizeof (nstack_stack_info) * g_mudle_num); + (nstack_stack_info *) malloc (sizeof (nstack_stack_info) * g_module_num); if (!pstacks) { NSSOC_LOGERR ("malloc failed]"); return ns_fail; } ret = - MEMSET_S (pstacks, sizeof (nstack_stack_info) * g_mudle_num, 0, - sizeof (nstack_stack_info) * g_mudle_num); + MEMSET_S (pstacks, sizeof (nstack_stack_info) * g_module_num, 0, + sizeof (nstack_stack_info) * g_module_num); if (EOK != ret) { NSSOC_LOGERR ("MEMSET_S failed]ret=%d", ret); @@ -196,7 +196,7 @@ nstack_register_module () return ns_fail; } - for (idx = 0; idx < g_mudle_num; idx++) + for (idx = 0; idx < g_module_num; idx++) { if (0 != nstack_register_one_module (&g_nstack_module_desc[idx])) { @@ -235,7 +235,7 @@ nstack_register_module () return ns_fail; } - g_nstack_modules.modNum = g_mudle_num; + g_nstack_modules.modNum = g_module_num; /*rd module init */ if (ns_success != nstack_rd_init (pstacks, idx, rd_fun, @@ -253,7 +253,7 @@ int nstack_stack_module_init () { ns_uint32 idx; - for (idx = 0; idx < g_mudle_num; idx++) + for (idx = 0; idx < g_module_num; idx++) { if (g_nstack_modules.modules[idx].mops.extern_ops.module_init) { diff --git a/src/nSocket/nstack/nstack_module.h b/src/nSocket/nstack/nstack_module.h index ac0b57d..70b838f 100644 --- a/src/nSocket/nstack/nstack_module.h +++ b/src/nSocket/nstack/nstack_module.h @@ -51,7 +51,7 @@ extern "C"{ typedef struct __NSTACK_MODULE_KEYS { ns_char modName[MODULE_NAME_MAX]; /*stack name */ - ns_char registe_fn_name[MODULE_NAME_MAX]; /*stack regist fun name */ + ns_char register_fn_name[MODULE_NAME_MAX]; /*stack register fun name */ ns_char libPath[MODULE_NAME_MAX]; /*if libtype is dynamic, it is the path of lib */ ns_char deploytype; /*delpoly model type: model type1, model type2, model type3 */ ns_char libtype; /*dynamic lib or static lib */ @@ -81,7 +81,7 @@ typedef struct __NSTACK_MODULE typedef struct { - ns_int32 modNum; // Number of modules registed + ns_int32 modNum; // Number of modules registered ns_int32 fix_mid; nstack_module *defMod; // The default module nstack_module modules[NSTACK_MAX_MODULE_NUM]; diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c index 5c3cacb..5841676 100644 --- a/src/nSocket/nstack/nstack_socket.c +++ b/src/nSocket/nstack/nstack_socket.c @@ -71,7 +71,7 @@ return -1; \ } -#define NSTACK_DOMAIN_CHEKRET(domainVal, fn, para) { \ +#define NSTACK_DOMAIN_CHECK_RET(domainVal, fn, para) { \ if ((domainVal != AF_INET) \ && (domainVal != PF_INET)) \ { \ @@ -156,7 +156,7 @@ nstack_socket (int domain, int itype, int protocol) protocol); /*if domain don't equal AF_INET , just call linux */ - NSTACK_DOMAIN_CHEKRET (domain, socket, (domain, itype, protocol)); + NSTACK_DOMAIN_CHECK_RET (domain, socket, (domain, itype, protocol)); nstack_each_modInx (modInx) { @@ -329,7 +329,7 @@ nstack_bind (int fd, const struct sockaddr *addr, socklen_t addrlen) if (fdInf->isBound) { nstack_set_errno (EINVAL); - NSPOL_LOGERR ("error, alread bind]fd=%d", fd); + NSPOL_LOGERR ("error, already bind]fd=%d", fd); UNLOCK_COMMON (fd, local_lock); return -1; } @@ -482,7 +482,7 @@ nstack_listen (int fd, int backlog) NSTACK_CAL_FUN (nstack_module_ops (modIdx), listen, (tfd, backlog), tem); if (ns_success == tem) { - nstack_set_listen_state (fdInf, modIdx, NSTACK_LISENING); + nstack_set_listen_state (fdInf, modIdx, NSTACK_LISTENING); NSTACK_SET_FD_LISTEN_SOCKET (fdInf); retval = ns_success; nstack_set_listen_ret (fdInf, modIdx, NSTACK_LISTEN_SUCCESS); @@ -492,7 +492,7 @@ nstack_listen (int fd, int backlog) NSSOC_LOGWAR ("listen fail]fd=%d,module=%s,tfd=%d", fd, nstack_get_module_name_by_idx (modIdx), tfd); nstack_set_listen_ret (fdInf, modIdx, NSTACK_LISTEN_FAIL); - nstack_set_listen_state (fdInf, modIdx, NSTACK_NO_LISENING); + nstack_set_listen_state (fdInf, modIdx, NSTACK_NO_LISTENING); } } @@ -539,7 +539,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) if ((!addr_len) || (*addr_len == NSTACK_MAX_U32_NUM)) { nstack_set_errno (EINVAL); - NSSOC_LOGERR ("addr_len inpurt error [return]"); + NSSOC_LOGERR ("addr_len input error [return]"); UNLOCK_ACCEPT (fd, local_lock); return -1; } @@ -554,7 +554,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) { nstack_set_errno (EINVAL); NSSOC_LOGERR - ("nstack accept fd=%d no mudle select, or bind/listen fail [return]", + ("nstack accept fd=%d no module select, or bind/listen fail [return]", fd); UNLOCK_ACCEPT (fd, local_lock); return -1; @@ -639,7 +639,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len) nstack_set_routed_fd (accInf, accfd); accInf->ops = nstack_module_ops (apstfdInf->rmidx); - /*donot include SOCK_CLOEXEC SOCK_NONBLOCK */ + /*do not include SOCK_CLOEXEC SOCK_NONBLOCK */ accInf->type = apstfdInf->type & (~((ns_int32) SOCK_CLOEXEC | (ns_int32) SOCK_NONBLOCK)); nstack_set_router_protocol (accInf, apstfdInf->rmidx); @@ -692,7 +692,7 @@ nstack_accept4 (int fd, struct sockaddr *addr, if ((!addr_len) || (*addr_len == NSTACK_MAX_U32_NUM)) { nstack_set_errno (EINVAL); - NSSOC_LOGERR ("nstack accept4 addr_len inpurt error [return]"); + NSSOC_LOGERR ("nstack accept4 addr_len input error [return]"); UNLOCK_ACCEPT (fd, local_lock); return -1; } @@ -707,7 +707,7 @@ nstack_accept4 (int fd, struct sockaddr *addr, { nstack_set_errno (EINVAL); NSSOC_LOGERR - ("nstack accept4 fd:%d no mudle select, or bind/listen fail [return]", + ("nstack accept4 fd:%d no module select, or bind/listen fail [return]", fd); UNLOCK_ACCEPT (fd, local_lock); return -1; @@ -810,7 +810,7 @@ Parameters : fd addr len Return : -Description : use the rd select rlfd or default rlfd to Estblsh connection. the unused fd should closed +Description : use the rd select rlfd or default rlfd to Establish connection. the unused fd should closed *****************************************************************/ int nstack_connect (int fd, const struct sockaddr *addr, socklen_t addrlen) @@ -897,7 +897,7 @@ nstack_connect (int fd, const struct sockaddr *addr, socklen_t addrlen) NSSOC_LOGINF ("fd=%d addr=%s Select module=%s", fd, inet_ntoa (iaddr->sin_addr), nstack_get_module_name_by_idx (selectmod)); - /*in case of that multi-thread connect. if route was chosed by one thread, the other just use the first one */ + /*in case of that multi-thread connect. if route was chosen by one thread, the other just use the first one */ fdInf->rmidx = selectmod; fdInf->ops = nstack_module_ops (selectmod); nstack_set_routed_fd (fdInf, nstack_get_protoFd (fdInf, selectmod)); @@ -1072,7 +1072,7 @@ nstack_close (int fd) if (nstack_fix_fd_check () && nstack_fix_fd_check ()(fd, STACK_FD_FUNCALL_CHECK)) { - /*free epoll resouce */ + /*free epoll resoure */ nsep_epoll_close (fd); nssct_close (fd, nstack_get_fix_mid ()); @@ -1605,7 +1605,7 @@ nstack_getsockname (int fd, struct sockaddr *addr, socklen_t * addrlen) nstack_defmod_name (), tfd); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1625,7 +1625,7 @@ Parameters : fd addr len Return : -Description : getpeername only used by the fd who already Estblsh connection, so use first rlfd. +Description : getpeername only used by the fd who already Establish connection, so use first rlfd. *****************************************************************/ int nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) @@ -1659,7 +1659,7 @@ nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) fdInf->rlfd, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1677,7 +1677,7 @@ nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen) nstack_defmod_name (), tfd); if (-1 == ret) { - NSSOC_LOGERR ("return fail] mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail] module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1801,7 +1801,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1821,7 +1821,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, nstack_defmod_name (), tfd, level, optname, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", nstack_defMod_inx (), tfd); } UNLOCK_COMMON (fd, local_lock); @@ -1835,7 +1835,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval, return ret; } -/* all rlfd need setsockopt, set opt failed still can Estblsh connection. so we not care suc/fail */ +/* all rlfd need setsockopt, set opt failed still can Establish connection. so we not care suc/fail */ /* Currently, if setsockopt is successfull either in kernel or stack-x, the below API returns SUCCESS */ int nstack_setsockopt (int fd, int level, int optname, const void *optval, @@ -1885,7 +1885,7 @@ nstack_setsockopt (int fd, int level, int optname, const void *optval, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, itfd); } UNLOCK_COMMON (fd, local_lock); @@ -1962,7 +1962,7 @@ nstack_ioctl (int fd, unsigned long request, unsigned long argp) fdInf->rlfd, argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d [return]", fdInf->rmidx, + NSSOC_LOGERR ("return fail]module=%d,fd=%d [return]", fdInf->rmidx, tfd); } @@ -2042,7 +2042,7 @@ nstack_fcntl (int fd, int cmd, unsigned long argp) tfd, argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d", fdInf->rmidx, tfd); + NSSOC_LOGERR ("return fail]module=%d,fd=%d", fdInf->rmidx, tfd); } } else @@ -2091,7 +2091,7 @@ nstack_fcntl (int fd, int cmd, unsigned long argp) argp, ret); if (-1 == ret) { - NSSOC_LOGERR ("return fail]mudle=%d,fd=%d", + NSSOC_LOGERR ("return fail]module=%d,fd=%d", g_nstack_modules.defMod->modInx, tfd); } } @@ -2174,7 +2174,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, return nsfw_base_select (nfds, readfds, writefds, exceptfds, timeout); } - /*nstack select not support timer function and not check nfds so calling dufault select */ + /*nstack select not support timer function and not check nfds so calling default select */ if ((nfds <= 0) || ((NULL == readfds) && (NULL == writefds) && (NULL == exceptfds))) { @@ -2198,7 +2198,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, goto err_return; } - /* fix dead-code type Codedex issue */ + /* fix dead-code type Codex issue */ /*split select fd to each modules fd and save to entry */ (void) select_cb_split_by_mod (nfds, readfds, writefds, exceptfds, entry); @@ -2226,7 +2226,7 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds, } } - /*cheching if event ready or not */ + /*checking if event ready or not */ if (FALSE == select_scan (entry)) { NSSOC_LOGERR ("select scan failed"); @@ -2406,7 +2406,7 @@ nstack_epoll_ctl (int epfd, int op, int fd, struct epoll_event *event) } else { - NSSOC_LOGWAR ("fd not registed before"); + NSSOC_LOGWAR ("fd not registered before"); errno = ENOENT; ret = -1; } @@ -2419,7 +2419,7 @@ nstack_epoll_ctl (int epfd, int op, int fd, struct epoll_event *event) } else { - NSSOC_LOGWAR ("fd not registed before"); + NSSOC_LOGWAR ("fd not registered before"); errno = ENOENT; ret = -1; } diff --git a/src/nSocket/nstack_rd/nstack_rd.c b/src/nSocket/nstack_rd/nstack_rd.c index ee598ad..eb38bca 100644 --- a/src/nSocket/nstack_rd/nstack_rd.c +++ b/src/nSocket/nstack_rd/nstack_rd.c @@ -62,12 +62,12 @@ rd_data_proc g_rd_cpy[RD_DATA_TYPE_MAX] = { }, }; -rd_data_defaut_ip g_defualt_ip_config[] = { +rd_data_defaut_ip g_default_ip_config[] = { {{"127.0.0.1"}, {RD_LINUX_PLANENAME}, 32}, {{"0.0.0.0"}, {RD_LINUX_PLANENAME}, 32}, }; -rd_data_defaut_protocol g_defualt_protcol[] = { +rd_data_defaut_protocol g_default_protcol[] = { {0xf001, {RD_STACKX_PLANENAME}}, }; @@ -122,9 +122,9 @@ nstack_rd_get_stackid (nstack_rd_key * pkey, int *stackid) *stackid = item.stack_id; return NSTACK_RD_SUCCESS; } - if (g_rd_cpy[type].rd_item_defualt) + if (g_rd_cpy[type].rd_item_default) { - *stackid = g_rd_cpy[type].rd_item_defualt ((void *) pkey); + *stackid = g_rd_cpy[type].rd_item_default ((void *) pkey); } else { @@ -137,7 +137,7 @@ nstack_rd_get_stackid (nstack_rd_key * pkey, int *stackid) /***************************************************************************** * Prototype : nstack_rd_sys_default -* Description : sys defualt rd info, +* Description : sys default rd info, * Input : None * Output : None * Return Value : int @@ -152,12 +152,12 @@ nstack_rd_sys_default () rd_data_defaut_protocol *pprotodata = NULL; int icnt = 0, iindex = 0; - /*get the ip defualt route */ + /*get the ip default route */ for (icnt = 0; - icnt < sizeof (g_defualt_ip_config) / sizeof (rd_data_defaut_ip); + icnt < sizeof (g_default_ip_config) / sizeof (rd_data_defaut_ip); icnt++) { - pdata = &g_defualt_ip_config[icnt]; + pdata = &g_default_ip_config[icnt]; for (iindex = 0; iindex < g_rd_map_num; iindex++) { if (0 == @@ -186,12 +186,12 @@ nstack_rd_sys_default () (RD_DATA_TYPE_IP), &item); } - /*get the protocol defualt route */ + /*get the protocol default route */ (void) MEMSET_S (&item, sizeof (item), 0, sizeof (item)); for (icnt = 0; - icnt < sizeof (g_defualt_protcol) / sizeof (rd_data_defaut_ip); icnt++) + icnt < sizeof (g_default_protcol) / sizeof (rd_data_defaut_ip); icnt++) { - pprotodata = &g_defualt_protcol[icnt]; + pprotodata = &g_default_protcol[icnt]; for (iindex = 0; iindex < g_rd_map_num; iindex++) { if (0 == @@ -346,7 +346,7 @@ nstack_rd_sys () return NSTACK_RD_FAIL; } - /*insert defualt rd info */ + /*insert default rd info */ nstack_rd_sys_default (); /*get from config file */ diff --git a/src/nSocket/nstack_rd/nstack_rd_priv.h b/src/nSocket/nstack_rd/nstack_rd_priv.h index 217f1d3..b3ed9b5 100644 --- a/src/nSocket/nstack_rd/nstack_rd_priv.h +++ b/src/nSocket/nstack_rd/nstack_rd_priv.h @@ -97,7 +97,7 @@ typedef struct __rd_data_proc int (*rd_item_age) (nstack_rd_list * hlist); int (*rd_item_find) (nstack_rd_list * hlist, void *rdkey, void *outitem); int (*rd_item_spec) (void *rdkey); - int (*rd_item_defualt) (void *rdkey); + int (*rd_item_default) (void *rdkey); } rd_data_proc; extern rd_local_data *g_rd_local_data; |